Creating Surfaces
This example provides information on creating surfaces. Different surfaces are seen in the part if you go to the Modeling browser.
Use this procedure to create a surface:
Create Part object to contain the Bodies and Add it to the Station .
Create a surface circle
Create surface from curve
Create a curve, that must be closed
Create surface
Create a surface polygon
Create a surface rectangle
Solution
Create Part object to contain the Bodies and Add it to the Station.
Part p = new Part(); p.Name = "My_Surfaces"; station.GraphicComponents.Add(p);
Create a surface circle
Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Body b1 = Body.CreateSurfaceCircle(matrix_origo, 0.5); b1.Name = "Surface circle"; p.Bodies.Add(b1);
Create surface from curve
Create a curve, that must be closed
Vector3 v1 = new Vector3(0.0, 0.0, 0.0); Vector3 v2 = new Vector3(0.5, 0.5, 0.0); Vector3 v3 = new Vector3(0.2, -0.2, 0.0); Vector3 v4 = new Vector3(-0.2, -0.3, 0.0); Vector3 v5 = new Vector3(-0.3, 0.2, 0.0); Vector3[] vertices = new Vector3[6] { v1, v2, v3, v4, v5, v1 }; Body spline = Body.CreateSpline(vertices, 0.0); spline.Name = "Spline"; p.Bodies.Add(spline);
Create surface
Body b2 = Body.CreateSurfaceFromCurve(spline.Shells[0].Wires[0]); b2.Name = "Curve surface"; p.Bodies.Add(b2);
Create a surface polygon
Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0); Body b3 = Body.CreateSurfacePolygon(vector_origo, new Vector3(0.5, 0.5, 0.5), 8); b3.Name = "Surface Polygon"; p.Bodies.Add(b3);
Create a surface rectangle
Body b4 = Body.CreateSurfaceRectangle(matrix_origo, 0.2, 0.5); b4.Name = "Surface Rectangle"; p.Bodies.Add(b4);
Example
This example provides information on creating surfaces.
public void BodyCreateSurfaces()
{
NewStation();
Project.UndoContext.BeginUndoStep("BodyCreateSurfaces");
try
{
Station station = Station.ActiveStation;
// Create a part to contain the bodies.
Part p = new Part();
p.Name = "My_Surfaces";
station.GraphicComponents.Add(p);
// Create a surface circle.
Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0);
Body b1 = Body.CreateSurfaceCircle(matrix_origo, 0.5);
b1.Name = "Surface circle";
p.Bodies.Add(b1);
// Create surface from curve.
// Create a curve, that must be closed.
Vector3 v1 = new Vector3(0.0, 0.0, 0.0);
Vector3 v2 = new Vector3(0.5, 0.5, 0.0);
Vector3 v3 = new Vector3(0.2, -0.2, 0.0);
Vector3 v4 = new Vector3(-0.2, -0.3, 0.0);
Vector3 v5 = new Vector3(-0.3, 0.2, 0.0);
Vector3[] vertices = new Vector3[6] { v1, v2, v3, v4, v5, v1 };
Body spline = Body.CreateSpline(vertices, 0.0);
spline.Name = "Spline";
p.Bodies.Add(spline);
Body b2 = Body.CreateSurfaceFromCurve(spline.Shells[0].Wires[0]);
b2.Name = "Curve surface";
p.Bodies.Add(b2);
// Create a surface polygon.
Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0);
Body b3 = Body.CreateSurfacePolygon(vector_origo, new Vector3(0.5, 0.5, 0.5), 8);
b3.Name = "Surface Polygon";
p.Bodies.Add(b3);
// Create a surface rectangle.
Body b4 = Body.CreateSurfaceRectangle(matrix_origo, 0.2, 0.5);
b4.Name = "Surface Rectangle";
p.Bodies.Add(b4);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
Required Namespaces
ABB.