Jump to content

Extract extrusion height of 3d solids


PrimeTimeAction

Recommended Posts

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?

 

 

Link to comment
Share on other sites

(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?

 

 

 

Link to comment
Share on other sites

: 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
 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 3 years later...

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 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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