Need some help with DXF tables and Xrefs
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Need some help with DXF tables and Xrefs

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Guest






Posted: Sat Dec 10, 2005 9:10 am    Post subject: Need some help with DXF tables and Xrefs Reply with quote

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

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB