-
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.
-
Parametric Connectors in AutoCAD Electrical - presetting defaults
October 23, 2008, 08:51 AM Nate HoltThese things are pretty cool. For one, they can auto-adjust to underlying wire spacing. Here's the opening dialog. Set various parameters for the desired "smart" connector and then...

... position on the first wire connection...

... and mouse click. The connector pin connections align with the underlying wiring. Any extra pins go in at the "pin spacing" value set on the initial dialog.

But on start-up, the initial design parameters come up as either of two sets of hard-coded presets - one set if the drawing appears to be in metric units and a different set if inch/imperial units. You then make your adjustments in the opening dialog - and these are "remembered" for the remainder of your AutoCAD Electrical session... but reset when you restart AutoCAD Electrical.
How can I quickly preset these start-up defaults?
Here's how
These defaults are pushed into a Lisp global called GBL_wd_connector_config_dlg_data. If you preset this global with your desired set of default values, then the dialog will pop up with these pre-populated settings!
Let's try it. Here is the opening dialog on a drawing in metric units. It is pre-populated with the program's hard-coded defaults for a drawing that appears to be in metric units:

Cancel out and then type this at the command line to view the value of the target global:
Command: !gbl_wd_connector_config_dlg_data [Enter]
(1 4 2 2 1 0 0 1 1 40.0 6.0 6.0 6.0 6.0 3.0 4 ("1") 0 0)
Command:So, the above gives the program's hard-coded defaults.
Now let's say you want to have this dialog initially pop up with 50.0 pin spacing and 5.0 for the four "size" values and 2.5 for the "Radius:" value.
How do we figure out what this cryptic global should look like to give this result? Restart the command, display the dialog, and manually enter in these desired values. Insert a connector and then cancel out. Now redisplay the value held in the global:
Command: !gbl_wd_connector_config_dlg_data [Enter]
(1 4 2 2 1 0 0 1 1 50.0 5.0 5.0 5.0 5.0 2.5 4 ("1") 0 0)
Command:So, there it is. If we can somehow preset Lisp global with a value of '(1 4 2 2 1 0 0 1 1 50.0 5.0 5.0 5.0 5.0 2.5 4 ("1") 0 0), then the first time the Insert Connector dialog appears, it will carry all of our desired defaults ( ! ).
Presetting the Lisp global
Basically we just need to figure out a way to execute this lisp expression (when we're working on a metric drawing):
(setq GBL_wd_connector_config_dlg_data '(1 4 2 2 1 0 0 1 1 50.0 5.0 5.0 5.0 5.0 2.5 4 ("1") 0 0))
You would have an similar one for inch/imperial unit drawings.So, how to execute the appropriate metric or inch Lisp expression? There are multiple ways to execute an expression: 1) a one-line script file, 2) add button to the toolbar or pull-down menu, 3) create a tiny AutoLisp program, 4) ??
If you are ALWAYS going to work in metric, you could even set this up in the acaddoc.lsp file or the ".mnl" file or even in AutoCAD Electrical's wd.env file. The wd.env file implementation would look like this (new line at the very end of the file):
*SETQ:GBL_wd_wnum_noduplicate_chk,'("GND" "24VDC" "COM")
*SETQ:GBL_wd_colga_leaderlay,"SYMS"
*SETQ:GBL_wd_colga_textlay,"MISC"
SETQ: GBL_wd_connector_config_dlg_data,'(1 4 2 2 1 0 0 1 1 50.0 5.0 5.0 5.0 5.0 2.5 4 ("1") 0 0)Reference information - here's the breakdown of the global
Example using metric default:
1 ; connector type 1=plug/jack one block, 2=double, 4=plug only, 8=jackonly4 ; showpins 0=hide single, 1=show single, 2=both, 4=plug, 8=jack, 16=hide bothorientation ; orientation 1=vert, 2=horiz2 ; 1=plug right or top, 2=plug left or bottom1 ; divider line 1=yes, 0=no0 ; (5) wire change, 1 block0 ; (6) wire change, 2 blocks1 ; (7) pin spacing mode 1=fixed, 2=wire crossings1 ; (8) insert all pins 1=all, 2=allow spacers/breaksrungdist ; (9) pin spacing6.0 ; (10) jack side offset6.0 ; (11) plug side offset6.0 ; (12) top offset6.0 ; (13) bottom offset3.0 ; (14) plug rounded corner fillet radius4 ; (15) pin count(list "1") ; (16) pin list (list of strings)0 ; (17) start as child0 ; (18) start with break 1=Y, 0=N
You must be logged in to post a comment.