Controlling the Machine

  • 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

Previous Post

  • Auto wire number tag removal on cabled wire networks - AutoCAD Electrical
    June 14, 2007 04:01 AMby Nate Holt

    When AutoCAD Electrical sees a wire network, it wants to put a unique wire number tag on it. This is great in most instances. But if the network is basically a cable conductor/core tied between two connection points, then the wire number may be redundant. The cable tag-ID and core color code may be all that is needed. The wire number assignment just gets in the way.

    Example

    The three-phase motor control circuit shows a four conductor/core cable tied between the TB terminals and the PJ207 connector. Each core is marked with a unique color code assignment. But AutoCAD Electrical wants to pop in wire numbers as well.

    wnum01.png

    So, this question came up recently... How to suppress these wire numbers on networks that include a cable marker symbol?

    There are a couple manual options:

    Option A: Let the wire number go in but then flip it to "hidden" by using the "Hide Wire Number" command on the "Edit Wire Number" toolbar flyout. This moves the picked wire numbers to a layer that is marked as "Frozen" so it will not be visible (but will still be there on the wire and will satisfy AutoCAD Electricals burning desire to maintain wire numbers on all wire networks).

    Option B: Similar to above but use the "Hide Attribute" command (under the "Edit Attributes" toolbar flyout) and flip the wire number visible attribute to invisible.

    Option C: Use the "Erase Wire Number" command and manually remove them from the selected networks. As long as you don't re-run the Automatic Wire Numbering command, all is well.

    Option D: Create a small AutoLISP utility that you can run against your project drawing set to do any of the above options automatically in a "batch" mode.

    Options A,B, and C look tedious, but option D looks like it would be fun. Let's do D and set it up to automatically erase existing wire numbers for wire networks that include a cable marker symbol.


    Option D: AutoLISP Utility - Making use of the "API"

    Here it is. A utility that is quite small due to calls into the AutoCAD Electrical API. This greatly simplifies creating this tool. Download a copy here.


    wnum02.png

    How it works

    The approach used here is to first extract a selection set of all "cable marker" block inserts. This is done by using a wild-card match on the cable marker block names. Then it goes into a "while" loop and process each block marker, one at a time. For each one, the block marker is processed to find connected LINE wires. Then, for each wire connection, it search for and erases any wire number tied to it.

    That's it. A handful of calls into the AutoCAD Electrical "API" makes it pretty simple.

    To run (single drawing)...

    1. APPLOAD the above utility
    2. For single drawing, type cbl_no_wnum [Enter] at the AutoCAD command prompt.

    To run in batch mode...

    One way is to use AutoCAD Electrical's "Project-wide Utilities" command. Make sure you save the utility to a folder that is somewhere in the ACAD path. Then enter the following into the edit box as shown below:

    (load "cbl_no_wnum.lsp")(c:cbl_no_wnum)

    Select OK, select the project drawing to process, and that's it.

    wnum03.png

    Results!

    wnum04.png




    0 Comment | Add CommentIn Controlling the Machine > All

  • Melting Glaciers and not enough hours in the day (part 2)
    June 13, 2007 08:00 PMby Nate Holt

    Some time ago I suggested that this problem might self-correct if we were patient. Melting glaciers at the poles would raise the ocean level world-wide. Since total angular momentum can neither be created nor destroyed, the earth's rotation would have to "slow down" due to the redistribution of mass away from the poles. Here's the original blog link: theory.

    Well, now they say that warming water becomes less dense and alters the distribution of water between the equator and polar regions. They say this will speed up the earth's rotation: http://www.sciam.com/article.cfm?articleID=E4337790-E7F2-99DF-3D1E8E32CEBF832A&chanID=sa003

    So, I guess this cancels my theory out. Since we can't look forward to being able to work longer, I guess we'll have to work smarter.

    0 Comment | Add CommentIn Controlling the Machine > All

  • Flipping attribute justification on a mass scale - AutoCAD Electrical
    June 13, 2007 12:41 AMby Nate Holt

    This blog has included a lot of custom applications and utilities over the last year that make use of the AutoCAD Electrical "API". And it's nice when some readers come through with some of their own creations. Here's one from Gerald te Wierik of Aceri Nederland. He has legacy AutoCAD Electrical projects that need to have a certain attribute on a certain block insert flipped from left to right justification. These things can be scattered everywhere in the project drawing set.

    gerald01.png

    Now, he could carefully go through the drawings and locate each instance and make the adjustment. But why spend a lot of time doing this when it's a heck of a lot more fun to create a little utility and do it automatically in a batch mode?

    So, here's a sample of the challenge... a group of these arrow symbols need to have the visible attribute flipped to RJT. The block symbol name is HA1S1. Let's do it.

    AutoLISP Utility

    gerald03.png

    Here's the little AutoLisp utility that Gerald put together. It makes about three calls into the AutoCAD Electrical API. This is not absolutely necessary but it simplifies development. The rest of the program is straight AutoLISP.

    Here's how it works...

    1. First part builds a "selection set" of all instances of the target block insert "HA1S1".
    2. Next the utility enters a "while" loop and process all instances of the HA1S1 blocks found on the active drawing.
    3. A call is made to confirm that the block insert has the target attribute, WIRENO that needs to be flipped to RJT. If the attribute is present then another call is made to return specific information about this attribute. The key piece of information in this returned data list is the entity name of this attribute.
    4. Now a call to (c:ace_chgjst...) is made, passing the entity name of the WIRENO attribute (held in "(caddr rtrn)") above. This function flips the attribute to RJT (because the function's last argument is an "R" which flags "RJT").
    5. Then the program increments a counter and loops back to process the next one until all are finished.

    To run (single drawing)...

    1. APPLOAD the above utility (you can download a copy here).
    2. For single drawing, type WireNoRight [Enter] at the AutoCAD command prompt.

    To run in batch mode...

    One way is to use AutoCAD Electrical's "Project-wide Utilities" command. Make sure you save the utility to a folder that is somewhere in the ACAD path. Then enter the following into the edit box as shown below:

    (load "WireNoRight.lsp")(c:WireNoRight)

    Select OK, select the project drawing to process, and that's it.

    gerald06.png


    Here's an example of the results:

    gerald02.png

    And here's a happy Gerald te Wierik ...!

    gerald.jpg


    0 Comment | Add CommentIn Controlling the Machine > All

  • Customizing the Drawing Index Sheet - AutoCAD Electrical
    June 1, 2007 01:23 PMby Nate Holt

    A customer likes AutoCAD Electrical's ability to auto-generate an index table listing all drawings in a project. But he wants to leave some "gaps" in the listing where appropriate. For example, maybe the 3-phase motor control drawings begin at sheet number 10, end at 16, and he skips to sheet 20 to begin the PLC I/O drawings. He'd like to leave empty spots in the generated index for the "future" sheets 17 through 19.

    This is where a report "User post" can fill in the gap (or create a gap in this case).

    Before:

    Here's the default out-of-the-box sequence for generating a drawing list report (using the demo project that comes with AutoCAD Electrical - but with the last drawing's SHEET number bumped up to create a gap in the listing):

    1. Right click on the project name in the AutoCAD Electrical Project Manager window...

    dwglst01.png

    2. Run the report and let it display...

    dwglst02.png

    3. ... and select the "Put on Drawing" button. And here we are. It's cool but note that there is no gap in the table between sheet 8 and sheet 12. We'd really like to see a gap in the listing.

    dwglst03.png

    Solution: create a modified "User Post" utility - After:


    The solution is to modify the Drawing List Report's "User Post" utility to automatically force gaps in the report corresponding to gaps in the SHEET number assignments.

    1. Download sample User Post utility dwglst.lsp here and supporting dialog dcl file dwglst.dcl here. Put both into your "c:\program files\autodesk\acade 200x\support\" folder (make backups first!).

    ... with these two modified files in place, the new sequence is this:

    2. Run report and display as before.

    3. When report display, select the "User Post" button on the right-hand lower part of the display dialog. The modified "user post" dialog pops up. Select the first option and enter in optional "ending" sheet number in the edit box. Hit OK.

    dwglst04.png

    4. Now select "Put on Drawing" button. Here it is, with gaps !

    dwglst05.png


    How it Works

    Nearly all of AutoCAD Electrical reports have a "user post" option. This lets you post-process the report data to meet custom needs while the data is still displayed in the AutoCAD Electrical report dialog. When you hit the "user post" button, AutoCAD Electrical looks for an AutoLISP file with a name matching the report type. In this case (above), it is dwglst.lsp. If found, it passes a copy of the report data to this Lisp routine. Here is where you can then massage the data, reformat it, or whatever, and then ship it back to the report display.

    So, in our example above, we modify the dwglst.lsp file and its supporting dialog support file dwglst.dcl to give us the "gap" option we want.


    0 Comment | Add CommentIn Controlling the Machine > All

