TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on April 16, 2014, 08:13:07 AM
-
This part of code
(while T
(setq p1 (getpoint "\nPick Point inside shape"))
(vl-cmdf "_.-boundary" "_A" "_I" "_N" "" "_O" "_R" "" "_non" p1 "")
(setq obj (vlax-ename->vla-object (entlast)))
(setq cent (vlax-safearray->list (vlax-variant-value (vla-get-centroid obj))))
(vl-cmdf "POINT" (trans cent 1 0))
(vla-delete obj)
)
Working perfect but Gives Error
error: ActiveX Server returned the error: unknown name: Centroid
-
Remove the Symbol T that is in front of the while function .
-
Remove the Symbol T that is in front of the while function .
Perfect,
Thanks Tharwat
-
You're welcome anytime .
-
HasanCad,
In addition to Tharwat's suggestion, you will get this error when
the boundary command cannot find a closed boundaries.
So the error message you are seeing is telling you that
there is no closed boundaries around the point you have chosen,
therefore no centroid.
In other word obj does not exist.
ymg
-
Consider this...
(while (setq p1 (getpoint "\nPick Point inside shape"))
(setq obj (entlast))
(vl-cmdf "_.-boundary" "_A" "_I" "_N" "" "_O" "_R" "" "_non" p1 "")
(if (not (equal obj (setq obj (entlast))))
(progn (vl-cmdf "_.point" "_non" (trans (vlax-get (setq obj (vlax-ename->vla-object obj)) 'Centroid) 1 0))
(vla-delete obj)
)
(princ "\nCentroid could not be determined.")
)
)
-
Thnaks ymg
good trick alanjt
-
Thnaks ymg
good trick alanjt
:-)