Jump to content

why this 3d solid refuse to give me correct value for maximum height


Recommended Posts

Posted

hello freinds

i am looking to solve the problem with this 3d solid

why it gave me wrong value for maximum height when applying getbondinbox

it must gave me 32.69 not 32.909

any help will be appreciated 

(defun c:hv (/ lowestp higestp lvmin lvmax )
  (vl-load-com)  
  (setq osmd(getvar"osmode"))
  (setq Ent (entsel "\nCommand: Select a solid : " ))
  (setq Obj (vlax-ename->vla-Object (car Ent )) )
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(vla-GetBoundingBox obj 'minp 'maxp)
  (SETQ LOWESTP(vlax-safearray->list minp))
  (setq higestP(vlax-safearray->list maxp))
 (setq lvmin(caddr(vlax-safearray->list minp))) 
 (setq lvmax(caddr(vlax-safearray->list maxp)))
  (print (strcat"maximum height"(rtos lvmax 2 3)))
  )

 

shot.png

sample.dwg

Posted
17 minutes ago, motee-z said:

why it gave me wrong value for maximum height when applying getbondinbox

it must gave me 32.69 not 32.909

I just measured your sample drawing with the DISTANCE command and it is indeed 32.69, NOT 32.909.

Posted (edited)

yes it is 32.69

but if you apply the lisp to get maximum height it gave 32.909

if slice the 3d solid to known level and get new 3d solid and measure it height you will not get the same level of the known level

Edited by motee-z
Posted (edited)

MASSPROP reports the same:

image.png.5a8ba2c597867a93fc882a01375ef97e.png

