Find the middle of a box
                
                                    
                                  in RobotStudio             
            
                    Is there a method to find the middle of a box using the SDK? I have a addin that randomly creates variously sized boxes and i want to ensure they are laid flat and that i can align the center of the bag with a frame.                
                        
            Tagged:
            
        
0  
            Comments
- 
            Hello,You can compute it.☑️2024 - RobotStudio® User Group0
 - 
            I am no math wiz, but could you clarify the question? As I see it, box implies a cube, 3D, while you mention lay flat, which makes me think of a 2d square.Lee Justice0
 - 
            
So when creating a box using the SDK it uses a corner to create the box from (highlighted in the red circle). I need to align the centre of one of the boxes faces (highlighted in the blue circle) with a frame to ensure its within the bounds of a conveyor when correctly positioned.lemster68 said:I am no math wiz, but could you clarify the question? As I see it, box implies a cube, 3D, while you mention lay flat, which makes me think of a 2d square.
To do this I've created the box (Body.CreateSolidBox), then using Body.CenterOfGravity & Transformation(s) I am able to calculate where the nearest edge is on a 3D object to place a frame in the centre of the surface ensuring the frame created at the centre of the box is alway aligned with a frame. End result shown below;
0 - 
            So it looks like you have found a satisfactory solution? I realize reading what I posted how dumb I made myself look, half of width and half of length is center, duh!Lee Justice0
 
Categories
- All Categories
 - 5.6K RobotStudio
 - 401 UpFeed
 - 21 Tutorials
 - 15 RobotApps
 - 306 PowerPacs
 - 407 RobotStudio S4
 - 1.8K Developer Tools
 - 250 ScreenMaker
 - 2.9K Robot Controller
 - 363 IRC5
 - 81 OmniCore
 - 8 RCS (Realistic Controller Simulation)
 - 853 RAPID Programming
 - 31 AppStudio
 - 4 RobotStudio AR Viewer
 - 19 Wizard Easy Programming
 - 110 Collaborative Robots
 - 5 Job listings
 
