Getting Point Number/Elevation/Description
This is using point blocks from the survey add on "Mapworks". I'm very close here but can't seem to get the last part right. If I use this code, and click on a point block ...
(defun c:RetrieveAttributes ( / )
(setq ent (cdr (assoc -1 (entget (car (Entsel))))))
(foreach Att (vlax-invoke
(vlax-ename->vla-object Ent)
'GetAttributes
) ;_ end of vlax-invoke
(if (= (strcase (vla-get-TagString Att)) "DESCRIPTION")
(setq tmpList (cons Att (vla-get-TextString Att)))
) ;_ endif
) ;end foreach
(princ "\n")
(princ tmpList)
)
I get ...
(#{VLA-OBJECT IAcadAttributeReference 00000000842C2A40} . tp)
**** I had to edit the output ... replaced the greater/less than signs brackets so it would show correctly here.
All I want is the "tp" in this example. I can run the same code using "POINT" and "ELEVATION" in place of "DESCRIPTION", so I'm set there, I just need to clean up what's returned to the actual point description "tp".
(defun c:RetrieveAttributes ( / )
(setq ent (cdr (assoc -1 (entget (car (Entsel))))))
(foreach Att (vlax-invoke
(vlax-ename->vla-object Ent)
'GetAttributes
) ;_ end of vlax-invoke
(if (= (strcase (vla-get-TagString Att)) "DESCRIPTION")
(setq tmpList (cons Att (vla-get-TextString Att)))
) ;_ endif
) ;end foreach
(princ "\n")
(princ tmpList)
)
I get ...
(#{VLA-OBJECT IAcadAttributeReference 00000000842C2A40} . tp)
**** I had to edit the output ... replaced the greater/less than signs brackets so it would show correctly here.
All I want is the "tp" in this example. I can run the same code using "POINT" and "ELEVATION" in place of "DESCRIPTION", so I'm set there, I just need to clean up what's returned to the actual point description "tp".
0
Comments
-
Figured it out ... had to change the 8th line to ...
(setq tmpList (vla-get-TextString Att))0 -
Also
(setq ent (cdr (assoc -1 (entget (car (Entsel))))))
(setq ent (car (Entsel "\nPick block "))) ; cadr is the pick point.
Why not
(setq ent (vlax-ename->vla-object (car (Entsel "\nPick block ")))
(foreach Att (vlax-invoke Ent 'GetAttributes )
The other thing is can use ssget and check hasattributes I think dxf code (66 . 1) means attributes, the other is
(if (vlax-property-available-p obj "hasattributes")0