PDA

View Full Version : Lisp Help Needed...



Chilli
2008-03-30, 03:00 AM
Hi,

I am trying to add some feature to the lisp below and i am hoping that someone can help me. the lisp below is used to show all xrefs found in a drawing; a dialog box will appear with the xrefs listed in it, i was wondering if it is possible to have a check box or a radio button appear beside each xref that is listed, and if i can have the xref name show in the dialog box, instead of having the xref file location.

Thanks in advance.


(defun c:test (/ blk s)

(vl-load-com)

(setq s "List of Xrefs\n---------------------------\n"
blk (tblnext "BLOCK" t)
)
(while blk
(if (assoc 1 blk) ;Check if XRef
(setq s (strcat s (cdr (assoc 1 blk)) "\n"))
)
(setq blk (tblnext "BLOCK"))
)

(alert s)
(princ)
)

rkmcswain
2008-03-30, 10:48 PM
What is the purpose of the proposed check box or radio button?

Chilli
2008-03-31, 04:31 PM
I would like the check box or radio button beside each xref so i can select a specific xref from the list and maybe add some features like freeze layers, change color, or be able to get detailed information about that specific xref.

Do you know how to add a check box or radio button beside each listed xref?


Thanks

Adesu
2008-04-01, 12:57 AM
Hi i2mikee
Test this code maybe can help you


(defun table (s / d r) ; Michael Puckett
(while
(setq d (tblnext s (null d)))
(setq r (cons (cdr (assoc 2 d)) r))
)
)

(defun c:test (/ blk s)
(setq s "List of Xrefs\n---------------------------\n")
(setq lst (table "block"))
(setq dcl_id (load_dialog "Blk.DCL"))
(if
(not (new_dialog "blk" dcl_id))
(exit)
) ; if
(start_list "pl") ; start the list box
(mapcar 'add_list lst) ; fill the list box
(end_list)
(mode_tile "pl" 4)
(action_tile "pl" "(setq data_pl (get_tile \"pl\"))")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq ans (start_dialog))
(if
(= ans 0)
(progn
(alert (strcat "\nAre you want try again"
"\nplease type test...and hit enter"))
(unload_dialog dcl_id)
(exit)
) ; progn
(Progn
(setq xdata (nth (atoi data_pl) lst))
(alert (strcat "\nYou choose block is " xdata))
;(*****PUT HERE YOUR NEXT PROGRAM *****)
) ; progn
) ; if
(princ)
) ; defun


Here DCL file, and save as "Blk.DCL"


blk : dialog {label= "BLOCK SELECT MANAGER";
: column {label = "Select a block";
: list_box {key = "pl";}}
spacer;
ok_only;}





I would like the check box or radio button beside each xref so i can select a specific xref from the list and maybe add some features like freeze layers, change color, or be able to get detailed information about that specific xref.

Do you know how to add a check box or radio button beside each listed xref?


Thanks

Chilli
2008-04-01, 03:14 PM
Hi Adesu,

I will give this code a shot and try to make it work for what i need.

Thanks

Chilli
2008-04-01, 09:16 PM
Hi Adesu,

i like how i can select the listed blocks, its better than having a check box or radio button; the only thing is that the code lists all the blocks in the drawing, and i was wondering if i can have it list only mother xrefs or just xrefs.

mother xrefs: are the actual xrefs that are xrefed into a drawing.

Example: If i have drawing Z, and i have xref X and xref Y xrefed into drawing Z.
If xref X has two nested xrefs in it A and B.
The result in the list box will show only xref X and xref Y.

Thanks again

Adesu
2008-04-03, 07:44 AM
You are welcome.......:)


Hi Adesu,

I will give this code a shot and try to make it work for what i need.

Thanks