I thought this would be a simple task for me, but apparently not. I need some help with mirroring an attribute. When I insert the neutral wire numbers it inserts on the wrong side of the ladder. Here is my logical steps to solve this problem.
1. Select all "WD_WCH" blocks
2. Get attribute "WIRECOPY"
3. Get attribute's insertion point
4. If the x = 6.63 or 13.63 then mirror block
I started FlipNum, but AutoCAD chokes on the "vla-get-insertionpoint" for the attribute. I've been flipping through the help manuals, but I'm getting lost.
Any suggestions?
[color=blue](defun FlipNum (/ ss i ent obj attributes x y)
(vl-load-com)
(setq ss (ssget "X" '((0 . "INSERT") (2 . "WD_WCH")))
i -1)
(if ss
(while (setq ent (ssname ss (setq i (1+ i))))
(setq x (cadr (assoc 10 (entget ent)))
y (caddr (assoc 10 (entget ent))))
(if (and
(setq obj (vlax-ename->vla-object ent))
(= (vla-get-objectname obj) "AcDbBlockReference")
(= (vla-get-hasattributes obj) :vlax-true)
)
(progn
(setq attributes (vlax-invoke obj 'getattributes))
(foreach att attributes
(if (= "WIRECOPY" (vla-get-tagstring att))
(if (or
(= (cadr (vla-get-insertionpoint att)) 6.63)
(= (cadr (vla-get-insertionpoint att)) 13.63)
)
(progn
(vla-mirror att (x , y), (0 , 90))
(vla-delete)
) ;progn
) ;if
) ;if
) ;foreach
) ;progn
) ;if
) ;while
) ;if
) ;close function[/color]