Creating Intersection Curves
This example provides information on creating intersection curves between two bodies, and how to create a border from points. You can see the different bodies of the part in the Modeling browser.
Use this procedure to create Intersection Curves:
Create Part object to contain the Bodies and add it to the Station .
Create border around face
Create a box
Create the border curve around face
Create border from points
Create Vector3 array of points
Create a Border curve from points
Create Intersection Curve
Create a SolidSphere
Create an Intersection curve from box and sphere
Solution
Create Part object to contain the Bodies and Add it to the Station.
Part p = new Part(); p.Name = "My_Advanced_Curves"; station.GraphicComponents.Add(p);
Create border around face
Create a box
Matrix4 origin = new Matrix4(new Vector3(Axis.X), 0.0); Vector3 size = new Vector3(0.5, 0.5, 0.5); Body box = Body.CreateSolidBox(origin, size); box.Name = "Box"; p.Bodies.Add(box);
Create the border curve around face
Body b1 = Body.CreateBorderAroundFace(box.Shells[0].Faces[0]); b1.Name = "Face Border"; p.Bodies.Add(b1);
Create border from points
Create Vector3 array of points
Vector3 p1 = new Vector3(0.0, 0.0, 0.0); Vector3 p2 = new Vector3(0.5, 0.0, 0.0); Vector3 p3 = new Vector3(0.5, 0.5, 0.0); Vector3 p4 = new Vector3(0.5, 0.5, 0.5); Vector3[] points = new Vector3[4] { p1, p2, p3, p4 };
Create a Border curve from points
Body b2 = Body.CreateBorderFromPoints(box, points); b2.Name = "Border from Points"; p.Bodies.Add(b2);
Create Intersection Curve
Create a SolidSphere
Body sphere = Body.CreateSolidSphere(new Vector3(0.25, 0.25, 0.25), 0.3); p.Bodies.Add(sphere);
Create an Intersection curve from box and sphere
Body intersectionCurve = Body.CreateIntersectionCurve(box, sphere); p.Bodies.Add(intersectionCurve);
Example
This example provides information on creating intersection curves.
public void BodyAdvancedCurves()
{
NewStation();
Project.UndoContext.BeginUndoStep("BodyAdvancedCurves");
try
{
Station station = Station.ActiveStation;
// Create a part to contain the bodies.
Part p = new Part();
p.Name = "My_Advanced_Curves";
station.GraphicComponents.Add(p);
// Create border around face.
// First create a box.
Matrix4 origin = new Matrix4(new Vector3(Axis.X), 0.0);
Vector3 size = new Vector3(0.5, 0.5, 0.5);
Body box = Body.CreateSolidBox(origin, size);
box.Name = "Box";
p.Bodies.Add(box);
// Then create the border curve.
Body b1 = Body.CreateBorderAroundFace(box.Shells[0].Faces[0]);
b1.Name = "Face Border";
p.Bodies.Add(b1);
// Create border from points.
// Create an array of points of the box.
Vector3 p1 = new Vector3(0.0, 0.0, 0.0);
Vector3 p2 = new Vector3(0.5, 0.0, 0.0);
Vector3 p3 = new Vector3(0.5, 0.5, 0.0);
Vector3 p4 = new Vector3(0.5, 0.5, 0.5);
Vector3[] points = new Vector3[4] { p1, p2, p3, p4 };
Body b2 = Body.CreateBorderFromPoints(box, points);
b2.Name = "Border from Points";
p.Bodies.Add(b2);
// Create Intersection Curve.
// Create a SolidSphere.
Body sphere = Body.CreateSolidSphere(new Vector3(0.25, 0.25, 0.25), 0.3);
p.Bodies.Add(sphere);
Body intersectionCurve = Body.CreateIntersectionCurve(box, sphere);
p.Bodies.Add(intersectionCurve);
// Create the same curve using the non static intersection curve method.
Body intersectionCurve2 = box.CreateIntersectionCurve(sphere);
p.Bodies.Add(intersectionCurve2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
Required Namespaces
ABB.