jan_ek Posted December 17, 2021 Share Posted December 17, 2021 Hello, Is it possible to calculate the thickness of a solid at any point (x-y plane) Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 17, 2021 Share Posted December 17, 2021 Section command will generate a flat cross section that you can measure easily enough. 1 Quote Link to comment Share on other sites More sharing options...
jan_ek Posted December 17, 2021 Author Share Posted December 17, 2021 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 Quote Link to comment Share on other sites More sharing options...
jan_ek Posted December 17, 2021 Author Share Posted December 17, 2021 (edited) 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 December 17, 2021 by jan_ek Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 17, 2021 Share Posted December 17, 2021 1 hour ago, jan_ek said: I have to do several hundred thousand checks oof I feel your pain 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 18, 2021 Share Posted December 18, 2021 (edited) 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 December 18, 2021 by mhupp updated code to calculate height and give LL and UR points Quote Link to comment Share on other sites More sharing options...
jan_ek Posted December 18, 2021 Author Share Posted December 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 18, 2021 Share Posted December 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
jan_ek Posted December 18, 2021 Author Share Posted December 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 18, 2021 Share Posted December 18, 2021 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 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) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.