Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extrusion height of a 3D solid in Autocad 2011

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
4254 Views, 10 Replies

Extrusion height of a 3D solid in Autocad 2011

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!Smiley Happy

 

 

 

10 REPLIES 10
Message 2 of 11
Hallex
in reply to: Anonymous

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))

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 11
Anonymous
in reply to: Hallex

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. Smiley Happy

 

Have a nice night!

Message 4 of 11
Hallex
in reply to: Anonymous

Marian, Glad I could help,
just a hint: try to set History in Properties to No or Yes
and try the same code again, I didnt test it
Cheers 🙂
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 5 of 11
Anonymous
in reply to: Hallex

I tested your solution and it's ok.

 

It's just what i wanted.

 

You are the best! Smiley Happy

 

Thank you very very much!

Message 6 of 11
Kent1Cooper
in reply to: Anonymous

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

Kent Cooper, AIA
Message 7 of 11
Anonymous
in reply to: Kent1Cooper

Kent1Cooper thank you so much for your answer!

 

This is another good solution for my problem.

 

Thank you all!

Message 8 of 11
Anonymous
in reply to: Hallex

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?

Message 9 of 11
Anonymous
in reply to: Anonymous

Please send me the extrusion lisp file..

Message 10 of 11
Anonymous
in reply to: Anonymous

Hi everybody!

where is the complete lisp? can anybody upload it for common use


Message 11 of 11
Anonymous
in reply to: Kent1Cooper

could I get the lisp file for this or post it please?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report