Guest
|
Posted:
Sat Dec 10, 2005 9:10 am Post subject:
Need some help with DXF tables and Xrefs |
|
|
I have been trying to write lisp routine that will toggle certain xrefs
loaded and unloaded each time a toolbar button is clicked.
I initially set up the button with this code:
^C^C^P(setq TOGG "DUCT");XTOGGLE
Which would call my lisp.
(DEFUN C:XTOGGLE (/ TOGG CNT1 TBL1 BNAME BTYPE)
(setq cmd1 (getvar "cmdecho"))
(setvar "cmdecho" 0)
(SETQ CNT1 T)
(SETQ tbl1 (tblnext "block" cnt1))
(SETQ bname (cdr (assoc 2 tbl1)))
(IF (= (LOGAND 32 (CDR (ASSOC 70 TBL1))) 0)
(PROGN
(SETQ BTYPE " LOADED")
(COMMAND "-XREF" "UNLOAD" TOGG)
) ;END PROGN
(PROGN
(SETQ BTYPE " UNLOADED")
(COMMAND "-XREF" "RELOAD" TOGG)
) ;END PROGN
) ;END IF
;(princ BTYPE)
(setvar "cmdecho" cmd1)
) ; END XTOGGLE DEFUN
Now I am pretty new to autolisp, and the DXF tables are something still
way over my head. I pieced this together from other code.
My problem with this code is that I need at least 4 buttons that will
set the variable TOGG different.
When I click on the first one, it toggles the correct xref on and off,
click the next one and it will unload it but won't reload it.
The posible problem I see is that when I read this line:
(SETQ tbl1 (tblnext "block" cnt1))
I keep reading the first xref alphabetically (duct), when in fact I am
trying to toggle a different xref (pipe). Does this sound like the
problem?
If so, how can I check to see if I am reading the correct xref when I
get to my IF statement?
Any help is apreceated. I have been trying to figure this out for
hours.
I didn't even know what DXF tables were when I got up this
morning....:)
Rick
|
|