Jump to content

Using variables in setting XData DXF Code in AutoLISP


Recommended Posts

Posted (edited)

I'm adding XData to user drawn lines utilizing AutoLISP. The following code works fine:

 


(setq CLoop "CIRC1")
 (if (not (tblsearch "APPID" CLoop))
   (regapp CLoop)
 );end if
(setq xdList '((-3 ("CIRC1" (1000 . "Circuit 1") (1000 . "Reactor Effluent")))))

 

I'm having trouble substituting variables for "CIRC1", "Circuit 1" and "Reactor Effluent"... I've tried:


(setq LNo "Circuit 1"
       desc "Reactor Effluent"
 )
(setq xdList '((-3 ("CIRC1" (cons 1000 LNo) (cons 1000 desc)))))

I would also like to replace "CIRC1" with a variable as well.

 

This gives me a bad DXF Group Code error. I've tried various combinations of List and Cons and Quote but can't seem to get it!

 

Please help - thanks!

Edited by SLW210
add code tags
Posted

By usign quote you are preventing the list to be evaluated; please try this instead:

(setq xdList ([color=red]list[/color] ([color=red]list[/color] -3 ([color=red]list[/color] "CIRC1" (cons 1000 LNo) (cons 1000 desc)))))

Posted

I was lost in "lists"...

 

That solved my problem - thank you!

Posted

I apologize and will follow the code posting guidelines in the future - thank you.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...