-
Coinciding with the acquisition of VIA Development, Nate joined Autodesk in March of 2003 after a decade stint as an entrepreneur following a two-decade stint as a controls engineer and software applications developer at Owens-Corning. Nate is now the lead product architect for AutoCAD Electrical. He loves this stuff.
-
Customizing Project Manager window - AutoCAD Electrical
November 13, 2008 06:15 PMby Nate HoltUser email waiting in my in-box this morning... which triggers this follow-up to the "super project" work-around idea presented a couple days ago. User's question: how to get the special drawing + "cell code" value into the project manager pick list as illustrated in that posting?
The last posting dealt with a work-around to break a huge (i.e. slow) project into smaller electrical drawing subsets that can be worked on, for the most part, as independent AutoCAD Electrical projects (link here)
mfgcommunity.autodesk.com/blogs/blog/view/7/Processing_Multiple_Sub-Projects/
How to display extra information for each drawing listed in the Project Manager:
1. Pick on this button in Project Manager window (next to last button shown in the button row below).

2. Displays the “Drawing List Display Configuration” dialog. Move the “Installation Code” value over into the right-hand window. Hit OK.

3. Make sure each drawing’s “Drawing Properties” dialog has an “Installation Code:” defined. There is an edit box for this, shown below. You could use some other box if you would like for this. Here we just chose the “Installation” code which assumes that this assignment will be “common” for all drawings for a given “CELL” which are grouped together into one of the smaller, independent sub-projects.

4. Once you enter in the Installation value for each drawing, you should see this show up next to the drawing file name listed in the Project Manager window.

-
Processing Multiple Sub-Projects - AutoCAD Electrical
November 11, 2008 01:43 PMby Nate HoltPerformance takes a hit when an AutoCAD Electrical project gets very large. Here's a way to split a project into more manageable sub-projects while still allowing ability to do overall project cross-referencing and reporting functions.
Let's say you have an electrical design project consisting of three manufacturing cells. Each cell could pretty much be its own "project". But there is a small amount of interconnection between the cells. And there is a need for overall cross-referencing and full BOM reporting over the whole project. For the most part, each manufacturing cell will be worked on by its own team using AutoCAD Electrical.
Instead of having a single project of a thousand drawings, it would be nice to split this into three smaller sub-projects that can be worked on independently. Then, when necessary, be able to process all three sub-projects as a single project.
There is a work-around to accomplish this. Here's how.
1. Create all three sub-project files (the ".wdp" ascii text files) in a common folder.
2. Create a new fourth project in this common folder. This extra project will be the overall "super" project and will list ALL of the drawings that are listed in the three sub-projects.
3. Work in a sub-project. But when need to do an overall "super-project-wide" operation, temporarily make the "super" project the active project. Do the project-wide operation(s). Then flip your original sub-project to be the "active" project again.
Simple Example
We'll just use three small sub-projects containing 10 or fewer drawings each to illustrate how this might work.
Setup
We create an overall folder for our project, "PROJ-07". In this folder we create three sub-projects, "PROJ-07-CELL01" through "PROJ-07-CELL03". Each sub-project's drawings are stored in a separate subfolder (not required but necessary if drawing names are going to be repeated!).
We create an overall "super" project, "PROJ-07-ALL" as well. It does not have any unique drawings in it. It just references all of the drawings already referenced in all three of the sub-projects.

Here are the drawings in PROJ-07-CELL01:

... and here are the drawings in the sub-projects for CELL02 and CELL03:

Now, with all four projects set up (three sub-projects and the one "super" project), we list all four in the AutoCAD Electrical Project Manager window:

Here is what it looks like with all four projects "expanded" to show their drawings:

In Operation
Let's say you've been assigned to work on CELL02 and you're currently working on drawing 004.dwg in the CELL02 project. You suddenly have the need to insert an interlock relay contact and cross-reference it... but it is tied to a relay coil that is somewhere in one of the other two sub-projects.
Just temporarily flip the active project to the overall "super" project...

