Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp, insert block

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
3755 Views, 5 Replies

Lisp, insert block

Good Day, I'm fairly experienced in autoCAD but extremely new to lisp so please bare with me on this, and if possible explain some of the answer steps. I'm creating a simple lisp to calculate invert levels at a point, automatically insert a level arrow block with scale and attribute automatically added and loop it so that it repeats the process at any point I click on until I nil the point. Most of that is simple so I won't bother you with it but I'm having problems inserting the block, is there a command to insert the block and include the following variables? Block scale: pt1 Attribute: ptlevel Insertion base point: pt5 Block name: "Level_Arrow" Block found on another drawing deep in the company server files, I may need to add the link as well. Thank you.
5 REPLIES 5
Message 2 of 6
dbroad
in reply to: Anonymous

If the system variable, attdia is set to 0, then an insert command including attribute entry is just:

 

(command "_.-insert" "yourblocknameincludingpath" <insertionpoint> <xscale> <yscale> <rotation angle> <attribute 1>...<attribute n>)

 

Of course whether 2 scale factors are required depends on the block's setting for uniform scale.

 

Paths are best entered with slashes instead of backslashes since the backslash is an escape character in lisp.

Architect, Registered NC, VA, SC, & GA.
Message 3 of 6
scot-65
in reply to: Anonymous

As dbroad pointed out - the insert command with attdia turned off will keep prompting until all attributes are presented.

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


Message 4 of 6
Anonymous
in reply to: Anonymous

Ah thank you, very useful. As an extension to this same question, I now have it adding the level except it gives the number 101.7250000000000 as the response, is it possible to limit it to three decimals? Also it appears to be using the drawing scale (pt1) as the rotation, inserting everything at 100 degrees to flat in this instance, could you please have a look at my command line and see why that would be? pt6 is the insertion point, pt1 the scale and ptdisp the attribute. ...(command "_.-insert" "Level Arrow" pt6 pt1 pt1 0 ptdisp)
Message 5 of 6
Anonymous
in reply to: Anonymous

Update: rotation issue resolved, Although as another issue I would like to add to the macro setting attdia to 0. Am I on the right track with (command "_.-attdia" 0) as this does not seem to work.
Message 6 of 6
hmsilva
in reply to: Anonymous

Perhaps something like this

(setq old_attdia (getvar 'ATTDIA));; stores the actual ATTDIA
(setvar 'ATTDIA 0);; sets ATTDIA to zero
("Your INSERT command")
(setvar 'ATTDIA old_attdia);; restore the original ATTDIA

HTH
Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost