RobotStudio event

Find the middle of a box

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.

Comments

  • DenisFR
    DenisFR ✭✭✭
    Hello,
    You can compute it.
  • 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 Justice
  • 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.
    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.



    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;






  • 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 Justice