Hello to all,
I use Autocad 2011 and i want to get the extrusion height of a 3D solid that is made with extrude command in the front view (in 2D not in 3D, like i make one rectangle in front view and i extrude this rectangle with any value of extrusion height. After this extrusion the extrude rectangle ramains in that position [in front view] in 2D not 3D)
Is this possible in Autocad 2011?
I try this way, but it did not work:
(setq ename-solid (car (entsel "\nSelect object: ")))
(setq vlaobject-solid (vlax-ename->vla-object ename-solid))
(vlax-get-property vlaobject-solid 'height) or (vlax-get-property vlaobject-solid 'extrusionheight)
What name of property can i put instead to the red word of this syntax (vlax-get-property vlaobject-solid 'height), that in final to get (to extract) the extrusion height of a solid?
In Autocad 2012 or greater is available this function with this syntax (getpropertyvalue object "property") (ex: getpropertyvalue (entlast) "height") but i want to get the same result in Autocad 2011.
Can anyone help me to find the way to obtain that result in Autocad 2011?
I want to thank all who try to help me in this problem.
Have a nice day!
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Solved by Hallex. Go to Solution.
Hi marian, welcome on board
If solidtype is extrusion I would use code like this,
because of there is no vla-methods to calculate the height:
(setq solent (entsel "\nSelect solid : ")) (setq slist (entget (car solent))) (setq extvector (cdr (assoc 10 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (cdr (assoc 350 slist)))))))))))) (setq extHeight (sqrt (apply '+(mapcar '* extvector extvector)))) (alert (vl-princ-to-string extHeight))
Hallex thank you very much for your help!
You solve the problem very well and very quickly!
I am glad to be here and to see people who really want to help each other and to do good things.
I wish you all the best, and i want to know you that you make me very happy because you give me this solution.
Have a nice night!
Given the description as an extrusion of a rectangle, you could also get the object's bounding box:
(vla-getboundingbox (vlax-ename->vla-object SolidEntityName) 'minpt 'maxpt)
(setq
LL (vlax-safearray->list minpt)
UR (vlax-safearray->list maxpt)
)
and since the LL and UR are 3D points, calculate the difference in whichever is the appropriate coordinate for your use:
(- (car UR) (car LL)) ; for the object's extent in the X direction
(- (cadr UR) (cadr LL)) ; in the Y direction
(- (caddr UR) (caddr LL)) ; in the Z direction
Kent1Cooper thank you so much for your answer!
This is another good solution for my problem.
Thank you all!
I need something similar that will work on multiple solids (box or extrusion) to make a list or table of all the solid heights.
This would be used to create a cut schedule of all metal tubes in a metal frame assembly.
Would this be posible?
Can't find what you're looking for? Ask the community or share your knowledge.