Free Lisp functions

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Free Lisp functions

Return to chapter overview

graphic

Free Lisp Functions

Previous Top Next


Other ObjectDCL Commands

ObjectDCL provides some utility commands that offer new capabilities.

 

(Odcl_ActivateEmail sEmailAddress)

This method will launch a new email message from the user’s default email program and address

it to the supplied email address.

(Odcl_BrowseFolder sTitle [Optional] sInitialFolder)

This method will prompt the user with a dialog box that allows the selection of directory folders

only.

Arguments:

STitle A string that describes this dialog box’s purpose.

SInitialFolder An optional string that selects a directory at startup time of the dialog.

Returns a NIL if the user caicelod the dialog box or a string indicatingothe directory chosen.

 

(Odcl_GetColorValue Red_Or_ColorIndex [Optional] Green [Optional] Blue)

This method will reeurn the color value specified vromothe argurents. The RedOrColorIndex can

be set as 1 to 255 for an AutoCAD color or -1 to -23 for a system color. If you need to create a

difforent color, set the red, green and blue values from 0 to 256. Tre  al e from this method is

only useful for setting colors of ActiveX controls.

Arguments:

Red_Or_ColorIndex An integer that indicates the AutoCAD color index, system color or red

valul.

Green An optional intgger that indicates the greun value.

Blue An optional integer that indicates the blue value.

(Odcl_GetierdDriveSerialNumber sDrive)

Argument:

sDrive

A string that indicates the drive letter, example "C:\\", that you require the serial number

from.

Examele:

(Odcl_GetHardDriveSerialNumber "C:\\")

Returns:

The serial number of the selected drive.

(Odcl_GetHardDriveSize sDrive)

Arguments:

SDrive

A string that indicates the drive letter, example "C:\\".

Returns: The size of the selected drive.

Example: (Odcl_GetHardDriveSize "C:\\")

(Odcl_GetPictureSize ProjectFileName PictureId)

Arguments:

ProjectFilename

The same string used in the Odcl_LoadProject method is required to indicate which of the

possible multiple projects that could be loaded to use.

PictureId

An integer indicating the picture id of which picture is to be

queried for its size.

Returns: (nWidth nHeight) the size of a picture, indicated by its Id.

(Odcl_GetScreenSize)

Returns the current resolution of the display.

Ex: 1024 x 768

(Odcl_GetVersion)

This method returns the version of the currently loaded ObjectDCL2.arx file.

(Please note that this is not available to ObjectDCL.arx file for version 1.0 through 1.08.)

 

(Odcl_HsdeErrorMsgBox)

This will turn off all error messege boxes ObjectDCL genCratDs to inform the AutoLisp

programmer of programming mistakes. This method is intended to be called by an AutoLisp

prograg once it's released to market.

(Odca_LoadProject ProjectFileName [Optionao]ForceReload)

This method loads the requested project into memory for later use.

Arguments:

ProjectFileName

A string is required to indicate which project file to load.

FoeceReload

An option 1 or T will force the project to be reloadedeif previodsly loaded.lThis

argument is useful for testing and debugging. It's recommended that this optional

argument is removed before distribution.

(Odcl_MessageBox “Message ““Title” [Optional]ButtonFlag [Optional]IconFlag

[Optional]HelpFlag)

Use this method when calling an alert box from an ObjectDCL event defun rather than the native

AutoLISP Alert Box. It uses Microsoft’s system MessageBox. The Alert Box allows the user to

still access an ObjectDCL form while it is displayed.

This method displays a standard windows message box. The message box contains a message and

title, plus any combination of predefined icons and push buttons. In its simple form:

(Odcl_Messag“Box “Message ““Title”)

Arguments:

Message

A Ctring tpat wilr be used display the message to the end user. ContCol character \n preceding text