Subscribe to Blog

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

RSS

Categories

All

Blog Roll

AUTODESK MANUFACTURING COMMUNITY

Ellipsis
The official Autodesk Manufacturing Tech Evangelist blog
Under The Hood
Brian Schanen on Vault, Productstream, and more
In the Machine
Garin Gardiner hosts the official blog of the Inventor Product Team
Controlling the Machine
Archive of Nate Holt's AutoCAD Electrical posts

RECOMMENDED

Being Inventive
The official support blog for the Autodesk Inventor product line
Between the Lines
Shaan Hurley's AutoCAD Blog
It's Alive in the Lab
Scott Shepherd's Lab's Blog
Beyond the Paper
Volker Joseph's DWF Blog
Lynn Allen's Blog
Staying current with AutoCAD and Autodesk

PEER

AutoCAD Electrical Etcetera
Nate Holt shares AutoCAD Electrical tips and tricks.
Autodesk Manufacturing Northern European
The official blog for the Autodesk Northern Europe Manufacturing Technical Team.
Sean Dotson's Site
Sean Dotson's mCAD Tutorials, Forums, Admins & more
The Autodesk Informer
Helpful sites, tutorials, and industry news
CAD Professor
Inventor, Inventor LT, and AutoCAD news and updates.

Send to a Peer

You must login to share pages.

Feedback

Tell us what you think of the site.

Send Feedback