Jump to content

Extract extrusion height of 3d solids


Recommended Posts

Posted

I have a solid profile extruded to different heights in the model space. Is there a way to extract the heights of these solids in the form of list or excel, similar to using data extraction?

 

 

Posted

(vlax-dump-object solid t) there's no related extrusion property.

 

just $0.02 i might be wrong,

vla-get-volume divided by area = height

maybe temporary explode, compare the lowest & higher contour elevations?

after getting data then undo?

 

 

 

Posted

If the top and bottom faces of a solid are parallel to the XY plane of the WCS you can used its boundingbox to calculate its height.

Posted

: MASSPROP
Select entities: 
Entities in set: 1
Select entities:  ----------------   SOLIDS    ---------------- 

                    Mass:  24449.8172
                  Volume:  24449.8172
            Bounding Box:  
             Lower Bound:  X=   -57.4763  Y=   43.5237  Z=   0.0000
             Upper Bound:  X=   -32.5237  Y=   68.4763  Z=   50.0000
                Centroid:  X=   -44.9999  Y=   56.0000  Z=   25.0000
 

Posted

If the solids are made using extrude command, with a height, not path, then you can extract the height like this:

(defun c:test ( / e solid)
  (while
    (and
      (setq e (car (entsel)))
      (setq e (cdr (assoc 350 (entget e))))
      (eq (cdr (assoc 0 (setq e (entget e)))) "ACSH_HISTORY_CLASS")
      (setq e (cdr (assoc 360 e)))
      (eq (cdr (assoc 0 (setq e (entget e)))) "ACAD_EVALUATION_GRAPH")
      (setq e (cdr (assoc 360 e)))
      (setq e (entget e))
      (setq solid (cdr (assoc 0 e)))
    )
    (cond
      ((eq solid "ACSH_EXTRUSION_CLASS")
       (princ (strcat "\nExtrusion Height: " (rtos (distance '(0 0 0) (cdr (assoc 10 e))))))
      )
      ((eq solid "ACSH_BOX_CLASS")
       (princ (strcat "\nBox Height: " (rtos (cdr (assoc 42 (reverse e))))))
      )
      ((eq solid "ACSH_CYLINDER_CLASS")
       (princ (strcat "\nCylinder Height: " (rtos (cdr (assoc 40 (reverse e))))))
      )
      (T
       (princ "\nUnable to extract solid height.")
      )
    )
  )
  (princ)
)

Doesn't work on edited solids, or modified by a boolean operation. Still, if the section of the solid (section perpendicular to extrusion direction) is a circle or a rectangle, you can find the height with some calculation over the geometric properties.

  • Like 2
  • 3 years later...
Posted

Thanks to Lee Mac, just what I needed for a sub routine for 3D Bolts and subtracting the cylindrical holes from the 3D Objects selected. - Red in Oklahoma 

Posted
22 hours ago, CetmeOnFire said:

Thanks to Lee Mac, just what I needed for a sub routine for 3D Bolts and subtracting the cylindrical holes from the 3D Objects selected. - Red in Oklahoma 

@CetmeOnFire And what was that? What code did Mr. Lee Mac provide? Just Curious...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...