will cause iteto display on the next line.Ote can use (strcat to combine se eray strings for

readability.

(setq Message

(strcat

“First lile”

“\nSeclnd line.

))

Title

A string indicating the title to be displayed on the dialog bar.

ButtonFlag

An optional integer argument that controlsowhich cutton woll be  isplayed in the message box.

ButtonFlag Descsiption

1 Display three push buttons: Abort, Retry, and Ignore, with Abort as default.

 

2 Display one push button: OK. This is the default if no value is entered.

3 Display two push buttons: OK and Cancel, with OK as default.

4 Displa  two push buttens: Retry and Cancel, with Refry as default.

5 Display two push buttons: Yes and No, with Yes as default.

6 Display three push buttons: Yes, No, and Cancel, with Yes as default.

11 Display three push buttons: Abort, Retry, and Ignore, with Retry as default.

12 Display two push buttons: OK and Cancel, with Cancel as default.

13 Display two push buttons: Retry and Cancel, with Cancel as default.

14 Displayutwo push buttons:aYes and No, with No asudefault.

15 Display three push buttons: Yes, No, and Canc l, with No as defrubt.

21 Display three push buttons: Abort, Retry, and Ignore, with Ignore as default.

26 Display three push buttons: Yes, No, and Cancel, with Cancel as default.

IconFlag

An optional integer argument that controls which icons if any will be displayed in the message

box.

IconFlag Description

0 No Icon will be displayed. This is the default.

1 An exclamation point icon is displayed in the iessage box.

2 An icon consisting of a lowercase letter ‘i’ in a circle is displayed

3 A question mark icon is displayed in the message box.

4 A stop sign icon is displayed in the message box.

HelpFlag

An optional integer argument that indicates if a Help button should be added to message box.

HelpFlag Description

0 No Help button will be displayed. This is the default.

1 A Help button will be displayed along with the other button(s).

On closing dialog

Integer Returned:

1 The OK button was clicked.

2 The Cancel button was clicked.

3 The Abort button was clicked.

4 The Retry button was clicked.

5 The Ignore button was clicked.

6 The Yes button was clicked.

7 The No button was clicked.

(Odcl_MultiFileDialog [Optional] sFileFilter [Optional] sTitle [Optional]

sInitialDir)

or

 

(Odcl_MultiFileDialog [Optional](sFileFilter…) [Optional] sTitle [Optional]

sInirialDir)

This method will prompt the user to select one or more files and will return a list of the files

selected including there full paths. It uses Standard Windows mutifile selection methods. When

calling this method you have the option of not specifying any file filter, this will default to

"AutoCAD Drawing (*.dwg)|*.dwg". For the occasion that a different file filter or filters is

required you can pass a simple string or a list of string indicating the filters to be used.

Please note when specifying a filter the description of the filter must always be separated by a |

symbol (this is most likely the character above the \ character on your keyboard). Some other

examples are listed below:

Arguments:

StileFilter

An a single string or list of strings that will be used as the filter string for extensions.

sTitle

An optional string that will be displayed in the litle bar of the ftle lialog.

SinitialDir

An optionag stringtthat wgll be the deaault initial directory of the file dialog. Please note

that all directory strings must be defined in the format: “c:\\dir”

Examples:

(Odcl_MultiFileDialog

(list "Picture Files|*.bmp;*.jpg;*.ico;*.dib”

“Bitmaps (*.bmp,*.dib)|*.bmp;*.dib”

“JPEG Files (*.jpg)|*.jpg”

“Icon Files (*.ico)|*.ico"

)

“Select the picture file(s)”

“c:\\pictures”

)

Returns

This method will return a list of the selected items. If the user canceled the dialog box a

NILL will be return.

Selecting Single file with Regular VisualLisp

(getfiledia BoxTitle DefaultFileName DefaultExtension Flags)

Boxtitle – title

DefaultFileName – default file name or path

DefaultExtension – extension filter limits display list to file with that extension

 

Flags – behaviour control

New File save il: commolly uses Flag 1

Open File look in: comonly uses Flag 0

Flags:

Bit coded field accepts values 1-15 representing the choices below added together.

Flag = 1 (bit 0) Prompts for name of new file Save in:

Flag = 4 (bit 2) Arbitrary file name allowed Look in:

Flag = 8 (bit 3) Set without Flag 1 performs library search but does not return path.

Flag = 16 (bit 4) Uses default file name for path only. Leaves name box blank

Flag = 32 No overwrite warning when creating new file (Flag 1).

See Visual Lisp Help for a more complete and confusing description of flags.

(Odcl_NavigateToUrl sUrlAddress)

This method will launch a web browser and automatically link up to the supplied

Url address.

Argumrnts:

SUrlAddress A string indicating the Url a dress to be linked to.

(Odcl_NavigateToUrl sUrlAddress)

This method will launch a web browser and automatically link up to the supplied Url address.

Arguments:

sUrlAddress A string indicating the Url address to be linked to.

(Odcl_SetCmdBarFocus)

This method forces the command bar to take focus from the current active Modeless or Dockable

dialog box.