Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Link DCL and LISP

3 REPLIES 3
Reply
Message 1 of 4
marlance
769 Views, 3 Replies

Link DCL and LISP

 

How to link Lisp and DCL file?

 

 

thanks

 

3 REPLIES 3
Message 2 of 4
mpalan2009
in reply to: marlance

; The dcl file needs to be in your AutoCAD's search path, or you need to specify the path to the dcl file.
(if (< (setq dcl_id (load_dialog "chain.dcl")) 0) (exit)) ;this loads the dialog file into AutoCAD if not found it will exit the function.

 

(new_dialog "chain" dcl_id); this loads the dialog box into the drawing to be interacted with

 

(SET_TILE "prefix" "CH "); this will populate the default values into the dcl tiles there might be one of these for each tile

;DCL is case sensitive so make sure the strings in the dcl tile names match exactly.

 

 

; Action tiles do something in the dialog
; I always create a separate function to collect the user input from the dcl tiles = (wcoll) function
; I also don't use the built in pre-configured tiles, i don't know what the keys are
(action_tile "ACP" "(progn (wcoll)(Done_Dialog)(SETQ WHAT_NEXT 1))")

 

; This action tile call just closes the dialog.
(action_tile "CAN" "(PROGN (Done_Dialog)(SETQ WHAT_NEXT 0))")

 

; After the dialog has closed and before my function continues it checks the value of WHAT_NEXT
; If the value = 0 the function exits (EXIT) if the value = 1 the function preforms its task.

 

(start_dialog); this starts the user interaction with the dialog.

 

 

; All the above needs to go in a loop if you wish to close the dialog dox to select objects and bring the dialog box back up.
; This is not that easy. I would select the objects after the dialog box has closed, unless you wish to display the results of a calculation based on the selected polylines.


; dialog box data collection function.
(defun wcoll ()
(setq pfix (get_tile "prefix")
        sfix (get_tile "suffix")
        prec (get_tile "precision") ; this will return a number as a string your function can use it to determine the value later
        intr (get_tile "interval")))  ; These string values can then be used later in you function.

 


Is this enough to get you going in the right direction?
Matthew

Message 3 of 4
scot-65
in reply to: marlance

The attached file is my base template when creating a program with a dialog.

I have left hints inside as to what to do before and after the dialog closes (and unloads).

If you want a looping dialog, my hint is to setq sd =2 before the while, and use the

done_dialog (=1 or =0) as the control for the escape out of the while loop.

 

Two items I will pass along that I have seen misinterpreted many, many times here:

- The dialog is for only gathering user input. It is not intended to do any calculations

unless the calculations involve changing the display of the dialog (repopulate a list

or switch mode_tile are examples). Calculations/executions in your program begin

after the dialog is closed, and the dialog was not canceled.

- Action tile "accept" is to take a snapshot of the current state of the dialog and one

will build a list of all the tiles that require recording of their current values AT THE

TIME THE OK BUTTON IS PRESSED.

Of course there are exceptions.

 

When developing, create a folder that has the following files inside DWG, DCL, LSP.

Have this DWG file open and no support paths are required when loading or reloading

your program as by default, the support path list begins with the current directory.

 

Hope this helps.

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 4 of 4
diagodose2009
in reply to: scot-65

YOU STORE DCL FILE  INSIDE the varaible string.

a)save   on idisk   the ascii file

you can send to me ,the private message..

 

 

 

Tags (1)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost