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

  • How to Default to Fixed Component Tag IDs - AutoCAD Electrical
    December 30, 2007 06:34 PMby Nate Holt

    A  "fixed" electrical component tag means that AutoCAD Electrical will not updating / re-tagging the device's tag-ID assignment. If you insert a solenoid symbol and manually assign it a tag pulled, let's say, from a P&ID drawing, it is open to an accidental re-tag update unless you specifically mark it as a "fixed" tag-ID.

    When you instruct AutoCAD Electrical to flip a component tag from normal to "fixed" mode, all it does is change the component block insert's attribute tag name from "TAG1" to "TAG1F". This is done "on-the-fly" without disturbing the block insert.
    How can I avoid forgetting to flip to "fixed"?
    Now, if/when AutoCAD Electrical wants to do a re-tag, either because the component is moved or scooted to a different reference location on the drawing or the "Re-tag" command is invoked, any components marked with the extra "F" suffix on the TAG1 attribute are left alone... their existing tag-ID is "fixed".
    Could the Insert/Edit dialog automatically pop up with the "Fixed" toggle turned on? Unfortunately, "No". But then Gerald came up with an alternate approach that is probably even better... open key library symbols and just change the TAG1 attribute definition from TAG1 to TAG1F. Save and Exit. Simple!
    Example: the parent solenoid symbol "HSV1.dwg"
    Just browse to the active symbol library and open up the solenoid symbol and open in AutoCAD. Change the existing TAG1 attribute definition to TAG1F as shown here. Save and exit.

     

    In operation

    Now, when this symbol is inserted into a new or purged drawing, the Insert/Edit dialog automatically comes up with the "Fixed" toggle turned on.

     

     

     

     

     

     

     

     Simple, elegant solution. Good job, Gerald (he's in the blue shirt, pictured here at last month's Autodesk University)!

     

    5 Comments | Add CommentIn Controlling the Machine >

Previous Post

  • Quick Switch Color Scheme - AutoCAD Electrical
    December 17, 2007 07:34 PMby Nate Holt

    Maybe you prefer a light background instead of the classic coal-black environment. The problem is that some of the AutoCAD Electrical layer color defaults don't show up too well when you're working with a white background - some of the yellow and light cyan ones just don't stand out very well.

    Here's a quick work-around. An AutoLISP utility that you can set up to re-assign default layer colors to a handful of the more troublesome layer colors. Download it here: files/20401_20500/20415/file_20415.lsp

     Setup

    Open this AutoLISP file with a standard ASCII text editor or with the built-in Visual Lisp editor (type vlide [Enter] at the "Command:" prompt).  Near the top of the file you'll see this block of code:

      (setq layer_mapping
        (list  ; format is (list layernam newcolor)
          (list "WIRENO" 72) ; light green (70) --> shade darker
          (list "WIREFIXED" 7) ; light blue (130) --> black/white
          (list "WIREREF" 52) ; light green (61) --> darker olive green
          (list "WIREREF_DEST" 52) ; light green (61) --> darker olive green
          (list "MISC" 7) ; yellow --> black/white
          (list "PMISC" 7) ; yellow --> black/white
          (list "PTAG" 150) ; light yellow (51) --> medium blue
          (list "TAGS" 150) ; light yellow (51) --> medium blue
          (list "TERMS" 123) ; cyan --> gray/blue
      ) )

    Adjust this list or add in additional standard AutoCAD Electrical layers that you want to map to a different color. The color number is the last entry in each sublist. For example, the first entry, (list "WIRENO" 72) will instruct this utility to look for layer "WIRENO" in the active drawing and force its default color to be color 72.

    This utility also has provision to add in missing layers. Here is the section of the program that checks for missing WIRENO and WIREFIXED layers. If either is missing from the active drawing, it adds the layer and assigns the encoded color and line type. You might expand this list to add in your custom wire layer names.

      (setq layer_restore
        (list  ; format is (list layername color linetype)
          (list "WIRENO" 72 "Continuous")
          (list "WIREFIXED" 7 "Continuous")
        )
      )

    How it works

    Here is the full listing of the utility (below). The first third or so deals with defining what layers are to be processed. Then it gets down to business. The program cycles through all of the layer names found in the active drawing, the "tblnext" call. For each layer it finds, it checks to see if that layer name shows up in your "layer_mapping" list. If a match is found in your list, the utility compares the existing layer's color number with the one you've defined in the list. If different, the utility triggers the "LAYER" command to run (command line version) and feeds it the layer name and the new color assignment.

    After the existing layers are processed, it does the final check for missing layers. For each layer you've defined in the "layer_restore" list, it checks to see if that layer exists in the active drawing. If not found, it triggers the "LAYER" command again and adds it in ( ! ).

    (defun c:acelayer ( / flag ed x rec laynam layer_mapping layer_restore)
      ; PURPOSE: adjust default layer color assignments for switch to light background.
      ;    For example, change yellow-color layers to a color that displays better on a
      ;    white or light background. Also restore WIRENO and WIREFIXED layers and color
      ;    assignments if these two layers appear to have been purged from the drawing.
      ;
      (setq layer_mapping
        (list  ; format is (list layernam newcolor)
          (list "WIRENO" 72) ; light green (70) --> shade darker
          (list "WIREFIXED" 7) ; light blue (130) --> black/white
          (list "WIREREF" 52) ; light green (61) --> darker olive green
          (list "WIREREF_DEST" 52) ; light green (61) --> darker olive green
          (list "MISC" 7) ; yellow --> black/white
          (list "PMISC" 7) ; yellow --> black/white
          (list "PTAG" 150) ; light yellow (51) --> medium blue
          (list "TAGS" 150) ; light yellow (51) --> medium blue
          (list "TERMS" 123) ; cyan --> gray/blue
      ) )
     
      (setq layer_restore
        (list  ; format is (list layername color linetype)
          (list "WIRENO" 72 "Continuous")
          (list "WIREFIXED" 7 "Continuous")
        )
      )
      (setvar "CMDECHO" 0)
      (setq flag T) ; flag to rewind to beginning of LAYER table
      (while (/= (setq ed (tblnext "LAYER" flag)) nil)
        (setq flag nil) ; clear the rewind flag
        (setq laynam (strcase (cdr (assoc 2 ed)))) ; forced to upper case
        ; Look for layer name match in "layer_mapping"
        (foreach rec layer_mapping
          (if (AND (= (car rec) laynam) ; found match on name
                   (/= (cadr rec) (cdr (assoc 62 ed)))) ; mismatch on color assignment
            (progn ; flip color assignment for this layer
              (command "_.LAYER" "_C")
              (command (itoa (cadr rec)))
              (command (car rec))
              (command "")
              (princ "\nLayer ")
              (princ (car rec))
              (princ " ")
              (princ (cdr (assoc 62 ed)))
              (princ " --> ")
              (princ (cadr rec))      
        ) ) )
      ) 
      ; restore any missing layers              
      (foreach rec layer_restore
        (setq laynam (car rec))
        (if (not (tblsearch "LAYER" laynam))
          (progn ; layer not found, create it now
            (command "_.LAYER" "_N" laynam "_C" (itoa (cadr rec)) laynam "_Ltype" (caddr rec) laynam "")
            (princ "\nRestored layer ")
            (princ laynam)
            (princ " color=")
            (princ (cadr rec))
            (princ " ltype=")
            (princ (caddr rec))
      ) ) )     
      (princ)

     

    Load and Run

    1. Download the file from the link above. 2. APPLOAD the file. 3. type ACELAYER [Enter] at the "Command:" prompt.

     

    0 Comment | Add CommentIn Controlling the Machine >

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