Jump to content

Solid thickness


jan_ek

Recommended Posts

I tried this solution, I also tried creating a cuboid and creating a common part.

Both solutions are very slow. I have to do several hundred thousand checks

Link to comment
Share on other sites

Maybe the solution would be to xplode the solid and check the distance between two regions (surfaces and angled regions are a potential problem). Anyone has an idea how this could be done ?

 

Edited by jan_ek
Link to comment
Share on other sites

19 hours ago, jan_ek said:

Maybe the solution would be to xplode the solid and check the distance between two regions (surfaces and angled regions are a potential problem). Anyone has an idea how this could be done ?

 

If you explode the solid.  This will give you the width and depth from top view of what ever you have selected. These are 3d points so it doesn't matter what view you select entity's in.

 

 

 

 

;;----------------------------------------------------------------------------;;
;; MEASUREMENTS OF BOUNDING BOX
(defun C:BBD (/ SS LL oLL UR oUR x y z)
  (if (setq SS (ssget))
    (progn
      (BBox)
      (setq x (rtos (- (car UR) (car LL)) 2 3))  ;change the 3 for more or less decmial places
      (setq y (rtos (- (cadr UR) (cadr LL)) 2 3))
      (setq z (rtos (- (caddr UR) (caddr LL)) 2 3))
      (prompt (strcat "\nX:" x " Y:" y " Z:" z))
      (prompt (strcat "\nLL Point:"))
      (princ LL)
      (prompt (strcat "\nUR Point:"))
      (princ UR)
    )
  )
  (princ)
)
;;----------------------------------------------------------------------------;;
;; GET BOUNDING BOX POINTS FOR SELECTED ENTITY(s)
(defun BBox ()
  (vla-getboundingbox (vlax-ename->vla-object (ssname SS 0)) 'minpt 'maxpt)
  (mapcar 'set '(LL UR) (mapcar 'safearray-value (list minpt maxpt)))
  (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
    (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt)
    (mapcar 'set '(oLL oUR) (mapcar 'safearray-value (list minpt maxpt)))
    (setq LL (mapcar 'min oLL LL)  ; least of each component
          UR (mapcar 'max oUR UR)  ; greatest of each component
    )
  )
  (princ)
)

 

Edited by mhupp
updated code to calculate height and give LL and UR points
Link to comment
Share on other sites

Great solution, has one drawback. If the region is at an angle it will not give the height at the selected point. However, thank you very much for your help this version already solves 90% of cases.

 

Link to comment
Share on other sites

9 hours ago, jan_ek said:

Great solution, has one drawback. If the region is at an angle it will not give the height at the selected point.

 

Then I would refer you back to my first post.

Link to comment
Share on other sites

Hi, I have encountered another problem. How to select regions within a window. I have assumed that I will check the height in 100mm increments. Everything works ok on the edges but I cannot select the correct regions if I am inside. I have used:
(setq SS(ssget "_B" (list PX PY -1000) (list (+ VX PX) (+ PY VY) 10000) '((0 . "REGION"))))
unfortunately this solution does not work.

Region.jpg

Link to comment
Share on other sites

You are misunderstanding what command bbd is doing. I have combined my two answers. You don't need to explode the solids anymore.

 

this will ask to pick a solid and a point.

create a section of the solid on the xy plain from the point picked.

the cross section will then have the z height x and y dims displayed

 

image.png.0832a8a6324c7fd796562b96c13d761a.png

 

That is the thickness at 2.490 height in the x and y direction

 

;;----------------------------------------------------------------------------;;
;; MEASUREMENTS OF BOUNDING BOX
(defun C:BBD (/ SS LL oLL UR oUR x y)
  (setq obj (entsel "\nSelect Solid"))
  (setq pt (getpoint "\nPick Point for Cross Section"))
  (setvar 'cmdecho 0)
  (command "_.Section" obj "" "XY" pt)
  (setvar 'cmdecho 1)
  (if (setq SS (ssget "_L"))
    (progn
      (BBox)
      (setq x (rtos (- (car UR) (car LL)) 2 3))
      (setq y (rtos (- (cadr UR) (cadr LL)) 2 3))
      (prompt (strcat "\nZ Height: " (rtos (caddr UR) 2 3)))
      (prompt (strcat "\nX:" x " Y:" y))
    )
  )
  (sssetfirst nil SS) ;keeps last thing selected or you could also delete the section.
  (princ)
)
;;----------------------------------------------------------------------------;;
;; GET BOUNDING BOX POINTS FOR SELECTED ENTITY(s)
(defun BBox ()
  (vla-getboundingbox (vlax-ename->vla-object (ssname SS 0)) 'minpt 'maxpt)
  (mapcar 'set '(LL UR) (mapcar 'safearray-value (list minpt maxpt)))
  (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
    (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt)
    (mapcar 'set '(oLL oUR) (mapcar 'safearray-value (list minpt maxpt)))
    (setq LL (mapcar 'min oLL LL)  ; least of each component
          UR (mapcar 'max oUR UR)  ; greatest of each component
    )
  )
  (princ)
)

 

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