Wrong Bounding Box points

Wrong Bounding Box points

BestFriendCZ
Advocate Advocate
1,250 Views
2 Replies
Message 1 of 3

Wrong Bounding Box points

BestFriendCZ
Advocate
Advocate

Hi all,

 

I have problem with function GetBoundingBox at random DWG blocks. I have random DWG where are all layers visible and this function from some reason returns totally different points for Z coordinates. Does anybody have experience with this?  Thank for any advices

 

Public Sub BBCreateLine()
 Dim ssFlip As AcadSelectionSet
 Dim pt1 As Variant
 Dim pt2 As Variant
 Set ssFlip = ThisDrawing.SelectionSets.Add("flip")
 ssFlip.SelectOnScreen
 GetSSBoundingBox ssFlip, pt1, pt2
 ' draw a line from point to point
 ThisDrawing.ModelSpace.AddLine pt1, pt2
 ssFlip.Delete
 
End Sub

Public Sub GetSSBoundingBox(ss As AcadSelectionSet, ptMin As Variant, ptMax As Variant)
 Dim entItem As AcadEntity
 Dim ptImin As Variant
 Dim ptImax As Variant
 Const X = 0
 Const Z = 2

 ss(0).GetBoundingBox ptMin, ptMax
 For Each entItem In ss
   entItem.GetBoundingBox ptImin, ptImax
   If ptImin(X) < ptMin(X) Then ptMin(X) = ptImin(X)
   If ptImin(Z) < ptMin(Z) Then ptMin(Z) = ptImin(Z)
   If ptImax(X) > ptMax(X) Then ptMax(X) = ptImax(X)
   If ptImax(Z) > ptMax(Z) Then ptMax(Z) = ptImax(Z)
 Next

End Sub

 

result in DWGBBTest.png

 

link to test block:

https://files.fm/u/pyu2hkb6

...
0 Likes
Accepted solutions (1)
1,251 Views
2 Replies
Replies (2)
Message 2 of 3

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

I would say it's a bug.

 

What might help (as long as there is no real valid reason shown for that behavior) is the information which object seems to be the source of the issue.

I have exploded the block, then the solid and then used your sample code surface by surface to see which one is it that returns the wrong result. Maybe recreating this object with other steps gives you the chance for getting correct results.

 

20181124_154342.png

 

Sorry for not having better news, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 3

BestFriendCZ
Advocate
Advocate

Hi, Alfred

Thank you for your research. I spoke to with our constructors and they said me same like you. Problem is that it is happens time to times... all these files was exported from SW and then import to CAD. I have some exp with SW so when i will have more time i will try personaly export and then import.... so thank you again for your time

...
0 Likes