(defun c:hv (/ ent obj minp maxp)
  (if (setq ent (entsel "\nSelect a solid : "))
    (progn (setq obj (vlax-ename->vla-object (car ent)))
	   (vla-getboundingbox obj 'minp 'maxp)
	   (print (mapcar 'set '(minp maxp) (mapcar 'vlax-safearray->list (list minp maxp))))
	   ;; (print (rtos (vla-get-volume obj) 2 3))
    )
  )
  (princ)
)
(vl-load-com)
;; ((2256.3 1521.3 0.0) (2306.31 1571.32 32.6901))

 

Edited by ronjonp
Posted (edited)

thanks rojonp for response 

is my code wrong

also it gave me wrong value from your code

((2256.24 1521.25 -0.00019217) (2306.38 1571.37 32.9092))

 

shot2.png

Edited by motee-z
Posted

I noticed that all 3d solids formed from 3p poline when created and after one slice the rest of it gives wrong bonding box

please check to slice any 3d solid created in this way

Posted (edited)

It looks like this cylinder was made from a SPLINE and the bounding box method is known to give wonky results with splines. <- This is true but not your issue.

image.thumb.png.5ac599592fa07ca1fc6810a2f7df3995.png

 

Further investigation after exploding the solid and there is a vertical spline that is part of the solid that is 32.6901 tall.

image.png.8054e95db9382045a14171e0941d72ad.png

 

Too many numbers here 🤣 I read your post closer and you state that the lisp gives a different height of 32.909 but I cannot reproduce that.

Edited by ronjonp
Posted

may the defference due to autocad version 

i tested your lisp in autocad 2016 and 2019 and the result stay 32.909

Posted
34 minutes ago, motee-z said:

may the defference due to autocad version 

i tested your lisp in autocad 2016 and 2019 and the result stay 32.909

Possibly. I'm running AutoCAD 2024.

Posted

Only after Ron's (c:hv) it gave me : 32.909, but when I used LIST it gave 32.69...

I tested on AutoCAD 2022...

Posted

BricsCAD V23 is all OK...

 

: (defun c:hv (/ ent minp maxp)
(_>   (vl-load-com)
(_>   (if (setq ent (entsel "\nSelect a solid : "))
((_>     (progn (setq obj (vlax-ename->vla-object (car ent)))
(((_>        (vla-getboundingbox obj 'minp 'maxp)
(((_>        (print (mapcar 'set '(minp maxp) (mapcar 'vlax-safearray->list (list minp maxp))))
(((_>     )
((_>   )
(_>   (princ)
(_> )
C:HV
: hv
Select a solid :
((2256.29851751835 1521.30442645886 0.0) (2306.31287434778 1571.32444848864 32.6900909070525))
: li
Select entities to list or [SOrt/Tracking/add to set (+)/subtract from set (-)/Previous selection/select by PROperties.../selection methoDs.../selection options (?)]:
Entities in set: 1
Select entities to list or [SOrt/Tracking/add to set (+)/subtract from set (-)/Previous selection/select by PROperties.../selection methoDs.../selection options (?)]:

---------- 3dsolid ------------------------------------------------
                  Handle:  26F
           Current space:  Model
                   Layer:  0
                   Color:  green
                Linetype:  ByLayer
            Bounding Box:  
             Lower Bound:  X=   2256.2985  Y=   1521.3044  Z=   0.0000
             Upper Bound:  X=   2306.3129  Y=   1571.3244  Z=   32.6901

Posted (edited)

But MASSPROP in BricsCAD V23 is also wrong :

 

: MASSPROP
Select entities [selection options (?)]:
Entities in set: 1
Select entities [selection options (?)]:  ----------------   SOLIDS    ----------------

                    Mass:  64195.7546
                  Volume:  64195.7546
            Bounding Box:  
             Lower Bound:  X=   2256.2431  Y=   1521.2527  Z=   -0.0002
             Upper Bound:  X=   2306.3790  Y=   1571.3693  Z=   32.9092
                Centroid:  X=   2281.3150  Y=   1546.3123  Z=   16.3456
      Moments of inertia:  X=   153530185995.5973  Y=   334133168157.8903  Z=   487617616668.8713
     Products of inertia:  
                      XY:  226458570281.5990
                      YZ:  1622571115.1894
                      ZX:  2393822783.8555
       Radii of gyration:  X=   1546.4780  Y=   2281.4273  Z=   2756.0465
Principal moments and X-Y-Z directions about centroid:  
                       I:  15746892.1549 along X=   0.7527  Y=   -0.6583  Z=   0.0002
                       J:  15749203.2724 along X=   0.6583  Y=   0.7527  Z=   0.0002
                       K:  20061973.0658 along X=   -0.0003  Y=   0.0000  Z=   1.0000

Edited by marko_ribar
Posted

any one can get z maximum value from the list property 

it seems correct but bounding box is wrong in all version of autocad ecxept version 2024

 

Posted

make t without splines and see if the results are the same.

Posted

without spline gives correct value but some times for cylindrical tank you need to insert spline to match surface  if you find z maximum value for the original shape

it gives okay but if you take out first sheet by slicing the shape the wrong value start from here

Posted

You are right Ron, I've just installed AutoCAD 2024 and it showed 32.69 in every case discussed... (c:hv), list, massprop...

Posted
19 hours ago, marko_ribar said:

You are right Ron, I've just installed AutoCAD 2024 and it showed 32.69 in every case discussed... (c:hv), list, massprop...

Interesting :) .. I wonder if service packs for the older versions would correct this.

Posted (edited)
7 hours ago, ronjonp said:

Interesting :) .. I wonder if service packs for the older versions would correct this.

would you please Ron check this simple sample attached .

on version2024 to calculate volume at maximum level then make slice to get next level you want then get volume

and compare it with my result

because i found most cad version are wrong in calculating volume in some cases.

thanks for all

volumecheck.dwg

Edited by motee-z
Posted (edited)

@motee-z

The 3 Z levels:

Command: HV
Select a solid :
((735.489 -232.24 0.0) (785.516 -182.239 0.0))
Command:
Command:  HV
Select a solid :
((735.489 -232.24 10.0) (785.516 -182.239 10.0))
Command:
Command:  HV
Select a solid :
((735.489 -232.24 20.0) (785.516 -182.239 20.0))

 

And 

Select objects:
 ----------------   SOLIDS    ----------------
Mass:                    39275.8502
Volume:                  39275.8502
Bounding box:         X: 795.7368  --  845.7632
                      Y: -238.1375  --  -188.1366
                      Z: 0.0000  --  20.0000
Centroid:             X: 820.7639
                      Y: -213.1356
                      Z: 10.0000
Moments of inertia:   X: 1795547360.0643
                      Y: 26469683241.1093
                      Z: 28254757040.9697
Products of inertia: XY: 6870683129.3554
                     YZ: 83710801.8756
                     ZX: -322361988.9260
Radii of gyration:    X: 213.8138
                      Y: 820.9403
                      Z: 848.1702

 

And the solid 'HV' code:

Command: HV
Select a solid :
((795.737 -238.138 0.0) (845.763 -188.137 20.0))

 

VLA-GET-VOLUME (level 20)

39275.850
;; Your result
39276041.21

 

Edited by ronjonp
  • Like 1
Posted

I just tested your original drawing on AutoCAD 2022 .. same as Marko's result 32.909. AutoCAD 2023 give the same results as AutoCAD 2024.

 

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