internal static Snap.NX.Note CreateNote(string[] text, Position origin, Snap.Orientation matrix, TextStyle textStyle) { PmiNoteBuilder builder = Globals.WorkPart.NXOpenPart.Annotations.CreatePmiNoteBuilder(null); builder.Style.LetteringStyle.GeneralTextColor = Snap.Color.NXColor(textStyle.Color); builder.Style.LetteringStyle.GeneralTextFont = textStyle.FontIndex; builder.Style.LetteringStyle.GeneralTextLineWidth = (LineWidth)(textStyle.StrokeWidth + 1); double num2 = textStyle.FontSize / 72.0; double num3 = num2 * Globals.InchesPerUnit; builder.Style.LetteringStyle.GeneralTextSize = num3; builder.Style.LetteringStyle.GeneralTextCharSpaceFactor = textStyle.CharSpaceFactor; builder.Style.LetteringStyle.GeneralTextAspectRatio = textStyle.AspectRatio; builder.Style.LetteringStyle.GeneralTextLineSpaceFactor = textStyle.LineSpaceFactor; builder.Style.LetteringStyle.HorizontalTextJustification = (NXOpen.Annotations.TextJustification)textStyle.HorizontalTextJustification; builder.Style.LetteringStyle.Angle = textStyle.LineAngle; builder.VerticalText = textStyle.IsVertical; builder.Text.SetEditorText(text); builder.Origin.Anchor = (NXOpen.Annotations.OriginBuilder.AlignmentPosition)(textStyle.AlignmentPosition - 1); builder.Origin.OriginPoint = (Point3d)origin; builder.Origin.Plane.PlaneMethod = PlaneBuilder.PlaneMethodType.UserDefined; Xform xform = Globals.NXOpenWorkPart.Xforms.CreateXform((Point3d)origin, (Matrix3x3)matrix, SmartObject.UpdateOption.DontUpdate, 1.0); builder.Origin.Plane.UserDefinedPlane = xform; NXOpen.NXObject obj2 = builder.Commit(); builder.Destroy(); return(new Snap.NX.Note((PmiNote)obj2)); }
/// <summary> /// if sub-class really wants to, can override this and determines how to draw /// </summary> /// <param name="graphicsDevice"></param> virtual public void Draw(GraphicsDevice graphicsDevice, ContentManager cm, Camera camera, MatrixStack stack) { BasicEffect effect = LoadEffect(graphicsDevice); stack.Push(); { Xform.ComputeWorldTransform(stack); effect.View = camera.ViewMatrix(); effect.Projection = camera.ProjectionMatrix(); effect.World = stack.GetTopOfStack(); effect.CurrentTechnique.Passes[0].Apply(); SetCurrentColor(); DrawPrimitive(graphicsDevice, cm); } stack.Pop(); if (mDrawPivot) { if (null == mPivot) { mPivot = new AxisShape(); } mPivot.DrawPivot = false; // to ensure no infinite recursion! mPivot.Xform.Translation = Xform.Translation + Xform.Pivot; mPivot.Xform.Rotation = Xform.Rotation; mPivot.Draw(graphicsDevice, cm, camera, stack); } }
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)); }
public void StartAnimation(Xform startState, Xform endState, float duration, OnCompleteCallback OnComplete = null, TimeScaleFunction RescaleTime = null) { m_start = startState; m_end = endState; current = startState; m_duration = duration; m_startTime = Time.time; m_timeElapsed = 0; m_t = 0; m_animate = true; m_OnComplete = OnComplete; m_RescaleTime = RescaleTime; }
public void StartRotation(float toDegZ, float duration, OnCompleteCallback OnComplete = null, TimeScaleFunction RescaleTime = null) { m_start = current; m_end = current; m_duration = duration; m_startTime = Time.time; m_timeElapsed = 0; m_t = 0; m_animate = true; m_OnComplete = OnComplete; m_RescaleTime = RescaleTime; m_end.rotation = Quaternion.Euler(0, 0, toDegZ); }
public Finger(float atX, float atZ, String name) : base(name) { const float fingerLength = 3f; float pivotXOffset = atX; Xform.Pivot = new Vector3(pivotXOffset, 0, atZ); MeshShape finger = new MeshShape("cylinder"); Xform.RotateInYByRadian(MathHelper.PiOver2); Xform.Scale = new Vector3(0.25f * Arm.kCylinderRadiusScale, 0.25f * Arm.kCylinderRadiusScale, fingerLength * Arm.kCylinderRadiusScale); finger.Xform.Translation = new Vector3(pivotXOffset + (fingerLength / 2f), 0, atZ); finger.Color = Color.Purple; AddShape(finger); MeshShape c1 = new MeshShape("teapot"); c1.Xform.Scale = new Vector3(0.6f); c1.Xform.Translation = new Vector3(pivotXOffset + fingerLength, 0f, atZ); c1.Color = Color.DarkSlateGray; AddShape(c1); }
public NXObject shank(Point point1, Point point2) { Part workPart = theSession.Parts.Work; NXObject shanker; NXOpen.Features.Feature nullFeatures_Feature = null; NXOpen.Features.DatumAxisBuilder abuilder; abuilder = workPart.Features.CreateDatumAxisBuilder(nullFeatures_Feature); abuilder.ArcLength.Expression.RightHandSide = "0"; abuilder.Type = NXOpen.Features.DatumAxisBuilder.Types.TwoPoints; abuilder.IsAssociative = true; Xform nullXform = null; Point pt1 = workPart.Points.CreatePoint(point1, nullXform, NXOpen.SmartObject.UpdateOption.WithinModeling); Point pt2 = workPart.Points.CreatePoint(point2, nullXform, NXOpen.SmartObject.UpdateOption.WithinModeling); abuilder.Point1 = pt1; abuilder.Point2 = pt2; shanker = abuilder.Commit(); abuilder.Destroy(); return(shanker); }
[DllImport("usdi")] public static extern int usdiXformEachSample(Xform xf, usdiXformSampleCallback cb);
[DllImport("usdi")] public static extern Bool usdiXformWriteSample(Xform xf, ref XformData src, double t);
[DllImport("usdi")] public static extern Bool usdiXformReadSample(Xform xf, ref XformData dst, double t);
public SpinnyCamera(Xform parent) : base(parent) { }
public SpinnyCircle(Xform parent, float x, float y, float radius, float spin) : base(parent, x, y, radius) { Spin = spin; }
public CircleBlip(Xform parent, float x, float y, float max_radius) : base(parent, x, y, 1f) { }