var sk1 = new devDept.Geometry.ConstraintSolver.Sketch();
// Create the linear border.
var l1 = sk1.AddLine(0, 0, 20, 0);
var l2 = sk1.AddLine(20, 0, 20, 10);
var l3 = sk1.AddLine(20, 10, 12.4142, 10);
var l4 = sk1.AddLine(11.7071, 11.7071, 20, 20);
var l5 = sk1.AddLine(20, 20, 0, 20);
var l6 = sk1.AddLine(0, 20, 0, 0);
// Create the connection arc.
Arc arc = new Arc( new Point3D(12.4142, 11, 0),
new Point3D(12.4142, 10, 0),
new Point3D(11.7071, 11.7071, 0));
// Arcs in a sketch are always considered as counter-clockwise
// according to the normal of the sketch plane.
if(Vector3D.AreOpposite(arc.Plane.AxisZ, sk1.SketchPlane.AxisZ))
arc.Reverse();
var a1 = sk1.AddArc(arc.Center, arc.StartPoint, arc.EndPoint);
// Hor/Ver constraints.
sk1.AddConstraintHorizontal(l1);
sk1.AddConstraintHorizontal(l3);
sk1.AddConstraintHorizontal(l5);
sk1.AddConstraintVertical(l2);
sk1.AddConstraintVertical(l6);
// Tangency between the arc and connected linear segments.
sk1.AddConstraintTangent(l3, a1);
sk1.AddConstraintTangent(a1, l4);
// Fix side lenghts.
sk1.AddConstraintLength(l1, 20);
sk1.AddConstraintLength(l2, 10);
sk1.AddConstraintLength(l5, 20);
sk1.AddConstraintLength(l6, 20);
// Ensure continuity between all sides.
sk1.AddConstraintJoin(l3.EndPoint, a1.EndPoint);
sk1.AddConstraintJoin(l4.StartPoint, a1.StartPoint);
sk1.AddConstraintJoin(l1.EndPoint, l2.StartPoint);
sk1.AddConstraintJoin(l2.EndPoint, l3.StartPoint);
sk1.AddConstraintJoin(l4.EndPoint, l5.StartPoint);
sk1.AddConstraintJoin(l5.EndPoint, l6.StartPoint);
sk1.AddConstraintJoin(l6.EndPoint, l1.StartPoint);
// Fix the arc angle and radius.
sk1.AddConstraintAngle(l3, l4);
sk1.AddConstraintRadius(a1);
// Fix the first point location.
sk1.AddFixedPointConstraint(l1.StartPoint);
// Create a BRep via revolution.
Brep tool = sk1.RevolveAsBrep(Utility.TWO_PI, Vector3D.AxisY, new Point3D())[0];
design1.Entities.Add(tool, Color.DarkGray);
Revolve sketch with arc
Federico Fucci
This content is available only to customers with an active subscription. Please ensure your subscription is current to access this article.
Please sign in to access this article.
If you believe this is an error, please contact our support team for assistance.
Comments
Please sign in to leave a comment.