-
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.
-
Reorient Wire Color/Ga Labels - AutoCAD Electrical
February 16, 2009, 02:46 PM 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...!
You must be logged in to post a comment.