Flipping to In-line wire number tags - AutoCAD Electrical

  • Coinciding with the acquisition of VIA Development, Nate joined Autodesk in March of 2003 after a decade stint as an entrepreneur following a two-decade stint as a controls engineer and software applications developer at Owens-Corning. Nate is now the lead product architect for AutoCAD Electrical. He loves this stuff.

    About Nate

Latest Post

  • Flipping to In-line wire number tags - AutoCAD Electrical
    May 8, 2007, 08:16 PM Nate Holt

    This question came up in the last couple days... the design is done but the customer decides that he wants all wire number tags to be shown as embedded "in-line" with the wiring. Gee, wish he'd said something about this earlier. AutoCAD Electrical can be set up to position wire number tags above, below, or embedded in-line. But once they're there, the only tool available to flip them is a selective toggle-to-inline, one pick at a time. Tolerable, but not a real happy prospect.

    B E F O R E
    garrett01.png

    A F T E R
    garrett02.png

    AutoCAD Electrical's API steps in to meet the need

    So, what to do? No problem. There's an exposed call in AutoCAD Electrical's API (documentation here: Select "Help" --> "Electrical Help Topics" --> "API Help"). The function is (c:ace_toggle_inline...) and it is set up to toggle a passed wire number entity name to be positioned "in-line".

    Let's write a short program and put a drawing-wide selection set "wrapper" around this function. Then we can turn this "single pick / toggle" API call into a drawing-wide "do 'em all now" function.

    Here's the program. You can see the above mentioned API call embedded in the middle of it. Around it is a call to "ssget" to create a drawing wide (the "_X" part) selection set. This selection set is of all block INSERT instances that have a block name matching the names used by AutoCAD Electrical (the "WD_WNH..." part).

    garrett04.png

    After the selection set "ss" is created, the program enters a "while" loop and processes each wire number block insert, one at a time. It passes each wire number's block insert entity name to the API call. This call then toggles the above or below wire number to be "in-line". That's it! Pretty simple.

    You can type this program in to the Visual Lisp editor or using any text editor and name the file wnum_2_inline.lsp. Then APPLOAD it and type wnum_2_inline [Enter] at the command line.

    Or, you can download the file here.


    2 Comments | Add Comment Controlling the Machine > All

Comments

  • December 25, 2007 11:50 PM sravanthi adusumilli

    is it possible to retrieve component information from a circuit in autocad electrical api?

  • March 24, 2008 02:50 PM Nate Holt

    Not sure what you mean... an AutoCAD Electrical circuit pops in "exploded" so that the individual components and wires of the circuit are visible and selectable... as if the circuit had been built up using individual components and wires. Maybe you mean this... insert a circuit with an API call and then you want to go back in and push some data on to the individual components that came in with this circuit? If so, that is easy to do if your application first remembers the "last entity" in the drawing, pops in the circuit, and then cycle through the entities from that saved point onward to end of database.



You must be logged in to post a comment.

Subscribe to Blog

Want to keep up with the latest? Subscribe to the RSS feed today.

RSS

Login

Register now to access tips, discussions and more.
Forgot your password ?

Tags

is, it, possible, to, retrieve, component, information, from, a, circuit, in, AutoCAD, electrical, API, terminals

You must be logged in to add a tag.

Send to a Peer

You must login to share pages.

Feedback

Tell us what you think of the site.

Send Feedback