internal static Snap.NX.Arc CreateArc(Position center, Vector axisX, Vector axisY, double radius, double angle1, double angle2) { double num = 0.017453292519943295; double startAngle = angle1 * num; double endAngle = angle2 * num; Snap.Orientation rotation = new Snap.Orientation(axisX, axisY); Snap.NX.Matrix matrix = new Snap.NX.Matrix(rotation); return(new Snap.NX.Arc(Globals.NXOpenWorkPart.Curves.CreateArc((Point3d)center, (NXMatrix)matrix, radius, startAngle, endAngle))); }
internal static Snap.NX.CoordinateSystem CreateCoordinateSystem(Snap.Position origin, Vector axisX, Vector axisY, Vector axisZ) { Tag tag2; UFSession uFSession = Globals.UFSession; double[] array = origin.Array; Snap.NX.Matrix matrix = new Snap.NX.Matrix(axisX, axisY, axisZ); Tag nXOpenTag = matrix.NXOpenTag; uFSession.Csys.CreateCsys(array, nXOpenTag, out tag2); return((NXOpen.CoordinateSystem)Snap.NX.NXObject.GetObjectFromTag(tag2)); }
internal static Snap.NX.DatumCsys CreateDatumCsys(Position origin, Snap.NX.Matrix matrix) { NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart; NXOpen.Features.DatumCsysBuilder featureBuilder = workPart.Features.CreateDatumCsysBuilder(null); Xform xform = workPart.Xforms.CreateXform((Point3d)origin, (Vector3d)matrix.AxisX, (Vector3d)matrix.AxisY, SmartObject.UpdateOption.WithinModeling, 1.0); CartesianCoordinateSystem system = workPart.CoordinateSystems.CreateCoordinateSystem(xform, SmartObject.UpdateOption.WithinModeling); featureBuilder.Csys = system; NXOpen.Features.DatumCsys datumCsys = (NXOpen.Features.DatumCsys)Snap.NX.Feature.CommitFeature(featureBuilder); featureBuilder.Destroy(); return(new Snap.NX.DatumCsys(datumCsys)); }
internal static Snap.NX.Ellipse CreateEllipse(Snap.Position center, Vector axisX, Vector axisY, double rotationAngle, double a, double b, double angle1, double angle2) { NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart; double num = 0.017453292519943295; angle1 *= num; angle2 *= num; rotationAngle *= num; Vector axisZ = Vector.UnitCross(axisX, axisY); Snap.NX.Matrix matrix = Snap.NX.Matrix.CreateMatrix(axisX, axisY, axisZ); return(new Snap.NX.Ellipse(workPart.Curves.CreateEllipse((Point3d)center, a, b, angle1, angle2, rotationAngle, (NXMatrix)matrix))); }