Creating Solids
This example provides information on creating different solid bodies. Go to the Modeling browser to see all bodies joined together as one part. If you select all the bodies (not the part) in the Modeling browser and make them invisible, you can then select on at a time to see the different bodies better.
Use this procedure to create Solids in RobotStudio:
Create Part object to contain the Bodies and Add it to the Station .
Create a solid box
Create a cone
Create a cylinder
Create a pyramid
Create a sphere
Create a torus
Solution
Create Part object to contain the Bodies and Add it to the Station.
Part p = new Part(); p.Name = "My_Solid_Bodies"; station.GraphicComponents.Add(p);
Create a solid box
Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Vector3 size = new Vector3(0.5, 0.5, 0.5); Body b1 = Body.CreateSolidBox(matrix_origo, size); b1.Name = "Box"; p.Bodies.Add(b1);
Create a cone
Body b2 = Body.CreateSolidCone(matrix_origo, 1.0, 1.0); b2.Name = "Cone"; p.Bodies.Add(b2);
Create a cylinder
Body b3 = Body.CreateSolidCylinder(matrix_origo, 0.5, 0.5); b3.Name = "Cylinder"; p.Bodies.Add(b3);
Create a pyramid
Body b4 = Body.CreateSolidPyramid(matrix_origo, 1.0, 1.0, 6); b4.Name = "Pyramid"; p.Bodies.Add(b4);
Create a sphere
Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0); Body b5 = Body.CreateSolidSphere(vector_origo, 0.75); b5.Name = "Sphere"; p.Bodies.Add(b5);
Create a torus
Body b6 = Body.CreateSolidTorus(matrix_origo, 1.0, 0.5); b6.Name = "Torus"; p.Bodies.Add(b6);
Example
This example provides information on creating different solid bodies.
public void BodyCreateSolids()
{
NewStation();
Project.UndoContext.BeginUndoStep("BodyCreateSolids");
try
{
Station station = Station.ActiveStation;
// Create a part to contain the bodies.
Part p = new Part();
p.Name = "My_Solid_Bodies";
station.GraphicComponents.Add(p);
// Create a solid box.
Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
Vector3 size = new Vector3(0.5, 0.5, 0.5);
Body b1 = Body.CreateSolidBox(matrix_origo, size);
b1.Name = "Box";
p.Bodies.Add(b1);
// Create a cone.
Body b2 = Body.CreateSolidCone(matrix_origo, 1.0, 1.0);
b2.Name = "Cone";
p.Bodies.Add(b2);
// Create a cylinder.
Body b3 = Body.CreateSolidCylinder(matrix_origo, 0.5, 0.5);
b3.Name = "Cylinder";
p.Bodies.Add(b3);
// Create a pyramid.
Body b4 = Body.CreateSolidPyramid(matrix_origo, 1.0, 1.0, 6);
b4.Name = "Pyramid";
p.Bodies.Add(b4);
// Create a sphere.
Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
Body b5 = Body.CreateSolidSphere(vector_origo, 0.75);
b5.Name = "Sphere";
p.Bodies.Add(b5);
// Create a torus.
Body b6 = Body.CreateSolidTorus(matrix_origo, 1.0, 0.5);
b6.Name = "Torus";
p.Bodies.Add(b6);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
Required Namespaces
ABB.