Group Bounding box shows in empty area

Group Bounding box shows in empty area

arthvaja
Participant Participant
575 Views
2 Replies
Message 1 of 3

Group Bounding box shows in empty area

arthvaja
Participant
Participant

Hello,

I use maxscript to scale the whole scene by grouping the scene then moving its pivot to the bottom of the group and matching the size of the group with the reference box. 


Problem: When I group the scene, I get an empty space in the bottom section of the group, which causes the group pivot to be positioned incorrectly, so when I scale the group using the script, it does not match its size with the reference box.

Please find attached screenshots of 3ds max which shows empty space that I am getting once I group the objects and current scaling that I am getting

 

Below is code that I use for scaling:

 

-- Move the scene group pivot to bottom of the group

obj = $sceneGroup
obj.pivot = obj.center ;
obj.pivot.z = obj.min.z ;

--set height of the scene

target = $referenceBox ; 
ratios = (target.max - target.min) / (obj.max - obj.min);  
the_scale = amin #(ratios.x, ratios.y, ratios.z);  
scale $sceneGroup (the_scale * [1, 1, 1]); 

 

 

0 Likes
576 Views
2 Replies
Replies (2)
Message 2 of 3

miauuuu
Collaborator
Collaborator

Check your  objects for vertices which are not connected to any edge. I had the same problem while ago - such verts was the reason of the same problem as yours.

 

For example check here.

 

Also, you can reset xform of the objects you want to group.

https://miauu-maxscript.com/
0 Likes
Message 3 of 3

arthvaja
Participant
Participant

@miauuuu  Thank you for your response,

 

After using the script to remove isolated vertices and resetting xforms for the objects, it is still not fixing the empty space problem in groups. My scene was made in AutoCAD, so they have parent-child(Block-Layers) relationships and mostly objects are linked to each other in 3ds Max when I use the scene. To resolve the issue, I checked which objects were causing it. There are objects in which the child pivot has a perfect position but when I check the parent pivot, it has a wrong position, and when I reset the pivot, all linked objects from that object change their positions.

 

Please find attached screenshots of 3ds max, 1) Wrong pivot positions objects 2) pivot positions of the object 3) after setting the pivot position

0 Likes