AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wire reference lisp (ladder command)

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1302 Views, 3 Replies

wire reference lisp (ladder command)

Hello All,

I am trying to write a LISP routine that inserts wire reference #'s in a drawing. kinda like the ladder command. I have it set up so far to insert the number but I cannot get it to list the sequencial numbers below it.

 

I cannot figure out what command the ladder command is referencing. If I can figure out what that command is doing I might be able to see how to do it.

 

Anyone know what command it is referencing?...and where that it might be stored??

 

attached is the ref drawing and LISP so far in case anyone wants a laugh!!!!

 

Thanks

agian

 

Dennis

3 REPLIES 3
Message 2 of 4
PatMurnen_Adsk
in reply to: Anonymous

Dennis,

 

Maybe you can get what you want with the API, (c:wd_in_ladder Lc_ph pt1 pt2 rungl isvert rungw rungv Lc_3sp rungi gridxy_mode Lc_dr def_1st options), using the information the user enters in response to your prompts. This API has options to suppress drawing all the rungs and the side rails. You can read about the API parameters in the API Help found on the Help drop-down menu.

 

If that API doesn't give you what you need, if you supply a little more information I can probably help out.

 

Regards,

Pat



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 3 of 4
Anonymous
in reply to: PatMurnen_Adsk

Thanks Pat,

 

Lets start with this question

 

When I put in the ladder what routine/program is being involked?

 

If I can see what that is doing it would go a long way to figuring it out.

 

Thanks again

 

Dennis

Message 4 of 4
PatMurnen_Adsk
in reply to: Anonymous

Dennis,

 

you can't really "see" what AcadE is doing since the code is compiled. You can't actually look at the source code. I can tell you the basics of what is happening. After the first block is inserted, AcadE basically makes a copy of the first reference number attribute but as a text entity. Then just copies it to add the rest of the reference numbers, incrementing the text value. Some lisp commands that would be useful here are:

 

getstring - pause for user input of a string value

getint - pause for user input of an integer value

1+ increment by 1 an integer

itoa - convert an integer to a string value

entget - get an association list containing the entity definition of an entity (can be used to find out all kinds of things about an entity or to make new ones similar)

entmake - create a new entity using an association list of an entity

entlast - return entity name of the last inserted entity (doesn't return sub-entities that are part of a block

entnext - get the next entity inserted after a particular entity. Can be used to get sub-entities that are part of a block

 

To get the association list of the first reference number you would need to find that attribute on the block. Using entlast and entnext looking for a particular attribute name using entget.

 

To make the new text entity you could use entmake. To copy it you could use entmake or use the lisp call "command" which lets you use any AutoCAD command within a lisp function. So you could use the AutoCAD copy command that way.

 

Sorry I can't show you any source code but there are likely examples in the Help topics for these lisp commands I've mentioned or links to examples.

 

By the way, in your sample you were using getdist but you want to use the appropriate "get" function depending on the type of value the user will enter, i.e. an integer, string, etc.

 

Regards,

Pat

 



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report

”Boost