<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>AutoCAD Electrical Etcetera</title>
	<atom:link href="http://nateholt.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nateholt.wordpress.com</link>
	<description>Nate Holt&#039;s blog on all things AutoCAD Electrical</description>
	<lastBuildDate>Fri, 11 Dec 2009 14:12:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='nateholt.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a138105e55a0e3e86a4dd025f28f2790?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>AutoCAD Electrical Etcetera</title>
		<link>http://nateholt.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nateholt.wordpress.com/osd.xml" title="AutoCAD Electrical Etcetera" />
		<item>
		<title>Overview of Simple BOM reporting &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/11/19/overview-of-simple-bom-reporting-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/11/19/overview-of-simple-bom-reporting-autocad-electrical/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 05:20:59 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=710</guid>
		<description><![CDATA[Brief overview of how two different databases are queried to create various AutoCAD Electrical BOM reports.
This question comes up from time to time, most recently today. Here is a brief summary in the form of screenshots illustrating how a component on an AutoCAD Electrical drawing (a mechanical footprint symbol on a panel layout drawing) finds its way [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=710&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Brief overview of how two different databases are queried to create various AutoCAD Electrical BOM reports.</strong></p>
<p>This question comes up from time to time, most recently today. Here is a brief summary in the form of screenshots illustrating how a component on an AutoCAD Electrical drawing (a mechanical footprint symbol on a panel layout drawing) finds its way on to a BOM report. This illustrates just a simple, straightforward catalog assignment &#8211; without &#8220;ASSYCODE&#8221; and without &#8220;Multi-BOM&#8221; catalog assignments (future posting!).</p>
<p>A small portion of one drawing, DEMO08.dwg, which is part of a sample AutoCAD Electrical project drawing set “WDDEMO”, is shown below.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/bom_01.png"><img class="alignnone size-full wp-image-711" title="bom_01" src="http://nateholt.files.wordpress.com/2009/11/bom_01.png?w=949&#038;h=652" alt="" width="949" height="652" /></a></p>
<p>AutoCAD Electrical maintains a “scratch” database file, in Microsoft Access format, that follows what is going on in the project drawing set (it does not drive it, it follows it). The above mechanical footprint component, SS433 on drawing DEMO08.dwg of the project, shows up in the “PNLCOMP” table of the scratch database file for this project.</p>
<p> The scratch database file name is the same name as the active AutoCAD Electrical project name but with an “.mdb” extension. It is saved in the local AutoCAD Electrical “user” folder. The full name can be displayed by typing this at the AutoCAD “Command:” prompt.</p>
<p> Command:  <strong>(c:wd_mdb_get_proj_scratch_dbnam nil)</strong> <em>[Enter]</em></p>
<p><em> </em>Here is a screenshot of the above panel component in the PNLCOMP table of the project scratch database:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/bom_02.png"><img class="alignnone size-full wp-image-712" title="bom_02" src="http://nateholt.files.wordpress.com/2009/11/bom_02.png?w=1024&#038;h=475" alt="" width="1024" height="475" /></a></p>
<p>And here&#8217;s another screenshot of the above record with a few other fields exposed. These fields are used to guide AutoCAD Electrical&#8217;s BOM reporting command to the appropriate &#8220;table&#8221; in the catalog lookup database file DEFAULT_CAT.mdb (shown shortly).</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/bom_03.png"><img class="alignnone size-full wp-image-713" title="bom_03" src="http://nateholt.files.wordpress.com/2009/11/bom_03.png?w=1024&#038;h=430" alt="" width="1024" height="430" /></a></p>
<p>The actual table name that the BOM report queries for this &#8220;SS433&#8243; symbol&#8217;s catalog description information is influenced by the WDBLKNAM value shown above. See <a href="http://mfgcommunity.autodesk.com/blogs/blog/view/7/Catalog_Lookup_table_name/">this posting </a>for a description of how auto-table selection works.</p>
<p>Ultimately, the BOM reporting goes to table &#8220;SS&#8221; in the DEFAULT_CAT.mdb file. It uses the MFG/CAT attribute values carried on the panel footprint symbol (and extracted into the PNLCOMP table shown above) to find the appropriate record in the &#8220;SS&#8221; table shown here:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/bom_04.png"><img class="alignnone size-full wp-image-714" title="bom_04" src="http://nateholt.files.wordpress.com/2009/11/bom_04.png?w=1024&#038;h=399" alt="" width="1024" height="399" /></a></p>
<p>And now the BOM reporting command merges the data in the record above with the data from the scratch database file. It is formatted into the report and shows up as an entry here in the BOM Report Generator dialog ( ! ):</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/bom_05.png"><img class="alignnone size-full wp-image-715" title="bom_05" src="http://nateholt.files.wordpress.com/2009/11/bom_05.png?w=831&#038;h=474" alt="" width="831" height="474" /></a></p>
<p>Now, at this point, you can write the report out to a file (in various formats) or insert the report as a &#8220;smart&#8221; table on to your AutoCAD drawing.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/710/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/710/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/710/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/710/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/710/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/710/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/710/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/710/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/710/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/710/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=710&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/11/19/overview-of-simple-bom-reporting-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/bom_01.png" medium="image">
			<media:title type="html">bom_01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/bom_02.png" medium="image">
			<media:title type="html">bom_02</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/bom_03.png" medium="image">
			<media:title type="html">bom_03</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/bom_04.png" medium="image">
			<media:title type="html">bom_04</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/bom_05.png" medium="image">
			<media:title type="html">bom_05</media:title>
		</media:content>
	</item>
		<item>
		<title>Feedback &#8211; Shaping the future of AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/11/18/feedback-shaping-the-future-of-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/11/18/feedback-shaping-the-future-of-autocad-electrical/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 12:58:47 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=707</guid>
		<description><![CDATA[The Autodesk development team responsible for AutoCAD Electrical wants your feedback. Here&#8217;s a note from Autodesk&#8217;s Jose Santos:
Are you interested in shaping the future of AutoCAD Electrical?
 The AutoCAD Electrical team is offering two great opportunities if you work with schematics for controls, switchgear, power, process, and instrumentation, and are attending Autodesk University 2009 in Las [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=707&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The Autodesk development team responsible for AutoCAD Electrical wants your feedback. Here&#8217;s a note from Autodesk&#8217;s Jose Santos:</p>
<p><em>Are you interested in shaping the future of AutoCAD Electrical?</em></p>
<p><em> The AutoCAD Electrical team is offering two great opportunities if you work with schematics for controls, switchgear, power, process, and instrumentation, and are attending Autodesk University 2009 in Las Vegas:</em></p>
<p><em> <strong><span style="color:#ff0000;">Product Usability Evaluation</span></strong></em></p>
<p><em>Various sessions. Nov 30 – Dec 3, 2009</em></p>
<p><em>Register </em><a href="http://www.surveymonkey.com/s.aspx?sm=4jMEdrzJnMUkvfrD2uzwoQ_3d_3d"><em>here</em></a><em>.</em></p>
<p><span style="color:#ff0000;"><strong><em> Power, Controls, and Instrumentation Unplugged</em></strong></span></p>
<p><em>November 30, 2009.  2-4pm</em></p>
<p><em>Register </em><a href="http://www.surveymonkey.com/s.aspx?sm=W4eAQvGA4Cn2BofxdGnsXg_3d_3d"><em>here</em></a><em>.</em></p>
<p><em> If you can’t attend but are interested in keeping in touch with the AutoCAD Electrical team for future events, register </em><a href="http://www.surveymonkey.com/s.aspx?sm=b9KVmSudYud6zb60eX8aYA_3d_3d"><em>here</em></a><em>.</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/707/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/707/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/707/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/707/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/707/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/707/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/707/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/707/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/707/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/707/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=707&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/11/18/feedback-shaping-the-future-of-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>
	</item>
		<item>
		<title>Enhanced wire number tags based on connected components &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/11/12/enhanced-wire-number-tags-based-on-connected-components-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/11/12/enhanced-wire-number-tags-based-on-connected-components-autocad-electrical/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 00:45:58 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=692</guid>
		<description><![CDATA[Wire number tags based upon connected component tag-ID at each end.
Some time ago we had this posting that dealt with a wire numbering tool utility. It would generate a wire number tag based upon combining the tag-ID and termination pin number of the component connection at each end of the wire. This generated explicit but really [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=692&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Wire number tags based upon connected component tag-ID at each end.</strong></p>
<p>Some time ago we had <a href="http://nateholt.wordpress.com/2009/07/10/hello-world/">this posting </a>that dealt with a wire numbering tool utility. It would generate a wire number tag based upon combining the tag-ID and termination pin number of the component connection at each end of the wire. This generated explicit but really &#8220;long&#8221; wire numbers.</p>
<p>Here&#8217;s an example:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wirenox_01.png"><img class="alignnone size-full wp-image-693" title="wirenox_01" src="http://nateholt.files.wordpress.com/2009/11/wirenox_01.png?w=756&#038;h=405" alt="wirenox_01" width="756" height="405" /></a></p>
<p>Yes, really long wire numbers ( ! )</p>
<p><strong>Request for a Simplified Version</strong></p>
<p>A user in Australia wanted to do this but make the tags shorter. He just wanted to concatenate the two tag-IDs and then add an alpha suffix to keep each wire number unique. No connection pin numbers embedded in the wire number.</p>
<p>For example, in the above drawing, the upper right-hand wire number would be the two device tags jammed together, &#8220;SS406TD406&#8243;, and an alpha sufffix, let&#8217;s say &#8220;A&#8221;.</p>
<p>Now there are two more wires that tie the same two devices together: the right-hand wire leaving the two child contacts on the selector switch. Both will be &#8220;SS406TD406&#8243;. So the utility would need to add a &#8220;B&#8221; and a &#8220;C&#8221; to each respectively to keep the wire numbers unique.</p>
<p><strong>Modifying the existing milnum_alldwg.lsp utility</strong></p>
<p>So, let&#8217;s start with the previous post&#8217;s lsp utility, copy it to a new file name, &#8220;milnumx_alldwg.lsp&#8221;. Open it up in AutoCAD&#8217;s Visual Lisp editor (type vlide [enter] at the &#8220;Command:&#8221; prompt) or open in any ASCII text editor (like WordPad.exe) and let&#8217;s have some fun.</p>
<p><strong>Step 1</strong> &#8211; this is the easiest part. We want to bypass the original utility&#8217;s task of adding in the connection pin numbers. Here is the before and after code:</p>
<p>BEFORE:</p>
<pre>                    (if (= flipit 1)
                      (progn ; reverse the order
                        (setq new_wireno comp2_tag)
                        (if (AND pin2 (/= pin2 ""))(setq new_wireno (strcat new_wireno "-" pin2)))
                        (setq new_wireno (strcat new_wireno "/" comp1_tag))
                        (if (AND pin1 (/= pin1 ""))(setq new_wireno (strcat new_wireno "-" pin1)))
                      )
                    ; ELSE
                      (progn ; normal order of wire number format                  
                        (setq new_wireno comp1_tag)
                        (if (AND pin1 (/= pin1 ""))(setq new_wireno (strcat new_wireno "-" pin1)))
                        (setq new_wireno (strcat new_wireno "/" comp2_tag))
                        (if (AND pin2 (/= pin2 ""))(setq new_wireno (strcat new_wireno "-" pin2)))
                    ) )   
                    (c:wd_putwnf en new_wireno) ; put the wire number on wire
AFTER:
                    (if (= flipit 1)
                      (progn ; reverse the order
                        <span style="color:#ff0000;">(setq new_wireno (strcat comp2_tag comp1_tag)) ; just jam two tags together, no delimiter</span>
                      )
                    ; ELSE
                      (progn ; normal order of wire number format                   
                        <span style="color:#ff0000;">(setq new_wireno (strcat comp2_tag comp1_tag)) ; just jam two tags together, no delimiter</span>
                    )  )  
                    (c:wd_putwnf en new_wireno) ; put the wire number on wire</pre>
<p><strong>Step 2</strong> &#8211; the harder part. Okay, we have the base wire number figured out above and pushed into lisp variable &#8220;new_wireno&#8221;. But we need to check each wire number and make sure it is unique. We add an incrementing alpha suffix to the wire number until it is unique.</p>
<p>This means that we need to first extract a list of all existing wire numbers on the active drawing (could do for all dwgs in project but that will be an upcoming blog posting). Then, when we generate a new wire number, we compare against the existing wire number list and, if a repeat found, keep incrementing the suffix for our new wire number until we find one that isn&#8217;t already in the list.</p>
<p>So, here&#8217;s a little subroutine we&#8217;ll add to our milnumx_alldwg.lsp utility. It runs at the front end of our utility to establish a list of all existing wire number assignments.</p>
<p>Here&#8217;s how it works&#8230; it creates a &#8220;selection set&#8221; of all wire number block inserts found on the active drawing. AutoCAD Electrical wire numbers have block names that begin with either &#8220;WD_WNH&#8221; or WD_WNV&#8221;. So the &#8220;ssget&#8221; line below gets all instances of wire number block inserts on the active drawing.</p>
<p>Then we cycle through this list, one at a time, and get each wire number block insert instance, the &#8220;(setq en (ssname sswn ixwn))&#8221; line below. Then we get the wire number attribute value, WIRENO or WIRENOF. Add to the running list of wire numbers, loop back to the top of the loop, and process the next wire number block insert instance. When done, all of the drawing&#8217;s wire numbers are sitting in AutoLISP variable &#8220;lst&#8221;. This data is returned from this function.</p>
<p>ALL NEW:</p>
<pre><span style="color:#ff0000;">  (defun milnumx_get_all_existing_wirenums ( / sswn ixwn slenwn lst )
    ; Extract a list of all wire numbers found on the active drawing. Create a selection
    ; set of all block insert instances that have block name "WD_WNH*" or "WD_WNV*". There
    ; are AutoCAD Electrical wire number block names.
    (setq lst nil)
    (setq sswn (ssget "_X" '((-4 . "&lt;AND")(0 . "INSERT")(2 . "WD_WNH*,WD_WNV*")(-4 . "AND&gt;"))))
    (if (/= sswn nil)
      (progn ; some wire number block instances found. Process them.
        (setq slenwn (sslength sswn)) ; number of block instances found
        (setq ixwn 0) ; this will be used to index through the blocks
        (while (&lt; ixwn slenwn)
          (setq en (ssname sswn ixwn)) ; get next block instance entity name
          ; Get WIRENO* attribute value off of this wire number block insert
          (setq wn (c:wd_getattrval en "WIRENO*"))
          (if (AND wn (/= wn "") (not (member wn lst)))
            (progn ; add to the running list
              (setq lst (cons wn lst))
          ) )
          (setq ixwn (1+ ixwn))
    ) ) )
    (setq sswn nil) ; release the selection set
    lst ; return the list of existing wire numbers found on active drawing
  )</span></pre>
<p><strong>Step 3</strong> &#8211; Putting it all together. Now we add a call to our wire number collection function to capture a list of all wire numbers and dump into AutoLISP variable name &#8220;existing_wnum_list&#8221;. We do this toward the beginning of the utility as shown here:</p>
<pre>  ; -- main routine starts here --                  

  ; Two options here. Uncomment first two lines and uncomment third line to prompt
  ; user to "window" what wires to process. Or, comment out the first two lines and
  ; uncomment the third line to process all wires on active drawing without any
  ; user prompts.

;;;  (princ "\nSelect wire or wires to process for special source/dest wire number format")
;;;  (setq ss (ssget '((0 . "LINE")))) ; user windows what to process
  (setq ss (ssget "_X" '((0 . "LINE")))) ; automatically process all wires on active dwg

  (if (/= ss nil)
    (progn

<span style="color:#ff0000;">      ; Get list of all existing wire numbers
      (setq existing_wnum_list (milnumx_get_all_existing_wirenums)) ; ** 12-Nov-09 NEHolt
</span>         
      (setq slen (sslength ss)) ; number of LINE entities selected
      (setq lines_processed_entlist nil) ; used to track what has been processed
      (setq ix 0) ; used to index through the selection set
      (while (&lt; ix slen)</pre>
<p>&#8230; and we go back to what we did in Step 1. We add a &#8220;foreach&#8221; loop just below the point where we have generated the raw &#8220;component1-component2&#8243; tag. We want to find the next suffix character that keeps this proposed wire number unique.</p>
<pre>                    (if (= flipit 1)
                      (progn ; reverse the order
                        (setq new_wireno (strcat comp2_tag comp1_tag)) ; just jam two tags together, no delimiter
                      )
                    ; ELSE
                      (progn ; normal order of wire number format                  
                        (setq new_wireno (strcat comp1_tag comp2_tag)) ; just jam two tags together, no delimiter                       
                    ) )   
<span style="color:#ff0000;">                    ; Now add an incrementing alpha suffix to the wire number until
                    ; a unique wire number is found (one that does not appear to have
                    ; already been used elsewhere on this drawing).
                    ; "existing_wnum_list" is the list of existing wire numbers
                    ; collected for the active drawing.

                    (setq alphalst (list "A" "B" "C" "D" "E" "F" "G" "H" "J" "K" "L" "M" "N"
                                         "P" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "A1" "A2"))
                    (setq hit nil)
                    (foreach suffix alphalst
                      (if (not hit)
                        (progn ; don't have a unique number yet. Try this one.
                          (setq x (strcat new_wireno suffix))
                          (if (not (member x existing_wnum_list))
                            (progn ; Yes, found next available suffix that yields a
                                   ; unique wire number!
                              ; Add this new wire number to the running list
                              (setq existing_wnum_list (cons x existing_wnum_list))
                              (setq hit T) ; to bypass the rest of this "foreach" loop
                              (setq new_wireno x)
                          ) )
                    ) ) )                                        
                    (if (not hit)
                      (progn ; didn't find a unique wire number suffix. Add "???"
                        (setq new_wireno (strcat new_wireno "???"))
                    ) )
</span>                    (c:wd_putwnf en new_wireno) ; put the wire number on wire</pre>
<p>There it is. Let&#8217;s test. Save the above file. APPLOAD it. Then type MILNUM_ALLDWG [Enter] at the Command: prompt.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wirenox_02.png"><img class="alignnone size-full wp-image-694" title="wirenox_02" src="http://nateholt.files.wordpress.com/2009/11/wirenox_02.png?w=833&#038;h=458" alt="wirenox_02" width="833" height="458" /></a></p>
<p>Download full file <a href="http://www.mediafire.com/?0y32enmjzxv">here</a></p>
<p>UPDATE: found typo in the uploaded file (13-Nov-2009). Fixed and reposted.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/692/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=692&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/11/12/enhanced-wire-number-tags-based-on-connected-components-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wirenox_01.png" medium="image">
			<media:title type="html">wirenox_01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wirenox_02.png" medium="image">
			<media:title type="html">wirenox_02</media:title>
		</media:content>
	</item>
		<item>
		<title>PLC I/O Drawing Generator &#8211; Pre-defining wire numbers &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/11/06/plc-io-drawing-generator-pre-defining-wire-numbers-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/11/06/plc-io-drawing-generator-pre-defining-wire-numbers-autocad-electrical/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 15:02:27 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=674</guid>
		<description><![CDATA[Adding a new option to the &#8220;Spreadsheet to PLC I/O&#8221; drawing generator tool &#8211; pre-defining wire numbers right in the spreadsheet.
This AutoCAD Electrical tool is pretty flexible. Using Excel, you lay out your control system&#8217;s I/O module requirements and out pops a set of 75-80% complete PLC I/O drawings.
For example, the first three lines of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=674&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Adding a new option to the &#8220;Spreadsheet to PLC I/O&#8221; drawing generator tool &#8211; pre-defining wire numbers right in the spreadsheet.</strong></p>
<p>This AutoCAD Electrical tool is pretty flexible. Using Excel, you lay out your control system&#8217;s I/O module requirements and out pops a set of 75-80% complete PLC I/O drawings.</p>
<p>For example, the first three lines of this example spreadsheet drives the AutoCAD Electrical Spreadsheet to PLC I/O utility to generate the circuitry shown below. But wouldn&#8217;t it be nice if we could pre-define the existing wire number assignments that tie into the two customer-supplied interlocks?</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_00.png"><img class="alignnone size-full wp-image-676" title="wdio_wnum_00" src="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_00.png?w=1024&#038;h=355" alt="wdio_wnum_00" width="1024" height="355" /></a></p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_01.png"><img class="alignnone size-full wp-image-675" title="wdio_wnum_01" src="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_01.png?w=868&#038;h=704" alt="wdio_wnum_01" width="868" height="704" /></a></p>
<p><strong>How to add this new feature</strong></p>
<p>This is not too difficult. One thing that makes it possible is that this Spreadsheet to PLC I/O generator tool runs is an AutoLISP function that runs totally bare. It is supplied and runs in full-source mode, file name &#8220;wdio.lsp&#8221;. This means you are free to modify your copy of this tool.</p>
<p>The second thing that makes adding this new option easy-to-do is that the tool is already set up to support &#8220;piggy-backed&#8221; attribute assignments.  For example, in the row of your spreadsheet for I/O point &#8220;I:003/10&#8243; you&#8217;ve entered the block name for a N.O. temperature switch, block name &#8220;HTS11&#8243;. In the D3DESC column you&#8217;ve entered a description for this switch, &#8220;SLURRY HEAT READY&#8221;. But you&#8217;d also like to define the &#8220;RATING1&#8243; value for this switch. But your spreadsheet has no column for RATING1 for the 3rd connected component. No problem. Just piggy-back the RATING1 assignment to the D3DESC value:</p>
<p>D3DESC value before:  SLURRY HEAT READY</p>
<p>D3DESC value after: SLURRY HEAT READY;RATING1=95C</p>
<p>We&#8217;ll use this same idea to flag pre-defined wire number insertion on each side of a component. Instead of a name of an attribute, we&#8217;ll use these names:  $WNL and $WNR for &#8220;wire number left side&#8221; and &#8220;wire number right side&#8221;.</p>
<p>So, let&#8217;s say that we want to pre-define wire number assignments &#8220;TS-100&#8243; and &#8220;TS-101&#8243; for this temperature switch in our spreadsheet. We&#8217;d enter this:</p>
<p>D3DESC value: SLURRY HEAT READY;RATING1=95C;$WNL=TS-100;$WNR=TS-101</p>
<p>So, that&#8217;s how we&#8217;ll set up our Excel spreadsheet to define wire number assignments. Now, the key piece is to modify the &#8220;wdio.lsp&#8221; file to be ready to recognize that a piggy-backed attribute name that is $WNL or $WNR is really a flag for a wire number insert.</p>
<p>Step 1 &#8211; find the wdio.lsp utility. A <a href="http://nateholt.wordpress.com/2009/08/04/support-file-finder-autocad-electrical/">good way </a>to do this is to type this at your AutoCAD Electrical &#8221;Command:&#8221; prompt</p>
<p style="padding-left:30px;"><strong>(c:ace_find_file &#8220;wdio.lsp&#8221; 3)</strong> <em>[Enter]</em></p>
<p>If it can be found, the full path will display. Ignore the doubled-up back-slashes. It&#8217;s a Lisp thing.</p>
<p>Step 2 &#8211; MAKE BACK-UP COPY OF wdio.lsp. Important! Safety first.</p>
<p>Step 3 &#8211; Open wdio.lsp with any ASCII text editor or use AutoCAD&#8217;s Visual Lisp editor (type vlide [enter] at Command: prompt)</p>
<p>Step 4 &#8211; find this function within wdio.lsp file</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_03.png"><img class="alignnone size-full wp-image-679" title="wdio_wnum_03" src="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_03.png?w=868&#038;h=201" alt="wdio_wnum_03" width="868" height="201" /></a></p>
<p>Step 5 &#8211; Carefully cut and paste the code below to replace everything shown in the screenshot above.</p>
<pre>  ; --
  (defun wdio_write_out_accum_extra_attr_data ( en lst2 / atnam atval x xx hit_wen lstx)
    ; "lst2" = (list (list attrnam attrval) (list attrnam attrval) ...)
    (foreach x lst2
; ** 06-Nov-09 NEHolt.begin, N8 Consultants LLC     
      (cond
        ((wcmatch (strcase (car x)) "$WNL,$WNT,$WNR,$WNB") ; Look for special wire number flag
          ; masquerading as an attribute tag name. When found, the "attribute value" associated
          ; with it will be the desired fixed wire number value.
          ; The name of the flag indicates which "side" of the inserted component "en" that
          ; the wire number goes with.
          ; Get component's wire connection data
          (setq lstx (c:wd_get_sym_pntlst en 1 nil))
          (setq hit_wen nil)
          (foreach xx lstx
            ; Going through each wire connection returned from the component that was
            ; just inserted (entity name "en"). Each sublist has the X?TERMxx wire connection
            ; direction (the "?" part) held in (nth 4...) element. If any wires tied to
            ; this connection, they are held in a list of entity names in (nth 3...) element.
            (cond
              ((/= hit_wen nil)) ; already processed this wire number, skip
              ((= (nth 3 xx) nil)) ; no wire connected to this component connection, keep looking
              ((AND (= (strcase (car x)) "$WNL")
                    (= (nth 4 xx) 4)) ; connection direction is from the left
                ; Found wire connection on left side (wire connection direction "4")
                ; Push fixed wire number out to this wire connection's attached wire                
                (setq hit_wen (car (nth 3 xx))) ; save wire entity name &amp; exit loop
              ) 
              ((AND (= (strcase (car x)) "$WNR")
                    (= (nth 4 xx) 1)) ; connection direction is from the right
                ; Found wire connection on right side (wire connection direction "1")
                ; Push fixed wire number out to this wire connection's attached wire                 
                (setq hit_wen (car (nth 3 xx))) ; save wire entity name &amp; exit loop
              ) 
              ((AND (= (strcase (car x)) "$WNT")
                    (= (nth 4 xx) 2)) ; connection direction is from above
                ; Found wire connection on top side (wire connection direction "2")
                ; Push fixed wire number out to this wire connection's attached wire                 
                (setq hit_wen (car (nth 3 xx))) ; save wire entity name &amp; exit loop
              ) 
              ((AND (= (strcase (car x)) "$WNB")
                    (= (nth 4 xx) 8)) ; connection direction is from below
                ; Found wire connection on bottom (wire connection direction "8")
                ; Push fixed wire number out to this wire connection's attached wire                 
                (setq hit_wen (car (nth 3 xx))) ; save wire entity name &amp; exit loop               
          ) ) )    
          (if hit_wen
            (progn ; push the defined wire number out to wire entity "hit_wen".
                   ; Insert it as a "fixed" wire number value.
              (c:wd_putwnf hit_wen (cadr x))             
        ) ) )    
        (T
; ** 06-Nov-09 NEHolt.end

          (if (AND (not (c:wd_modattrval en (car x) (cadr x) 1)) (/= (car x) ""))
            (progn ; target attribute name not found
              ; If it is the format of CATxx, MFGxx, CNTxx, ASSYCODExx, or WDBLKNAMxx then write out as XData
              (if (wcmatch (car x) "CAT??,MFG??,CNT??,ASSYCODE??,UM??,WDBLKNAM??")
                (progn ; write as XData
                  (c:wd_upd_pnlval en (car x) (cadr x))             
        ) ) ) ) )
      )
  ) )</pre>
<p>Step 6 &#8211; save your modified version of wdio.lsp.</p>
<p><strong>Now, let&#8217;s test.</strong></p>
<p>Here we&#8217;ve opened up the demo PLC spreadsheet demoplc.xls and added some references. We changed the terminal block names from HT0001 to HT1001 so that wire numbers change through them. We&#8217;ve added a couple customer symbol references. Finally, we added in our wire number flags to insert wire numbers &#8220;W1&#8243;, &#8220;W2&#8243; on the customer limit switch and &#8220;W5&#8243; and &#8220;W9&#8243; for the N.C. relay contact.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_04.png"><img class="alignnone size-full wp-image-681" title="wdio_wnum_04" src="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_04.png?w=956&#038;h=218" alt="wdio_wnum_04" width="956" height="218" /></a></p>
<p>Save spreadsheet. Exit out of Excel. Cross fingers and fire up the AutoCAD Electrical Spreadsheet &#8211;&gt; PLC I/O utility. Reference the modified spreadhseet, and watch what happens&#8230;</p>
<p><a href="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_02.png"><img class="alignnone size-full wp-image-677" title="wdio_wnum_02" src="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_02.png?w=586&#038;h=477" alt="wdio_wnum_02" width="586" height="477" /></a></p>
<p><strong>A few things to keep in mind with this modification:</strong></p>
<p>1. Remember that terminals come in two flavors&#8230; those that maintain a wire number assignment through the terminal on those that trigger a wire number change through them. You might need to use the latter.</p>
<p>2. If you put the &#8220;$WNL=&lt;wire number&gt;&#8221; or &#8220;$WNR=&lt;wire number&gt;&#8221; flag in an empty cell in your spreadsheet, precede it with a semi-colon (ex: empty cell contents becomes &#8221;;$WNL=12345&#8243;). This triggers the utility to treat this as a piggy-backed attribute.</p>
<p>3. For wires attaching from above or below, use flags $WNT and $WNB.</p>
<p>4. If these flag names don&#8217;t make sense or the &#8220;$&#8221; character is not one that shows up on your keyboard, adjust to suit your needs by editing the appropriate places in the pasted in Lisp code of step #5 above.</p>
<p>Advertisement &#8211; if your company is in need of AutoCAD Electrical customization, please visit <a href="http://n8consultants.com">http://n8consultants.com</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/674/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=674&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/11/06/plc-io-drawing-generator-pre-defining-wire-numbers-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_00.png" medium="image">
			<media:title type="html">wdio_wnum_00</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_01.png" medium="image">
			<media:title type="html">wdio_wnum_01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_03.png" medium="image">
			<media:title type="html">wdio_wnum_03</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_04.png" medium="image">
			<media:title type="html">wdio_wnum_04</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/11/wdio_wnum_02.png" medium="image">
			<media:title type="html">wdio_wnum_02</media:title>
		</media:content>
	</item>
		<item>
		<title>Vertical SCOOT work-around &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/10/26/vertical-scoot-work-around-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/10/26/vertical-scoot-work-around-autocad-electrical/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 13:23:54 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=664</guid>
		<description><![CDATA[Overriding a propensity for AutoCAD Electrical&#8217;s cool &#8220;Scoot&#8221; command to default to &#8220;horizontal&#8221; mode
This was another &#8220;head-scratcher&#8221;. The task seemed so simple. Just create a horizontal and vertical version of an electrical symbol to represent a multi-ratio current transformer. Should be easy, piece of cake&#8230;
&#8230; but, when finished and testing the results, the horizontal version [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=664&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Overriding a propensity for AutoCAD Electrical&#8217;s cool &#8220;Scoot&#8221; command to default to &#8220;horizontal&#8221; mode</strong></p>
<p>This was another &#8220;head-scratcher&#8221;. The task seemed so simple. Just create a horizontal and vertical version of an electrical symbol to represent a multi-ratio current transformer. Should be easy, piece of cake&#8230;</p>
<p>&#8230; but, when finished and testing the results, the horizontal version worked great and SCOOTed great, but the vertical version behaved unexpectedly.</p>
<p>Here&#8217;s are a couple instances of the new horizontal symbol inserted into a bus wire. The Scoot command works as expected.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_01.png"><img class="alignnone size-full wp-image-665" title="CT_scoot_01" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_01.png?w=595&#038;h=427" alt="CT_scoot_01" width="595" height="427" /></a></p>
<p>Right click on the symbol, select SCOOT command, and slide it over to the right&#8230;</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_02.png"><img class="alignnone size-full wp-image-666" title="ct_scoot_02" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_02.png?w=525&#038;h=357" alt="ct_scoot_02" width="525" height="357" /></a></p>
<p>&#8230; and click. Everything stretches/trims/reconnects nicely.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_03.png"><img class="alignnone size-full wp-image-667" title="CT_scoot_03" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_03.png?w=506&#038;h=372" alt="CT_scoot_03" width="506" height="372" /></a></p>
<p><strong>But not the Vertical version ( ! )</strong></p>
<p>The vertical version wants to scoot horizontally on the horizontal connected wire. What&#8217;s going on??</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_04.png"><img class="alignnone size-full wp-image-668" title="CT_scoot_04" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_04.png?w=589&#038;h=538" alt="CT_scoot_04" width="589" height="538" /></a></p>
<p><strong>The problem</strong>: the SCOOT command appears to have a built-in bias to default to horizontal scooting. If there are the <strong>same</strong> number of horizontal wire connection points as there are vertical wire connection points on a symbol, and at least one wire connects to each type, the SCOOT command defaults to horizontal scoot mode.</p>
<p>Here&#8217;s the exploded vertical version of the custom CT symbol:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_05.png"><img class="alignnone size-full wp-image-670" title="CT_scoot_05" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_05.png?w=866&#038;h=640" alt="CT_scoot_05" width="866" height="640" /></a></p>
<p>There are two vertical wire connection attributes, X2TERM04 and X8TERM03 (where the 2nd character of 2 or 8 flags vertical). There are two horizontal wire connection attributes, X4TERM02 and X4TERM01 (where the 2nd character of 1 or 4 flags horizontal connection). So, equal number of horizontal and vertical&#8230; and the SCOOT command defaults to horizontal scooting.</p>
<p><strong>The Work-around</strong></p>
<p>On a tie vote, horizontal wins. So we need to stuff the ballot box with an extra &#8220;vote&#8221; for vertical. Here&#8217;s the work-around. Add a dummy vertical wire connection attribute to the symbol so that the vote will end up being 3 vertical versus 2 horizontal&#8230; and scoot will go with the vertical majority.</p>
<p>Add the unused dummy vertical wire connection attribute at a point on the symbol where it will likely not be accidentally used. Here&#8217;s the example for the above symbol:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/ct_scoot_06.png"><img class="alignnone size-full wp-image-671" title="CT_scoot_06" src="http://nateholt.files.wordpress.com/2009/10/ct_scoot_06.png?w=732&#038;h=514" alt="CT_scoot_06" width="732" height="514" /></a></p>
<p>Not necessary, but used an odd suffix value of &#8220;99&#8243; to make it &#8220;stand out&#8221; from the others.</p>
<p><strong>Testing</strong></p>
<p>Now, it scoots vertically, very nicely!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/664/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=664&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/10/26/vertical-scoot-work-around-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_01.png" medium="image">
			<media:title type="html">CT_scoot_01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_02.png" medium="image">
			<media:title type="html">ct_scoot_02</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_03.png" medium="image">
			<media:title type="html">CT_scoot_03</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_04.png" medium="image">
			<media:title type="html">CT_scoot_04</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_05.png" medium="image">
			<media:title type="html">CT_scoot_05</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/ct_scoot_06.png" medium="image">
			<media:title type="html">CT_scoot_06</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8216;ZOOM to HANDLE&#8217; utility &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/10/15/zoom-to-handle-utility-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/10/15/zoom-to-handle-utility-autocad-electrical/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 22:26:24 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=653</guid>
		<description><![CDATA[Quickly create a tool to find and zoom to a given entity using its handle number.
You know an entity/object&#8217;s &#8220;handle&#8221; number, but where in the world is it in your jumbled drawing?
Complex library creation and testing has been on my plate for a couple weeks. The new code spits out the AutoCAD handle of various entities as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=653&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Quickly create a tool to find and zoom to a given entity using its handle number.</strong></p>
<p>You know an entity/object&#8217;s &#8220;handle&#8221; number, but where in the world is it in your jumbled drawing?</p>
<p>Complex library creation and testing has been on my plate for a couple weeks. The new code spits out the AutoCAD handle of various entities as processing proceeds. Sometimes there&#8217;s a need to go back in and find a problem entity on the drawing. Have the handle reference but that&#8217;s it. What is it, where is it?</p>
<p><strong>Manual Method &#8211; Crude with  no-frills</strong></p>
<p>Here&#8217;s the crude, no-frills way. Open the entity and display its guts in the command window.</p>
<p>Let&#8217;s say that you&#8217;ve run your program in a &#8220;debugging&#8221; mode and find that there is some issue with object handle &#8220;74F&#8221; in the active drawing. What and where is this entity?</p>
<p>Type this AutoLISP expression at the &#8220;Command:&#8221; prompt</p>
<p>Command: <strong>(entget (handent &#8220;74F&#8221;))</strong> <em>[Enter]</em></p>
<p>It returns this block of data about this entity.</p>
<p>((-1 . &lt;Entity name: 7ef152f8&gt;) (0 . &#8220;LINE&#8221;) (330 . &lt;Entity name: 7ef11c10&gt;) (5 . &#8220;74F&#8221;) (100 . &#8220;AcDbEntity&#8221;) (67 . 0) (410 . &#8220;Model&#8221;) (8 . &#8220;0&#8243;) (100 .<br />
&#8220;AcDbLine&#8221;) (10 6.09375 13.5 0.0) (11 6.12676 13.5 0.0) (210 0.0 0.0 1.0))</p>
<p>The &#8220;0&#8243; entry flags the entity type: &#8220;LINE&#8221; and the &#8220;10&#8243; and &#8220;11&#8243; parts give the XYZ start and end points of the LINE segment.</p>
<p>Crude, but it does work.</p>
<p><strong>Better Method: auto-ZOOM to the entity</strong></p>
<p>Here&#8217;s a little AutoLISP utility thrown together to help in troubleshooting. It zooms in on the target object given the typed-in handle.</p>
<p>The syntax is pretty simple. After the utility is APPLOADed, type ZH at the AutoCAD command prompt and then enter the handle number at the next prompt&#8230;</p>
<p>Command: <strong>zh</strong> <em>[Enter]</em><br />
Handle  =<strong>74F </strong><em>[Enter]</em><strong><br />
</strong></p>
<p>The utility opens up the entity. If it is a simple graphical entity like an arc, text, block insert, line, then it opens it to find &#8220;where&#8221; it is.</p>
<p><span style="color:#ff0000;">Entity type: LINE XY=(6.11026 13.5 0.0)</span></p>
<p>&#8230; and then it issues a ZOOM &#8220;Centered&#8221; command to display the object in the middle of the screen. It then tries to highlight it. Now you can zoom in or out with &#8220;I&#8221; or &#8220;O&#8221; keystrokes or use your mouse &#8220;wheel&#8221; to take a better look in context.</p>
<p>Here&#8217;s the handle &#8220;74F&#8221; example&#8230; it was an incomplete wire connection on the high side of a control transformer.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/10/zh001.png"><img class="alignnone size-full wp-image-656" title="zh001" src="http://nateholt.files.wordpress.com/2009/10/zh001.png?w=604&#038;h=500" alt="zh001" width="604" height="500" /></a></p>
<p>Here&#8217;s the utility itself. Cut and paste into an ASCII text file, let&#8217;s call it &#8220;zh.lsp&#8221;.</p>
<pre>; ** 13-Oct-09 NEHolt - http://n8consultants.com
(defun c:zh ( / hdl xy enttype ed en xy2)
  ; ZOOM to entity "handle". Does not check model vs layout space.
  (while (/= (setq hdl (getstring (strcat
              "\nHandle " (if en "(or I=Zoom IN, O=Zoom out)" "") " ="))) "")
    (cond
      ((= (strcase hdl) "I")(command "_.ZOOM" "1.5x"))
      ((= (strcase hdl) "O")(command "_.ZOOM" "0.75x"))
      (T
        (if (setq en (handent hdl)) ; convert handle string to its "entity name"
          (progn ; appears to be a valid handle number
            (if (setq ed (entget en)) ; open up the entity
              (progn ; success, okay to continue
                (setq xy nil)
                (setq enttype (cdr (assoc 0 ed))) ; extract the entity type
                (princ "\nEntity type: ")(princ enttype)
                (if (= enttype "INSERT")
                  (progn ; this is a block INSERT instance
                    (princ " blk nam=")
                    (princ (cdr (assoc 2 ed))) ; display block name
                ) )
                ; Figure where entity is located
                (if (cdr (assoc 10 ed))
                  (progn
                    (setq xy (cdr (assoc 10 ed))) ; 10 subrec often gives a location value
                    (if (= enttype "LINE")
                      (progn ; LINE entity. Reset to zoom to line's midpoint
                        (setq xy2 (cdr (assoc 11 ed))) ; XY of other end
                        ; Calc midpoint coordinate
                        (setq xy (list (+ (car xy) (* 0.5 (- (car xy2) (car xy))))
                                       (+ (cadr xy) (* 0.5 (- (cadr xy2) (cadr xy))))
                                       (+ (caddr xy) (* 0.5 (- (caddr xy2) (caddr xy))))))
                ) ) ) )
                (if xy
                  (progn ; Non-blank XY extracted from picked entity. Go ahead and
                           ; display the value and ZOOM in to that point on the drawing.
                    (princ " XY=")(princ xy)
                    (command "_.ZOOM" "_C" xy 1.0) ; use ZOOM CENTER command
                    (redraw en 3) ; trigger entity to "highlight"
                ) )
        ) ) ) )
      )
    )
  )
  (command "_.REGEN") ; brute force - unhighlight everything
  (princ) ; quiet return
)</pre>
<p>That should be it. APPLOAD this file and that should expose the utility to use on your active drawing.</p>
<p>UPDATE: typo introduced when the above program was cut/paste into this posting. Very sorry. Should be okay now. &#8211; Nate.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/653/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/653/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/653/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=653&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/10/15/zoom-to-handle-utility-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/10/zh001.png" medium="image">
			<media:title type="html">zh001</media:title>
		</media:content>
	</item>
		<item>
		<title>Nate&#8217;s Simple AutoLISP &#8211; Lesson 007</title>
		<link>http://nateholt.wordpress.com/2009/09/28/nates-simple-autolisp-lesson-007/</link>
		<comments>http://nateholt.wordpress.com/2009/09/28/nates-simple-autolisp-lesson-007/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 02:12:47 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=638</guid>
		<description><![CDATA[Using the selection set function &#8220;ssget&#8221; to track down and remove instances of an invisible block.
This exercise will be short and [hopefully] sweet. The idea for this one came from personal experience&#8230; today.
Let&#8217;s say that you create a block instance consisting of just one attribute definition. You define its tag name to be &#8220;BY_CUSTOMER&#8221; and you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=638&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Using the selection set function &#8220;ssget&#8221; to track down and remove instances of an invisible block.</strong></p>
<p>This exercise will be short and [hopefully] sweet. The idea for this one came from personal experience&#8230; today.</p>
<p>Let&#8217;s say that you create a block instance consisting of just one attribute definition. You define its tag name to be &#8220;BY_CUSTOMER&#8221; and you leave the value blank, planning to fill in with different values later.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp007a3.png"><img class="alignnone size-full wp-image-644" title="autolisp007a" src="http://nateholt.files.wordpress.com/2009/09/autolisp007a3.png?w=502&#038;h=287" alt="autolisp007a" width="502" height="287" /></a><br />
You go ahead and block this single attribute definition with a block name of &#8220;CUSTOMER_FLAG&#8221;&#8230;</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp007b1.png"><img class="alignnone size-full wp-image-645" title="autolisp007b" src="http://nateholt.files.wordpress.com/2009/09/autolisp007b1.png?w=611&#038;h=542" alt="autolisp007b" width="611" height="542" /></a></p>
<p> </p>
<p>&#8230; and you sprinkle a bunch of instances of this block across your drawing. You keep working away. A couple hours later you&#8217;re ready to go back and assign values to the BY_CUSTOMER attribute on each inserted instance of your CUSTOMER_FLAG block.</p>
<p>Hey&#8230; where are they? Don&#8217;t see them. You know you inserted them at multiple places in your drawing. But there&#8217;s nothing to pick on!</p>
<p>The block was just a single attribute and, unfortunately, you created it with a blank default value ( ! ).</p>
<p>Okay, let&#8217;s erase them and have a &#8220;do over&#8221;. But hey, how can I erase something I can&#8217;t select&#8230; something I can&#8217;t even see?!</p>
<p>Well, could try the QTEXT trick. Turn QTEXT &#8220;ON&#8221; and type REGEN. All blank attribute values now should display a tiny dot. But how can I tell which dot is which without picking one at a time and listing what it is?</p>
<p><strong>Quick solution using the AutoLISP function &#8220;SSGET&#8221; with a filter</strong></p>
<p>The solution uses AutoLISP and is easy&#8230; we can do it all right at the &#8220;Command:&#8221; prompt.</p>
<p>What we&#8217;ll do is make a &#8220;selection set&#8221; of all instances of this invisible / un-selectable block. We&#8217;ll do this by scanning ALL entities in our active drawing and filter out everything except blocks that carry the block name &#8220;CUSTOMER_FLAG&#8221;. A block instance carries the assigned block name in the &#8220;2&#8243; entity sub-record. We&#8217;ll make a really simple filter by just looking for entities that have &#8220;CUSTOMER_FLAG&#8221; as the value of their &#8220;2&#8243; subrecord.</p>
<p>Type this at the &#8220;Command:&#8221; prompt:</p>
<p style="padding-left:30px;"><strong>(setq ss (ssget &#8220;_X&#8221;  &#8217;((2 . &#8220;CUSTOMER_FLAG&#8221;))))</strong> <em> [Enter]</em></p>
<p>If any matches found, the message &#8220;&lt;Selection set xx&gt;&#8221; will display below the &#8220;Command:&#8221; prompt. What we&#8217;ve done here is defined a dummy variable we&#8217;re calling &#8220;ss&#8221; and it will carry the selection set returned by the call to &#8220;(ssget &#8230;)&#8221;.</p>
<p>Let&#8217;s see how many it found. Type this:</p>
<p style="padding-left:30px;"><strong>(sslength ss)</strong> <em>[Enter]</em></p>
<p>&#8230; and it will display the number of instances of CUSTOMER_FLAG that were found in the drawing.</p>
<p>Okay, now let&#8217;s blow them away so we can PURGE our drawing. Type this:</p>
<p style="padding-left:30px;"><strong>(command &#8220;_ERASE&#8221; ss &#8220;&#8221;)</strong> <em>[Enter]</em></p>
<p>&#8230; and they&#8217;re gone! The above just launches the normal AutoCAD ERASE command. We pass the selection set variable we created above, &#8220;ss&#8221; to this command along with an extra &#8220;&#8221; at the end to kick out of the &#8220;select objects&#8221; loop. Finally, launch the PURGE command. You should now see that block CUSTOMER_FLAG is a candidate for purging. Yes! Blow it away.</p>
<p><strong> </strong></p>
<p><strong>Caution</strong></p>
<p>The above solution will probably work as expected 99.9% of the time. But there are some entities that &#8220;share&#8221; the &#8220;2&#8243; sub-record. For example, an ATTDEF entity uses the &#8220;2&#8243; subrecord to carry the attribute tag name. So if we had some orphaned ATTDEFs floating around in our drawing and they happened to have a tag name of &#8220;CUSTOMER_FLAG&#8221;, then these CUSTOMER_FLAG ATTDEFs would be erased along with the CUSTOMER_FLAG block instances.</p>
<p>To be really, really safe, we could redo our selection set filtering like this to make sure that we&#8217;re only dealing with block instances AND the block instance is named &#8220;CUSTOMER_FLAG&#8221;. The entity type is carried in sub-record type zero. Block insert entity type is &#8220;INSERT&#8221;. So, a fool-proof, command-prompt-entered query to build the selection set might look like this:</p>
<p style="padding-left:30px;"><strong>(setq ss (ssget &#8220;_X&#8221;  &#8216;((-4 . &#8220;&lt;AND&#8221;)(0 . &#8220;INSERT&#8221;)(2 . &#8220;CUSTOMER_FLAG&#8221;)(-4 . &#8220;AND&gt;&#8221;))))</strong>  <em>[Enter]</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/638/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=638&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/09/28/nates-simple-autolisp-lesson-007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp007a3.png" medium="image">
			<media:title type="html">autolisp007a</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp007b1.png" medium="image">
			<media:title type="html">autolisp007b</media:title>
		</media:content>
	</item>
		<item>
		<title>Nate&#8217;s Simple AutoLISP &#8211; Lesson 006</title>
		<link>http://nateholt.wordpress.com/2009/09/26/nates-simple-autolisp-lesson-006/</link>
		<comments>http://nateholt.wordpress.com/2009/09/26/nates-simple-autolisp-lesson-006/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 19:17:11 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=612</guid>
		<description><![CDATA[Experimenting with attribute definition order, entity sorting, and entmake
This lesson&#8217;s issue: Scrambled attribute order on a block insert.
(Note: previous postings: Lesson 001, Lesson 002, Lesson 003, Lesson 004, and Lesson 005)
Here is an AutoCAD Electrical transformer symbol popped into a circuit. If I decide to use the generic attribute editor command built into AutoCAD to examine and possibly adjust values [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=612&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Experimenting with attribute definition order, entity sorting, and entmake</strong></p>
<p>This lesson&#8217;s issue: Scrambled attribute order on a block insert.</p>
<p>(Note: previous postings: <a href="http://nateholt.wordpress.com/2009/07/05/nates-simple-autolisp-lesson-001/">Lesson 001</a>, <a href="http://nateholt.wordpress.com/2009/07/05/nates-simple-autolisp-lesson-002/">Lesson 002</a>, <a href="http://nateholt.wordpress.com/2009/07/05/nates-simple-autolisp-lesson-003/">Lesson 003</a>, <a href="http://nateholt.wordpress.com/2009/07/05/nates-simple-autolisp-lesson-004/">Lesson 004</a>, and <a href="http://nateholt.wordpress.com/2009/09/01/nates-simple-autolisp-lesson-005/">Lesson 005</a>)</p>
<p>Here is an AutoCAD Electrical transformer symbol popped into a circuit. If I decide to use the generic attribute editor command built into AutoCAD to examine and possibly adjust values for this instance of the transformer block insert, the attribute order listed is pretty scrambled.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp006a.png"><img class="alignnone size-full wp-image-613" title="autolisp006a" src="http://nateholt.files.wordpress.com/2009/09/autolisp006a.png?w=702&#038;h=709" alt="autolisp006a" width="702" height="709" /></a></p>
<p>It appears that the order that attributes are listed here are in the same order that the ATTDEF entities were inserted into the block&#8217;s source &#8220;.dwg&#8221; file. (Note: you can use AutoCAD&#8217;s BATTMAN command and painfully re-order the attribute listing for the block reference in the active drawing&#8230; but that is a one-time fix and not a permanent library &#8220;.dwg&#8221;-based solution. Read on.)</p>
<p>Call up the block&#8217;s original &#8220;.dwg&#8221; file, VXF1D.dwg. Type this at the command prompt:</p>
<p>Command:<strong> </strong><span style="color:#000000;"><strong>(entget (car (entsel)))</strong> </span><em>[Enter]</em>  </p>
<p>Select object:<em>[Pick on the TAG1 attribute definition] </em></p>
<pre>((-1 . &lt;Entity name: 7ffffbbedf0&gt;) (0 . "ATTDEF") (330 . &lt;Entity name: 7ffffbbe820&gt;) <span style="color:#ff0000;"><strong>(5 . "5F")</strong></span>(100 . "AcDbEntity") (67 . 0) (410 . "Model")
(8 . "0") (100 . "AcDbText") (10 0.166667 0.749995 0.0) (40 . 0.125) (1 . "XF") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "WD") (71 . 0) (72 . 1)
(11 0.375 0.749995 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttributeDefinition") (280 . 0) (3 . "") (2 . "TAG1") (70 . 0) (73 . 0) (74 . 0) (280 . 0))</pre>
<p>and then pick on the TAG1 attribute definition. This expression will read the attribute definition entity (the one you select) and return the entity&#8217;s data (above). This is pretty cryptic but the part shown in red is the picked entity&#8217;s &#8220;handle&#8221; number, &#8220;5F&#8221;.</p>
<p>If we repeat for the RATING1 and the DESC1 attributes, the handle numbers are &#8220;5E&#8221; and &#8220;60&#8243; respectively.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp006b.png"><img class="alignnone size-full wp-image-614" title="autolisp006b" src="http://nateholt.files.wordpress.com/2009/09/autolisp006b.png?w=664&#038;h=918" alt="autolisp006b" width="664" height="918" /></a></p>
<p>These entity handle numbers (in hexidecimal format) indicate the order that these attribute definitions were created and added to the library symbol drawing. It looks like the RATING1 attribute definition (5E) was created just before the TAG1 (5F) attribute definition. Next, the DESC1 (60) was defined and added to the symbol.</p>
<p><strong>ATTDEF creation order and attribute display order</strong></p>
<p>Does the creation order drive the attribute&#8217;s display order when the source library symbol is inserted as a block insert into another drawing?</p>
<p>Let&#8217;s take another look at the attribute editor dialog display when the symbol above is inserted as a block reference into a drawing.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp006c.png"><img class="alignnone size-full wp-image-617" title="autolisp006c" src="http://nateholt.files.wordpress.com/2009/09/autolisp006c.png?w=503&#038;h=416" alt="autolisp006c" width="503" height="416" /></a></p>
<p>Note that these three attributes are listed together with RATING1 (original handle &#8221;5E&#8221;) leading, TAG1 next (original handle &#8220;5F&#8221;) and DESC1 (original handle &#8220;60&#8243;) bring up the rear. It looks like that the creation order DOES influence the display order.</p>
<p>Let&#8217;s say that we really want the TAG1 attribute to be first in the list. Then we want the three DESC1, DESC2, and DESC3 attributes listed, then all of the &#8220;RATING*&#8221; attributes, catalog assignment attributes, and then all the rest in alphabetical order. So, if creation order is a controlling factor, we have a couple options&#8230;</p>
<p><strong>OPTION 1</strong>: We could carefully re-construct our VXF1D.dwg base library symbol (and the many hundreds of others) so that the attribute defintions are each created in this order.</p>
<p><strong>OPTION 2</strong>: Write a little AutoLISP utility that takes an existing scrambled library symbol dwg file, deletes all the attribute definitions, and then pushes them back into the symbol&#8217;s dwg file in the desired order.</p>
<p>Let&#8217;s go with the second option.</p>
<p><strong>Using (entmake&#8230;)</strong></p>
<p>Let&#8217;s try a little experiment. Let&#8217;s save an ATTDEF&#8217;s block of data into an AutoLISP variable. Then delete the ATTDEF using AutoCAD ERASE command. Then see if we can re-create a new, carbon-copy of the original ATTDEF with a call to &#8220;entmake&#8221;.</p>
<p>1. With our VXF1D.dwg drawing open on the screen, type this at the command prompt:</p>
<p>Command:<strong> (setq tag1_data (entget(car (entsel))))</strong> <em>[Enter, pick on TAG1 attdef]</em></p>
<p>Select object: ((-1 . &lt;Entity name: 7ffffbbedf0&gt;) (0 . &#8220;ATTDEF&#8221;) (330 . &lt;Entity<br />
name: 7ffffbbe820&gt;)<span style="color:#ff0000;"><strong> (5 . &#8220;5F&#8221;) </strong></span>(100 . &#8220;AcDbEntity&#8221;) (67 . 0) (410 . &#8220;Model&#8221;) (8<br />
. &#8220;0&#8243;) (100 . &#8220;AcDbText&#8221;) (10 0.166667 0.749995 0.0) (40 . 0.125) (1 . &#8220;XF&#8221;)<br />
(50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . &#8220;WD&#8221;) (71 . 0) (72 . 1) (11 0.375<br />
0.749995 0.0) (210 0.0 0.0 1.0) (100 . &#8220;AcDbAttributeDefinition&#8221;) (280 . 0) (3<br />
. &#8220;&#8221;) (2 . &#8220;TAG1&#8243;) (70 . 0) (73 . 0) (74 . 0) (280 . 0))</p>
<p>Command: <strong>(setq desc1_data (entget (car (entsel)))) </strong><em>[Enter, pick on DESC1 attdef]</em></p>
<p>Select object: ((-1 . &lt;Entity name: 7ffffbbee00&gt;) (0 . &#8220;ATTDEF&#8221;) (330 . &lt;Entity<br />
name: 7ffffbbe820&gt;)<strong><span style="color:#ff0000;"> (5 . &#8220;60&#8243;)</span> </strong>(100 . &#8220;AcDbEntity&#8221;) (67 . 0) (410 . &#8220;Model&#8221;) (8<br />
. &#8220;0&#8243;) (100 . &#8220;AcDbText&#8221;) (10 0.234887 -0.89792 0.0) (40 . 0.125) (1 . &#8220;&#8221;) (50<br />
. 0.0) (41 . 0.7) (51 . 0.0) (7 . &#8220;WD&#8221;) (71 . 0) (72 . 1) (11 0.424471 -0.89792<br />
0.0) (210 0.0 0.0 1.0) (100 . &#8220;AcDbAttributeDefinition&#8221;) (280 . 0) (3 . &#8220;&#8221;) (2<br />
. &#8220;DESC1&#8243;) (70 . 0) (73 . 0) (74 . 0) (280 . 0))</p>
<p>Command: <strong>(setq rating1_data (entget (car (entsel))))</strong> <em>[Enter, pick on RATING1 attdef]</em></p>
<p>Select object: ((-1 . &lt;Entity name: 7ffffbbede0&gt;) (0 . &#8220;ATTDEF&#8221;) (330 . &lt;Entity<br />
name: 7ffffbbe820&gt;)<strong><span style="color:#ff0000;"> (5 . &#8220;5E&#8221;)</span></strong> (100 . &#8220;AcDbEntity&#8221;) (67 . 0) (410 . &#8220;Model&#8221;) (8<br />
. &#8220;0&#8243;) (100 . &#8220;AcDbText&#8221;) (10 0.136875 0.59375 0.0) (40 . 0.125) (1 . &#8220;&#8221;) (50 .<br />
0.0) (41 . 0.7) (51 . 0.0) (7 . &#8220;WD&#8221;) (71 . 0) (72 . 1) (11 0.399375 0.59375<br />
0.0) (210 0.0 0.0 1.0) (100 . &#8220;AcDbAttributeDefinition&#8221;) (280 . 0) (3 . &#8220;&#8221;) (2<br />
. &#8220;RATING1&#8243;) (70 . 0) (73 . 0) (74 . 0) (280 . 0))</p>
<p>2. Now erase these three ATTDEFS ( ! )</p>
<p>3. Now, let&#8217;s recreate them, but in a specific order. Type these three commands at the command line:</p>
<p>(entmake tag1_data) [Enter]</p>
<p>(entmake desc1_data) [Enter]</p>
<p>(entmake rating1_data) [Enter]</p>
<p>4. The deleted ATTDEFs are re-created, but they are now in a different order. Confirm that the handles of the three new ATTDEFs now increment in the new order of TAG1, DESC1, and then RATING1.</p>
<p><strong> </strong></p>
<p><strong>A Re-order ATTDEF AutoLISP utility</strong></p>
<p>With our little utility, we need to more or less duplicate what we just did above:  1. Capture all the ATTDEFs, 2. Erase them, 3. Re-create them with (entmake&#8230;) in the desired order.</p>
<p>Here&#8217;s what our little AutoLISP utility&#8217;s program flow might look like in order to do this:</p>
<p>1. We first define the order for specific attribute definition tagnames. We decide that we&#8217;ll support wild-cards in the tag names. This makes it easy to define all of the various AutoCAD Electrical component &#8220;tag-ID&#8221; attribute tagnames in the first entry of the priority list.</p>
<pre>  ; Set up order list of ATTDEFS. Wild-cards are supported.     
  <span style="color:#ff0000;">(setq orderlst (list "TAG1*,TAG2,TAGSTRIP,P_TAG1,P_TAGSTRIP"
                       "DESC1"
                       "DESC2"
                       "DESC3"
                       "RATING*"
                       "MFG"
                       "CAT"
                       "ASSYCODE"
                       "INST"
                       "LOC"
                       "FAMILY"
                       "TERM*"))</span></pre>
<p>2. Now, with the source block &#8220;.dwg&#8221; open in AutoCAD, our utility constructs a selection set of all ATTDEF entities found in the drawing. The call is to &#8220;ssget&#8221; and we pass the &#8220;_X&#8221; parameter which processes ALL entities in the active drawing. Our expression has a &#8216;((0 . &#8220;ATTDEF&#8221;)) filter included so that only ATTDEFs will end up in our selection set.</p>
<pre>  ; Gather up selection set of all ATTDEFs on the active drawing
  <span style="color:#ff0000;">(setq ss (ssget "_X" '((0 . "ATTDEF"))))</span></pre>
<p>3. Our utility then opens each of these ATTDEF entities in a &#8220;while&#8221; loop, indexing through the ATTDEFs in the selction set &#8220;ss&#8221;, one at a time. It pushes each ATTDEF block of data into an overall big list of data that we&#8217;re calling &#8220;attdef_lst&#8221;.</p>
<pre>   (if (AND (/= ss nil)(&gt; (sslength ss) 1))
    (progn ; at least one ATTDEF found. Okay to continue.
      ; Extract all ATTDEF tag names and overall ATTDEF entity data. Save in parallel lists.     
      (setq attdef_lst nil) ; start with blank data list
      (setq slen (sslength ss)) ; number of ATTDEFs in selection set
      (setq ix 0) ; used to index through the selection list
      (while (&lt; ix slen)        
        <span style="color:#ff0000;">(setq en (ssname ss ix))</span> ; get next ATTDEF entity name from selection set
        <span style="color:#ff0000;">(setq ed (entget en))</span> ; open up this ATTDEF entity
        <span style="color:#ff0000;">(setq attdef_lst (cons ed attdef_lst))</span> ; add its data to the big list
        (princ " ")(princ (cdr (assoc 2 ed))) ; display existing order in command window
        (setq ix (1+ ix)) ; increment index to get next ATTDEF entity from selection set
      )</pre>
<p>4. Next we sort this long list of chunks of ATTDEF data alphabetically - by the tagname part of each chunk of ATTDEF data. Setting up this sort function is a bit cryptic. See the normal AutoCAD help for a few more examples. For our time here, just go with it as shown. Basically it doing a sort on the &#8220;2&#8243; part of each ATTDEF block of data. This is the part that carries the ATTDEF &#8220;tag name&#8221;. To get at it in each list, our function uses the &#8220;(assoc 2&#8230;)&#8221; to dig it out and then a &#8220;(cdr &#8230;&#8221; to strip off the leading &#8220;2&#8243; identifier. This leaves just the tag name to be used in the sort compare.</p>
<pre>      ; Initially sort the list alphabetically by tagname. The tagname is in the "2"
      ; part of the entity's data. Access the value by extracting with the
      ; (assoc 2 ...) function.
     <span style="color:#ff0000;"> (setq attdef_lst (vl-sort attdef_lst
            '(lambda (X Y) (&lt; (cdr (assoc 2 X)) (cdr (assoc 2 Y))))))</span></pre>
<p>5. Now we&#8217;re ready to create a new version of this data list with certain ATTDEF tagnamed chunks pushed to the front part of the list. The utility cycles through the tagname priority list that we&#8217;ve set up in &#8220;orderlst&#8221; (step #1 above). For each tagname or wild-carded tagname, the utility cycles through the alphabetized list, looking for a match on the (cdr (assoc 2 &#8230;)) tagname extracted from each ATTDEF block of data. On a match, that block of data is pushed into the new list.</p>
<pre>      ; Okay. So far, so good. We now have all ATTDEFs alphabetically sorted and held
      ; in a big data list called "attdef_lst".
           
      ; Now prepare to create a brand new ATTDEF list by pulling entries from the
      ; "attdef_lst" and pushing them into this new list in the desired order.
      (setq new_attdef_lst nil) ; Start with empty new list
      (setq processed_ix_lst nil) ; To be used for tracking what items have been
                                  ; pulled from alphabetized list into the new list.
     
      ; Process the ATTDEF tagnames against the desired order given in the "orderlst"
      <span style="color:#ff0000;">(foreach sortorder_name orderlst</span>
        (setq ix 0)
        <span style="color:#ff0000;">(foreach rec attdef_lst
</span>          <span style="color:#ff0000;">(setq attdef_tag (cdr (assoc 2 rec)))</span> ; extract ATTDEF tagname for this entry
          (if (AND (not (member ix processed_ix_lst)) ; check if already processed
                   <span style="color:#ff0000;">(wcmatch attdef_tag sortorder_name))</span> ; check if tagname wild-card
                                      ; matches with the target sortordername string.
            (progn ; This ATTDEF name matches what we're looking for. Pull its data out
                   ; of the attdef_lst and push the entity's block of data into the
                   ; new "new_attdef_lst" ordered list.
              <span style="color:#ff0000;">(setq new_attdef_lst (cons rec new_attdef_lst))</span>
              ; Remember this entry's index number so won't try to add it in again
              (setq processed_ix_lst (cons ix processed_ix_lst))
          ) )
          (setq ix (1+ ix))
        )
      )   </pre>
<p>6. When no more of the priority list to process, we need to push any un-referenced attribute definition chunks of data on to the new list (they are still alphabetized).</p>
<pre>      ; The new_attdef_lst should contain the ordered attributes that were specifically
      ; defined. Now add in any left-overs. These will go in alphabetically.
      (setq ix 0)
      (foreach rec attdef_lst
        (if (not (member ix processed_ix_lst))
          ; This entry not processed above. Go ahead and push it into the new list.
          <span style="color:#ff0000;">(setq new_attdef_lst (cons rec new_attdef_lst))</span>
        )
        (setq ix (1+ ix))
      )</pre>
<p>7.  That&#8217;s it. Our new ATTDEF blocks of data list is complete. But it&#8217;s in reverse order because we used the more efficient &#8220;cons&#8230;&#8221; function to build the new version of the list (instead of using the slower &#8220;append&#8230;&#8221; function). Reverse the list.</p>
<pre>      ; Now put the new_attdef_lst into the correct order (it is reversed due to
      ; using "(cons ...) to add elements to the beginning of the list instead of
      ; the end of the list)
      (setq new_attdef_lst (reverse new_attdef_lst))</pre>
<p>8. Now we cross our fingers. The utility erases ALL of the existing ATTDEF entities in the drawing&#8230;</p>
<pre>      ; Erase all existing ATTDEFS (!)
      <span style="color:#ff0000;">(command "_.ERASE" ss "")</span></pre>
<p>9. &#8230; and we then cycle through our new, re-ordered list of ATTDEF data and re-create each ATTDEF using calls to (entmake &#8230;) .</p>
<pre>      ; Now rewrite the ATTDEFs but using the new ordered list of ATTDEF blocks of
      ; data. Each ATTDEF should pop back in exactly as before, but the handle assignment
      ; given to each re-written ATTDEF will now be the next sequential for the
      ; drawing (!)
      (foreach rec new_attdef_lst
        (princ "\n")(princ (cdr (assoc 2 rec))) ; display attdef name to command window
        <span style="color:#ff0000;">(entmake rec)
</span>      )</pre>
<p> </p>
<p><strong>Full Utility</strong></p>
<p>Here&#8217;s the full utility. Cut and paste it into a file called reorder_attdef.lsp.</p>
<pre>; ----------  R E O R D E R _ A T T D E F . L S P  ---------------------
(defun c:reorder_attdef ( / attdef_lst ix slen ss en ed attdef_tag new_attdef_lst
                            processed_ix_lst rec orderlst sortorder_name x y)
                           
  ; Set up order list of ATTDEFS. Wild-cards are supported.     
  (setq orderlst (list "TAG1*,TAG2,TAGSTRIP,P_TAG1,P_TAGSTRIP"
                       "DESC1"
                       "DESC2"
                       "DESC3"
                       "RATING*"
                       "MFG"
                       "CAT"
                       "ASSYCODE"
                       "INST"
                       "LOC"
                       "FAMILY"
                       "TERM*"))
  ; Gather up selection set of all ATTDEFs on the active drawing
  (setq ss (ssget "_X" '((0 . "ATTDEF"))))
 
  (if (AND (/= ss nil)(&gt; (sslength ss) 1))
    (progn ; at least one ATTDEF found. Okay to continue.
      ; Extract all ATTDEF tag names and overall ATTDEF entity data. Save in parallel lists.     
      (setq attdef_lst nil) ; start with blank data list
      (setq slen (sslength ss)) ; number of ATTDEFs in selection set
      (setq ix 0) ; used to index through the selection list
      (while (&lt; ix slen)        
        (setq en (ssname ss ix)) ; get next ATTDEF entity name from selection set
        (setq ed (entget en)) ; open up this ATTDEF entity
        (setq attdef_lst (cons ed attdef_lst)) ; add its data to the big list
        (princ " ")(princ (cdr (assoc 2 ed))) ; display existing order in command window
        (setq ix (1+ ix)) ; increment index to get next ATTDEF entity from selection set
      )
     
      ; Initially sort the list alphabetically by tagname. The tagname is in the "2"
      ; part of the entity's data. Access the value by extracting with the
      ; (assoc 2 ...) function.
      (setq attdef_lst (vl-sort attdef_lst
            '(lambda (X Y) (&lt; (cdr (assoc 2 X)) (cdr (assoc 2 Y))))))
      ; Okay. So far, so good. We now have all ATTDEFs alphabetically sorted and held
      ; in a big data list called "attdef_lst".
           
      ; Now prepare to create a brand new ATTDEF list by pulling entries from the
      ; "attdef_lst" and pushing them into this new list in the desired order.
      (setq new_attdef_lst nil) ; Start with empty new list
      (setq processed_ix_lst nil) ; To be used for tracking what items have been
                                  ; pulled from alphabetized list into the new list.
     
      ; Process the ATTDEF tagnames against the desired order given in the "orderlst"
      (foreach sortorder_name orderlst
        (setq ix 0)
        (foreach rec attdef_lst
          (setq attdef_tag (cdr (assoc 2 rec))) ; extract ATTDEF tagname for this entry
          (if (AND (not (member ix processed_ix_lst)) ; check if already processed
                   (wcmatch attdef_tag sortorder_name)) ; check if tagname wild-card
                                      ; matches with the target sortordername string.
            (progn ; This ATTDEF name matches what we're looking for. Pull its data out
                   ; of the attdef_lst and push the entity's block of data into the
                   ; new "new_attdef_lst" ordered list.
              (setq new_attdef_lst (cons rec new_attdef_lst))
              ; Remember this entry's index number so won't try to add it in again
              (setq processed_ix_lst (cons ix processed_ix_lst))
          ) )
          (setq ix (1+ ix))
        )
      )   
     
      ; The new_attdef_lst should contain the ordered attributes that were specifically
      ; defined. Now add in any left-overs. These will go in alphabetically.
      (setq ix 0)
      (foreach rec attdef_lst
        (if (not (member ix processed_ix_lst))
          ; This entry not processed above. Go ahead and push it into the new list.
          (setq new_attdef_lst (cons rec new_attdef_lst))
        )
        (setq ix (1+ ix))
      )
      ; Now put the new_attdef_lst into the correct order (it is reversed due to
      ; using "(cons ...) to add elements to the beginning of the list instead of
      ; the end of the list)
      (setq new_attdef_lst (reverse new_attdef_lst))
     
      ; Erase all existing ATTDEFS (!)
      (command "_.ERASE" ss "")
     
      ; Now rewrite the ATTDEFs but using the new ordered list of ATTDEF blocks of
      ; data. Each ATTDEF should pop back in exactly as before, but the handle assignment
      ; given to each re-written ATTDEF will now be the next sequential for the
      ; drawing (!)
      (foreach rec new_attdef_lst
        (princ "\n")(princ (cdr (assoc 2 rec))) ; display attdef name to command window
        (entmake rec)
      )
  ) )
  (setq ss nil) ; release the selection set
  (princ)
)        
       </pre>
<p><strong>Let&#8217;s try it.</strong></p>
<p>With drawing VXF1D.dwg open on screen, APPLOAD the above utility file <em><strong>reorder_attdef.lsp</strong></em>.</p>
<p>Then type <strong>REORDER_ATTDEF</strong> <em>[Enter]</em> at the command prompt. In the blink of an eye, the utility should delete all ATTDEFs, sort, and re-write them. Save the symbol &#8220;.dwg&#8221;.</p>
<p>Now, in a fresh or purged drawing, insert this revised symbol. Cross fingers. Launch the attribute edit command, pick on the newly inserted transformer symbol&#8230;</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/autolisp006d.png"><img class="alignnone size-full wp-image-619" title="autolisp006d" src="http://nateholt.files.wordpress.com/2009/09/autolisp006d.png?w=682&#038;h=728" alt="autolisp006d" width="682" height="728" /></a></p>
<p>Good work! Now batch this tool against a <a href="http://nateholt.wordpress.com/2009/08/13/how-to-execute-a-lisp-function-all-dwgs-project-wide-autocad-electrical/">bunch of symbols </a>(make a backup first, just in case!). In short order your library should be modified.</p>
<p><strong>Advertisement</strong></p>
<p>Could some custom applications make your company more productive? Find out. <a href="http://n8consultants.com">http://n8consultants.com</a></p>
<p>U P D A T E :  I just noticed that the original program with &#8220;RATING*&#8221; would put RATING10, 11, and 12 right after RATING1 and before RATING2. Looks like my original attribute definition order list example should explicitly list all 12 &#8220;RATING*&#8221; tag names like this to avoid this problem:</p>
<pre>(setq orderlst (list "TAG1*,TAG2,TAGSTRIP,P_TAG1,P_TAGSTRIP"
                       "DESC1"
                       "DESC2"
                       "DESC3"
                       <span style="color:#ff0000;">"RATING1"
                       "RATING2"
                       "RATING3"
                       "RATING4"
                       "RATING5"
                       "RATING6"
                       "RATING7"
                       "RATING8"
                       "RATING9"
                       "RATING10"
                       "RATING11"
                       "RATING12"
</span>                       "MFG"
                       "CAT"
                       "ASSYCODE"
                       "INST"
                       "LOC"
                       "FAMILY"
                       "TERM*"))
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/612/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/612/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/612/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/612/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/612/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/612/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/612/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/612/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/612/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/612/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=612&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/09/26/nates-simple-autolisp-lesson-006/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp006a.png" medium="image">
			<media:title type="html">autolisp006a</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp006b.png" medium="image">
			<media:title type="html">autolisp006b</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp006c.png" medium="image">
			<media:title type="html">autolisp006c</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/autolisp006d.png" medium="image">
			<media:title type="html">autolisp006d</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Super&#8221; Project Manager utility &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/09/21/super-project-manager-utility-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/09/21/super-project-manager-utility-autocad-electrical/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 05:34:00 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=592</guid>
		<description><![CDATA[Tool to create and manage sub-projects within an overall &#8220;super&#8221; project set of AutoCAD Electrical drawings
Performance takes a hit when an AutoCAD Electrical project gets very large. Also, on large projects, a user sometimes needs the ability to divide the overall drawing set into separate document numbers.  They require that each different type of document (i.e. schematic, panel [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=592&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Tool to create and manage sub-projects within an overall &#8220;super&#8221; project set of AutoCAD Electrical drawings</strong></p>
<p>Performance takes a hit when an AutoCAD Electrical project gets very large. Also, on large projects, a user sometimes needs the ability to divide the overall drawing set into separate document numbers.  They require that each different type of document (i.e. schematic, panel layout, wire list, parts list) have a separate document number and title block information.  They want all drawings to be intelligently linked for design and editing but separated for title block update and page numbering.</p>
<p>There is a nifty way to <strong>manually</strong> split a project into more manageable or logically grouped sub-projects while still allowing ability to do overall project cross-referencing and reporting functions. This is described in detail in a posting made last month, link <a href="http://nateholt.wordpress.com/2009/08/12/multiple-projects-within-a-super-project-autocad-electrical/">here</a>.</p>
<p>This idea has resonated with some users including Nick Hall who has indicated that he has put together a VB program that can combine multiple subprojects into one &#8220;super&#8221; project (see note 2 at the end of the above link).</p>
<p><strong>Super Project Manager tool</strong></p>
<p>Here is another approach, an automated way to split out sub-projects. This is a manager tool that will take one big project and break it down into multiple, related sub-projects where each sub-project is a stand-alone AutoCAD Electrical project. This tool gives a listing of all drawings in the overall &#8220;super&#8221; project and lets you pick groups of drawings to move into sub-projects. Each new sub-project inherits the settings of the main super project. <strong>NOTE:</strong> the overall &#8220;super&#8221; project <strong>never changes</strong> - drawings in this overall project stay&#8230; the sub-projects just <em>reference</em> subsets of the drawings permanently held in the overall super project.</p>
<p>It seems to work pretty well.</p>
<p><strong>Example</strong></p>
<p>We&#8217;ll use the small, simple example give in the previous posting. Our overall project, PROJ-07, has just 29 drawings. But we want to create three sub-projects that each contain a sub-set of these 29 drawing references. This will give us the ability to either work on a small subset of the main project drawing set (a sub-project is marked as the &#8220;active&#8221; project) or instantly flip over to take the whole project drawing set into account (main project is flipped to be the &#8220;active&#8221; project).</p>
<p>We appload the new tool and then launch it by typing SPM at the &#8220;Command:&#8221; prompt. It checks for the current active project and pops this active project&#8217;s drawing list into the dialog shown below. If it detected any existing sub-projects tied to this main project, these would be listed in the lower display list.</p>
<p>All subprojects are identified by this tool by their file name&#8230;. &#8220;&lt;<strong><em>main_projectname</em></strong>&gt;<strong>[<em>subproj_name</em></strong><strong>].wdp</strong>&#8220;. None are found for this sample project &#8211; there is project file PROJ-07.wdp but there are no PROJ-07[xxx].wdp projects found in the same folder.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm01.png"><img class="alignnone size-full wp-image-594" title="spm01" src="http://nateholt.files.wordpress.com/2009/09/spm01.png?w=1024&#038;h=635" alt="spm01" width="1024" height="635" /></a></p>
<p><strong>Our first sub-project</strong></p>
<p>We want to reference six of these drawings in a small sub-project called &#8220;CELL01&#8243;. Highlight the drawings that you want to reference in this new sub-project. Hit the &#8220;Create a new sub-project&#8221; button. Enter &#8221;CELL01&#8243; as shown in the sub-dialog that pops up.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm02.png"><img class="alignnone size-full wp-image-595" title="spm02" src="http://nateholt.files.wordpress.com/2009/09/spm02.png?w=686&#038;h=613" alt="spm02" width="686" height="613" /></a></p>
<p>Hit OK to dismiss this &#8220;suffix code&#8221; sub-dialog.</p>
<p>The new sub-project reference goes into the first position of the sub-project listing. A &#8220;1&#8243; marks each drawing that is referenced in this first sub-project.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm03.png"><img class="alignnone size-full wp-image-596" title="spm03" src="http://nateholt.files.wordpress.com/2009/09/spm03.png?w=522&#038;h=605" alt="spm03" width="522" height="605" /></a></p>
<p><strong>Adding a 2nd sub-project</strong></p>
<p>Repeat the process. Let&#8217;s say we want drawings 001 through 006 to be referenced in a second sub-project. Repeat the above but type &#8220;CELL02&#8243; as a name for this new sub-project.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm04.png"><img class="alignnone size-full wp-image-597" title="spm04" src="http://nateholt.files.wordpress.com/2009/09/spm04.png?w=603&#038;h=623" alt="spm04" width="603" height="623" /></a></p>
<p><strong>A third sub-project</strong></p>
<p>And we repeat the above for the third sub-project, picking drawings 001, 002 and 010-014, and 019.</p>
<p>Here&#8217;s what our main dialog display now looks like (below). Note that each of the three sub-projects that we&#8217;ve defined show up in the bottom list box along with an &#8220;index&#8221; number. The upper dialog records which drawings have been referenced in each of the three sub-projects. Up to 9 sub-projects in one main project are supported by this tool.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm05a.png"><img class="alignnone size-full wp-image-601" title="spm05a" src="http://nateholt.files.wordpress.com/2009/09/spm05a.png?w=675&#038;h=608" alt="spm05a" width="675" height="608" /></a></p>
<p>Tools are there to add and remove drawing references from selected sub-project(s).</p>
<p>When all looks good, hit the &#8220;Save changes&#8221; button. The three new sub-projects are created. The main AutoCAD Electrical Project Manager window now displays the original, main &#8220;super&#8221; project and now three more sub-projects. Each sub-project is the same name as the main project but with a unique suffix shown in square brackets.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/spm06.png"><img class="alignnone size-full wp-image-599" title="spm06" src="http://nateholt.files.wordpress.com/2009/09/spm06.png?w=476&#038;h=647" alt="spm06" width="476" height="647" /></a></p>
<p>This Super Project Manager tool keys off of the square bracketed suffixes at the end of the project files names to automatically group all sub-projects together with a main &#8220;super&#8221; project. Seems to work well.</p>
<p>Touch base with Doug McAlexander <a href="mailto:ECADConsultant@aol.com">ECADConsultant@aol.com</a> if any interest in this cool tool.</p>
<p>U P D A T E:  short video demo of this tool is <a href="http://www.ecadconsultant.com/SPM_demo/SPM_demo.html">here</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/592/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=592&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/09/21/super-project-manager-utility-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm01.png" medium="image">
			<media:title type="html">spm01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm02.png" medium="image">
			<media:title type="html">spm02</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm03.png" medium="image">
			<media:title type="html">spm03</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm04.png" medium="image">
			<media:title type="html">spm04</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm05a.png" medium="image">
			<media:title type="html">spm05a</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/spm06.png" medium="image">
			<media:title type="html">spm06</media:title>
		</media:content>
	</item>
		<item>
		<title>Circuit Builder &#8211; leveraging AutoCAD&#8217;s &#8220;Group&#8221; concept &#8211; AutoCAD Electrical</title>
		<link>http://nateholt.wordpress.com/2009/09/10/circuit-builder-leveraging-autocads-group-concept-autocad-electrical/</link>
		<comments>http://nateholt.wordpress.com/2009/09/10/circuit-builder-leveraging-autocads-group-concept-autocad-electrical/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 13:12:09 +0000</pubDate>
		<dc:creator>nateholt</dc:creator>
				<category><![CDATA[AutoCAD Electrical]]></category>

		<guid isPermaLink="false">http://nateholt.wordpress.com/?p=584</guid>
		<description><![CDATA[AutoCAD&#8217;s &#8221;Group&#8221; concept for entity selection can be leveraged by Circuit Builder.
This was a cool idea. John Zwerlein, a long-time AutoCAD Electrical guru guy, asked me if Circuit Builder could somehow interact with existing entities on a drawing that carry specific AutoCAD &#8220;Group&#8221; name assignments. For example, when running Circuit Builder in its &#8220;Configure&#8221; circuit mode, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=584&subd=nateholt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>AutoCAD&#8217;s &#8221;Group&#8221; concept for entity selection can be leveraged by Circuit Builder.</strong></p>
<p>This was a cool idea. John Zwerlein, a long-time AutoCAD Electrical guru guy, asked me if Circuit Builder could somehow interact with existing entities on a drawing that carry specific AutoCAD &#8220;Group&#8221; name assignments. For example, when running Circuit Builder in its &#8220;Configure&#8221; circuit mode, could certain existing things be removed from the drawing is a given circuit option was selected? Hmm&#8230;</p>
<p>Tried it. Worked. Pretty cool.</p>
<p><strong>Here&#8217;s a simple example.</strong></p>
<p>Let&#8217;s say your drawing has a list of engineering notes in a column along the side of the drawing. Two of them are appropriate if the user selects a &#8220;full voltage&#8221; option, a different one is appropriate for the &#8220;with transformer&#8221; option, and none of the three are appropriate if the user selects a &#8220;None&#8221; option.</p>
<p>What we do is make sure each note carries a unique AutoCAD &#8220;GROUP&#8221; name. Let&#8217;s use names &#8220;NOTE1&#8243;, &#8220;NOTE2&#8243;, and &#8220;NOTE3&#8243;. You assign a group name to one or more entities by launching the AutoCAD &#8220;GROUP&#8221; command (type GROUP or _GROUP at the &#8220;Command:&#8221; prompt). Dialog pops up and you make it happen.</p>
<p>Now, your drawing engineering notes are set up with unique &#8220;group&#8221; names. Next step is to adjust the Circuit Builder spreadsheet &#8220;ace_circuit_builder.xls&#8221;. Open in Excel. If you have trouble finding this file, type this at the AutoCAD command prompt:  (c:ace_find_file &#8220;ace_circuit_builder.xls&#8221; 3) [Enter]. Go to the appropriate sheet. Here&#8217;s the &#8220;horizontal insertion&#8221; sheet showing the control transformer entries:</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/cb_group01.png"><img class="alignnone size-full wp-image-585" title="cb_group01" src="http://nateholt.files.wordpress.com/2009/09/cb_group01.png?w=1024&#038;h=334" alt="cb_group01" width="1024" height="334" /></a></p>
<p>What we want to do is carefully add in the stuff shown in red and yellow. For the red part, be very cautions. You need to enter the number zero but it needs to be interpreted by Excel as text, not as numeric. This means you should type in with a preceeding single quote, &#8216;0, instead of just the number zero. The value will appear left justfied in the cell. If it does not, fix it! This is important.</p>
<p>Here&#8217;s a close up.</p>
<p><a href="http://nateholt.files.wordpress.com/2009/09/cb_group021.png"><img class="alignnone size-full wp-image-587" title="cb_group02" src="http://nateholt.files.wordpress.com/2009/09/cb_group021.png?w=774&#038;h=306" alt="cb_group02" width="774" height="306" /></a></p>
<p>In operation&#8230; when the &#8220;None&#8221; option is selected, the string &#8220;(Command &#8220;_ERASE&#8221; &#8220;_GROUP&#8221; &#8220;NOTE*&#8221; &#8220;&#8221;)&#8221; is sent by Circuit Builder to AutoCAD&#8217;s command processor. All entities with wild-card group name &#8220;NOTE*&#8221; are selected and erased. If the &#8220;Control transformer&#8221; option is selected, then entities with group names &#8220;NOTE1&#8243; and &#8220;NOTE2&#8243; are erased. For full voltage option, only &#8220;Note3&#8243; is erased.</p>
<p>Pretty cool.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nateholt.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nateholt.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nateholt.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nateholt.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nateholt.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nateholt.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nateholt.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nateholt.wordpress.com/584/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nateholt.wordpress.com/584/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nateholt.wordpress.com/584/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nateholt.wordpress.com&blog=7856113&post=584&subd=nateholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://nateholt.wordpress.com/2009/09/10/circuit-builder-leveraging-autocads-group-concept-autocad-electrical/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4ce307a71203312e21d0821883622273?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">nateholt</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/cb_group01.png" medium="image">
			<media:title type="html">cb_group01</media:title>
		</media:content>

		<media:content url="http://nateholt.files.wordpress.com/2009/09/cb_group021.png" medium="image">
			<media:title type="html">cb_group02</media:title>
		</media:content>
	</item>
	</channel>
</rss>