... and do your project-wide operations. Then flip back to the CELL02 project as the "active" project.
That's it.
Creating the overall "super" project is probably the most tedious part of this whole work-around. You need to include each sub-project's drawing list. But there is a quick way to do it...
1. Set up your sub-projects with their drawings listed.2. Create an empty overall super project.3. Open this overall project's ".wdp" file with an ASCII text editor like wordpad.exe. Scroll to the end of the file.4. Open each of the sub-project ".wdp" files with an ASCII text editor. Cut and paste the list of drawings found in the bottom section of each of these ".wdp" files into the bottom of the overall project wdp file.5. Save the modified overall project ".wdp" file. That's it. It should work. -
Boosting AutoLISP Performance
November 7, 2008 09:25 PMby Nate HoltI learned this the hard way... and am happy to share it now.
CONS versus APPEND
The cons function adds an element to the beginning of a list. The append function can be used to give the equivalent of adding an element to the beginning or end of a list.
Using the cons function can be MUCH faster than using append to build up a large list.
We'll run two tests to create a dummy list of 10,000 integer numbers. The first test is using the "cons" function. Appload and type test1 [enter] at the command prompt.
(defun c:test1 ( / )
(setq i 1)
(setq lst nil) ; start out with a blank list
(repeat 10000
(setq lst (cons i lst)) ; add next element to beginning of list
(setq i (1+ i))
)
(setq lst (reverse lst)) ; put list back into correct order
(princ)
)The second test yields the same result but uses the "append" function:
(defun c:test2 ( / )
(setq i 1)
(setq lst nil) ; start out with a blank list
(repeat 10000
(setq lst (append lst (list i))) ; append next element on to end of list
(setq i (1+ i))
)
(princ)
)The first test using "cons" builds the 10,000 element list in memory in less than 0.01 seconds (on my average notebook).The second test using "append" builds the exact same 10,000 element list in memory but takes a full 3.55 seconds to execute ( ! ). Dealing with large lists, it appears that the "cons" function is many, many times faster.
FOREACH versus NTH
Let's say you need to cycle through a huge list, one list element at a time. There are two different functions that can cycle through a list, "foreach" and "nth" combined with a "while" loop. When dealing with a very large list, the "foreach" function can be much faster than using a while loop / nth function to index through the list.
These tests use the 10,000 element list held in memory created be either of the above two tests. This next test uses "foreach" to cycle through the 10,000 element list.
(defun c:test3 ( / )
; use 10,000 element "lst" created by test1 or test2
(setq find_int (getint "\nFind integer="))
(setq foundit nil)
(foreach x lst
(if (AND (not foundit) (= x find_int))
(progn
(setq foundit T)
(princ " found")
) )
)
(princ)
)This next test does the same thing but uses a "while" loop and the "nth" function to index its way through the 10,000 element list:
(defun c:test4 ( / )
; use 10,000 element "lst" created by test1 or test2
(setq find_int (getint "\nFind integer="))
(setq foundit nil)
(setq ix 0)
(setq slen (length lst))
(while (AND (not foundit)(< ix slen))
(if (= (nth ix lst) find_int) ; look for match
(progn ; Found the target element
(setq foundit T)
(princ " found")
) )
(setq ix (1+ ix))
)
(princ)
)For the test, looking for integer value 5000 (halfway into the list). The "foreach" function finds and exits in less than 0.01 second. The while loop using the "nth" function finds and exits in 0.07 seconds. Using foreach is significantly faster in processing this large list.
[UPDATE: here's another...]
MEMBER versus WHILE / NTH
Let's say you have two very large, parallel lists. You need to search the first list, "lst", for a specific element. If found, then go to the parallel list "lst2" and pull out the associated value.
In the first test, we'll just use a "while" loop and pull out each item from the first "lst" and look for a match. We'll track where we are by incrementing an index counter "ix". When match found then we will use "nth ix" to get the value from the parallel list.
(defun c:test5 ( / )
; "lst" = first list to search
; "lst2" = parallel data list
(setq find (getstring " first list element ="))
(setq ix 0)
(setq foundit nil)
(setq slen (length lst))
(while (AND (not foundit) (< ix slen))
(if (= (nth ix lst) find)
(progn ; found target element in "lst" list
(setq foundit T)
(setq parallel_val (nth ix lst2)) ; pull out of parallel list
(princ " found=")
(princ parallel_val)
) )
(setq ix (1+ ix)) ; increment index
)
(princ)
)The alternative is to use the "member" function to search a list for the first occurance of a given element. Here is the same funtion using "member" instead of a while loop to find and pull out the data from the parallel list:
(defun c:test6 ( / )
; "lst" = first list to search
; "lst2" = parallel data list
(setq find (getstring " first list element ="))
(if (setq x (member find_int lst))
(progn ; found target element in "lst" list
; Pull out value from same position in
; the parallel "lst2" list
(setq parallel_val (nth (- (length lst)(length x)) lst2))
(princ " found=")
(princ parallel_val)
)
)
(princ)
)For test5 on a set of 10000 element lists, the average search and return time was 0.11 seconds on my machine. For the exact same result using the "member" function in test6, the time was 0.0 seconds - not measurable on my machine. Significant improvement!