Showing results for 
Search instead for 
Do you mean 
Reply

About leader stubside

I have created a pmilabel in nx11 using nxopen api.

following is code Iused to create a label but label has leader having stubside at right side in nx window but I have set it at left side.

//===================================

  Point3d startVertex = new Point3d();
        Point3d endvertex = new Point3d();
        edge.GetVertices(out startVertex, out endvertex);
        NXOpen.Annotations.SimpleDraftingAid nullAnnotations_SimpleDraftingAid = null;
        NXOpen.Annotations.PmiNoteBuilder pmiNoteBuilder11;
        pmiNoteBuilder11 = theSession.Parts.Work.Annotations.CreatePmiNoteBuilder(nullAnnotations_SimpleDraftingAid);
        string[] text1 = new string[6];
        text1[0] = "___________________________________";
        text1[1] = "Line";
        text1[2] = "                     Value";
        text1[3] = "___________________________________";
        text1[4] = "Length               10";
        text1[5] = "___________________________________";
        pmiNoteBuilder11.Text.TextBlock.SetText(text1);
        pmiNoteBuilder11.Origin.SetInferRelativeToGeometry(true);
        pmiNoteBuilder11.Origin.Plane.PlaneMethod = NXOpen.Annotations.PlaneBuilder.PlaneMethodType.ModelView;
        NXOpen.Xform xform1 = theSession.Parts.Work.Xforms.CreateXformFromCurrentView(NXOpen.SmartObject.UpdateOption.AfterModeling, 1.0);
        pmiNoteBuilder11.Origin.Plane.UserDefinedPlane = xform1;
        pmiNoteBuilder11.Origin.SetInferRelativeToGeometry(true);

        pmiNoteBuilder11.Origin.Anchor = NXOpen.Annotations.OriginBuilder.AlignmentPosition.MidCenter;
        NXOpen.Annotations.LeaderData leaderData12 = theSession.Parts.Work.Annotations.CreateLeaderData();
        pmiNoteBuilder11.Leader.Leaders.Append(leaderData12);
        leaderData12.StubSide = NXOpen.Annotations.LeaderSide.Left;
        leaderData12.Arrowhead = NXOpen.Annotations.LeaderData.ArrowheadType.FilledArrow;

        Point3d coordinates1 = new Point3d(startVertex.X, startVertex.Y, startVertex.Z);
        Point point = theSession.Parts.Work.Points.CreatePoint(startVertex);
        leaderData12.StubSize = 0.0;
        pmiNoteBuilder11.Style.LineArrowStyle.TextToLineDistance = 0.10000000000000001;
        Part workPart = theSession.Parts.Work;
        startVertex.X = startVertex.X + 10;
        startVertex.Y = startVertex.Y + 10;
        leaderData12.Leader.SetValue(point, workPart.ModelingViews.WorkView, coordinates1);
        pmiNoteBuilder11.Origin.Origin.SetValue(null, workPart.ModelingViews.WorkView, startVertex);
        pmiNoteBuilder11.VerticalText = true;
        pmiNoteBuilder11.Text.TextBlock.CustomSymbolScale = 1.0;
        pmiNoteBuilder11.Style.LetteringStyle.AppendedNxTextCharacterSpaceFactor = 0.2;
        pmiNoteBuilder11.Style.LetteringStyle.GeneralTextAspectRatio = 1.0;
        pmiNoteBuilder11.Style.LetteringStyle.GeneralTextCharSpaceFactor = 0.0;
        int fontIndex3 = workPart.Fonts.AddFont("Arial Unicode MS", NXOpen.FontCollection.Type.Standard);
        if (workPart.Fonts.DoesFontExist(fontIndex3))
        {
            pmiNoteBuilder11.Style.LetteringStyle.GeneralTextFont = fontIndex3;
        }
        pmiNoteBuilder11.TextAlignment = NXOpen.Annotations.DraftingNoteBuilder.TextAlign.Middle;
        pmiNoteBuilder11.Style.LetteringStyle.GeneralTextColor = workPart.Colors.Find(216);
        NXObject note1 = pmiNoteBuilder11.Commit();
        pmiNoteBuilder11.Destroy();

//===================================================================

1 REPLY

Re: About leader stubside

Tested your code in NX10 and NX11.  It produces the right result for the leader side.