-
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.
-
Blogging about AutoCAD Electrical 2010
February 18, 2009 08:26 PMby Nate HoltHere are links to two more AutoCAD Electrical blogs: Rob Stein and Autodesk's Jared Bunch! Rob hopes to blog extensively on the new AutoCAD Electrical 2010 in the coming weeks...
Robert Stein: www.robertstein.blogspot.com/
Jared Bunch: gotcontrols.blogspot.com/
-
Adjusting the 'Jag' in split-lines of PLC I/O modules - AutoCAD Electrical
February 18, 2009 03:32 PMby Nate HoltSplitting a PLC I/O module or a parametric connector automatically triggers AutoCAD electrical to draw a jagged break line at the split point. If seem too "jaggedy", you can do something about it.
Here we've split a PLC I/O module and the jagged line pierces the PLC tag. We could grip this attribute and move it down and solve the problem. But maybe we'd just as soon have the jagged line a bit more mellow.

AutoCAD Electrical has a Lisp global variable that can be set up to override the hard-coded values used for jagged break calculations.
The global variable name is GBL_wd_break_parameters and it is set up as a list of two numbers:
1. The first gives the ratio of the jagged break gap distance to the total module width distance - it needs to be less than 1.0 and greater than 0.0.
2. The second number is the "jag" angle value in degrees.
When this global is not defined (the default state of AutoCAD Electrical), it defaults to a list value of '( 0.8 60.0) meaning that the jag gap consumes 20% of the total width and the jag angles up at 60 degrees. The break in the illustration above represents this AutoCAD Electrical default.
A more gentle Jag
Try this. At the AutoCAD Electrical command line prompt, type this:
Command: (setq GBL_wd_break_parameters '(0.9 40.0)) [Enter]
Now insert and break a PLC I/O module with this global override in place.

That works. No problem with the jagged line hitting the tag attribute. To turn this off and go back to the hard-coded defaults, just set the global back to a value of nil:
Command: (setq GBL_wd_break_parameters nil) [Enter]
How to make this setting permanent
So, how to automatically set this global variable whenever we start up AutoCAD Electrical? There are multiple ways to do this. You could add it to the ".mnu" file or push it into AutoCAD Electrical's wd_load.lsp initialization file or encode it into the "cui" file so that whenever you pick on the INS PLC command it first executes this Lisp expression to set the global.
Here's another way... set it up in the AutoCAD Electrical "wd.env" environment file.
Setting a global from the wd.env settings file
The wd.env file is an ASCII text file hidden away in some obscure path. One way to find it is to do this.
1. Start AutoCAD Electrical
2. At the Command: prompt type this: (c:ace_find_file "wd.env" 3) [Enter]. It should return the full path to the file.
3. Exit AutoCAD Electrical
4. MAKE BACKUP of wd.env !!!
5. Open with text editor. Add the highlighted line shown below to the end of the file. Save. Restart. Test.
...
*SETQ:GBL_wd_xref_mtext_pinsize,"0.67",ratio pin/reference text size
*SETQ:GBL_wd_wnum_noduplicate_chk,'("GND" "24VDC" "COM")
*SETQ:GBL_wd_colga_leaderlay,"SYMS"
*SETQ:GBL_wd_colga_textlay,"MISC"
SETQ:GBL_wd_break_parameters,'(0.9 40.0), distance ratio/angle for jagged "break" lines -
Flipping Form-C Contact Pin Assignments - AutoCAD Electrical
February 18, 2009 10:14 AMby Nate HoltThis issue seems to pop up when creating a form-C contact arrangement out of two separate N.O. / N.C. relay contact symbols from one of the JIC libraries. The pin assignment can come in reversed from what is expected. In this example, pin 12 is the "common" pin of the form-c contact arrangement. But the N.C. contact received the "12" assignment on the right-hand TERM02 attribute instead of the left-hand TERM01 attribute.

Here's a little clean-up utility that may help clean up these two-contact combos. Download here and rename it to form_c_pins.lsp.
files/24401_24500/24491/file_24491.lsp
To use, make sure the project is active and the target drawing is displayed. "APPLOAD" the "form_c_pins.lsp" file and then type this at your "Command:" prompt:
FORM_C_PINS [Enter]
What this little AutoLISP program does is query the project's scratch database PINLIST table to gather up all pin list information for all parent components found in the project. Then it scans through the child contacts on the active drawing. For each child that matches up with a parent found in the PINLIST table, it confirms that the child contact's TERM01 gets the "common" pin assignment for the form-C pair. Note: if the contact carries attribute COMMON with a value of "02", then TERM02 will be treated as the "common" pin of the contact.
Right now, this utility processes all contacts on the active drawing. If you want to adjust the program to be more selective, open up form_c_pins.lsp with an ASCII text editor or with the built-in Visual Lisp editor in AutoCAD. Find this highlighted line in the file:
(if formc_lst
(progn ; have some Form-C data from the project scratch database table PINLIST.
; OK to process dwg, look for contacts with CONTACT attribute, check
; for match on the form-C tags.
(setq ss (ssget "_X" '((0 . "INSERT"))))
(if (/= ss nil)
(progn
(setq slen (sslength ss))Change it to this...
(setq ss (ssget '((0 . "INSERT"))))
...and save the file and re-APPLOAD it. Now it will only process the contacts that you select.
-
Reorient Wire Color/Ga Labels - AutoCAD Electrical
February 16, 2009 02:46 PMby Nate HoltSometimes the default horizontal orientation of wire color/gauge labels just doesn't "fit".
The label for the middle phase overlays another. Would be nice if we could easily flip this middle wire color/gauge label and leader to vertical orientation.

Like this:

Theory (you can skip this)
This should be a simple task. The text part of this leader is an MTEXT entity. Take a look at its contents by typing this at the AutoCAD "Command:" prompt:
(entget (car (entsel))) [Enter]
Command:
Command: (entget (car (entsel))) [Enter]
Select object: ((-1 . <Entity name: 7ee8db28>) (0 . "MTEXT") (5 . "D9D") (102 .
"{ACAD_REACTORS") (330 . <Entity name: 7ee8db20>) (330 . <Entity name:
7ee8db30>) (102 . "}") (330 . <Entity name: 7ee92c10>) (100 . "AcDbEntity") (67
. 0) (410 . "Model") (8 . "MISC") (100 . "AcDbMText") (10 179.964 183.175 0.0)
(40 . 4.0) (41 . 0.0) (46 . 0.0) (71 . 4) (72 . 1) (1 . "\\A1;BLK_1.5MM^2") (7
. "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0) (42 . 38.6667) (43 . 4.66667)
(50 . 0.0) (73 . 1) (44 . 1.0))Command:
So, how to decode this? Go to the AutoCAD on-line help...

So, the subrecord within this cryptic dump of the MTEXT entity that controls the overall rotation of the entity is the "50" entry, displayed in the dumped data as "(50 0.0)". This means that the rotation angle is "0.0" or horizontal. All we need to do is force a rotation value into this subrecord of the entity and then force the entity to update.
Here's a simple AutoLISP utility that will flip a selected label through 90 degree rotation increments by forcing new values into the "50" subrecord of the MTEXT entity:

A key point to deal with here is the angle value is not in degrees but in "radians". Instead of 360 degrees in a complete rotation, there are 2 pi radians in a complete rotation, or 2 X 3.14 = 6.28 radians = 360 degrees.
In the Lisp program above, the "pi" is automatically set to this 3.14159... value. You'll see it show up about half way through as we calculate how many radians = 90 degrees (the answer is half a pie!).
Try It Here
Download the above here: files/24401_24500/24401/file_24401.lsp and rename it something like R90.LSP. Appload it and give it a try...!