zoukankan      html  css  js  c++  java
  • 创建注释

     1 static void aa()
     2 {
     3     NXOpen::Session* theSession = NXOpen::Session::GetSession();
     4     NXOpen::Part* workPart(theSession->Parts()->Work());
     5     NXOpen::Part* displayPart(theSession->Parts()->Display());
     6     NXOpen::ModelingView* modelingView1(dynamic_cast<NXOpen::ModelingView*>(workPart->ModelingViews()->FindObject("Trimetric")));
     7     NXOpen::Matrix3x3 matrix1;
     8     matrix1.Xx = 1.0;
     9     matrix1.Xy = 0.0;
    10     matrix1.Xz = 0.0;
    11     matrix1.Yx = 0.0;
    12     matrix1.Yy = 1.0;
    13     matrix1.Yz = 0.0;
    14     matrix1.Zx = 0.0;
    15     matrix1.Zy = 0.0;
    16     matrix1.Zz = 1.0;
    17     modelingView1->Orient(matrix1);
    18     // ----------------------------------------------
    19     //   Menu: 插入(S)->注释(A)->注释(N)...
    20     // ----------------------------------------------
    21     NXOpen::Annotations::SimpleDraftingAid* nullNXOpen_Annotations_SimpleDraftingAid(NULL);
    22     NXOpen::Annotations::DraftingNoteBuilder* draftingNoteBuilder1;
    23     draftingNoteBuilder1 = workPart->Annotations()->CreateDraftingNoteBuilder(nullNXOpen_Annotations_SimpleDraftingAid);
    24     draftingNoteBuilder1->Origin()->SetInferRelativeToGeometry(true);
    25     draftingNoteBuilder1->Origin()->SetAnchor(NXOpen::Annotations::OriginBuilder::AlignmentPositionMidCenter);
    26     std::vector<NXOpen::NXString> text1(1);
    27     text1[0] = "a";
    28     draftingNoteBuilder1->Text()->TextBlock()->SetText(text1);
    29     draftingNoteBuilder1->Origin()->Plane()->SetPlaneMethod(NXOpen::Annotations::PlaneBuilder::PlaneMethodTypeXyPlane);
    30     draftingNoteBuilder1->Origin()->SetInferRelativeToGeometry(true);
    31     NXOpen::Annotations::LeaderData* leaderData1;
    32     leaderData1 = workPart->Annotations()->CreateLeaderData();
    33     leaderData1->SetArrowhead(NXOpen::Annotations::LeaderData::ArrowheadTypeFilledArrow);
    34     leaderData1->SetVerticalAttachment(NXOpen::Annotations::LeaderVerticalAttachmentCenter);
    35     draftingNoteBuilder1->Leader()->Leaders()->Append(leaderData1);
    36     leaderData1->SetArrowhead(NXOpen::Annotations::LeaderData::ArrowheadTypeClosedArrow);
    37     leaderData1->SetStubSide(NXOpen::Annotations::LeaderSideInferred);
    38     leaderData1->SetStubSize(6.3499999999999996);
    39     double symbolscale1;
    40     symbolscale1 = draftingNoteBuilder1->Text()->TextBlock()->SymbolScale();
    41     double symbolaspectratio1;
    42     symbolaspectratio1 = draftingNoteBuilder1->Text()->TextBlock()->SymbolAspectRatio();
    43     draftingNoteBuilder1->Origin()->SetInferRelativeToGeometry(true);
    44     // ----------------------------------------------
    45     //   Dialog Begin 注释设置
    46     // ----------------------------------------------
    47     int fontIndex1;
    48     fontIndex1 = workPart->Fonts()->AddFont("hershey-sans", NXOpen::FontCollection::TypeNx);
    49     draftingNoteBuilder1->Style()->LetteringStyle()->SetGeneralTextFont(9);
    50     int fontIndex2;
    51     fontIndex2 = workPart->Fonts()->AddFont("hershey-sans", NXOpen::FontCollection::TypeNx);
    52     draftingNoteBuilder1->Style()->LetteringStyle()->SetGeneralTextLineWidth(NXOpen::Annotations::LineWidthThick);
    53     draftingNoteBuilder1->Style()->LetteringStyle()->SetGeneralTextSize(3.0);
    54     draftingNoteBuilder1->Style()->LetteringStyle()->SetGeneralTextCharSpaceFactor(0.1);
    55     draftingNoteBuilder1->Style()->LetteringStyle()->SetGeneralTextAspectRatio(0.6);
    56     NXOpen::Annotations::Annotation::AssociativeOriginData assocOrigin1;
    57     assocOrigin1.OriginType = NXOpen::Annotations::AssociativeOriginTypeDrag;
    58     NXOpen::View* nullNXOpen_View(NULL);
    59     assocOrigin1.View = nullNXOpen_View;
    60     assocOrigin1.ViewOfGeometry = nullNXOpen_View;
    61     NXOpen::Point* nullNXOpen_Point(NULL);
    62     assocOrigin1.PointOnGeometry = nullNXOpen_Point;
    63     NXOpen::Annotations::Annotation* nullNXOpen_Annotations_Annotation(NULL);
    64     assocOrigin1.VertAnnotation = nullNXOpen_Annotations_Annotation;
    65     assocOrigin1.VertAlignmentPosition = NXOpen::Annotations::AlignmentPositionTopLeft;
    66     assocOrigin1.HorizAnnotation = nullNXOpen_Annotations_Annotation;
    67     assocOrigin1.HorizAlignmentPosition = NXOpen::Annotations::AlignmentPositionTopLeft;
    68     assocOrigin1.AlignedAnnotation = nullNXOpen_Annotations_Annotation;
    69     assocOrigin1.DimensionLine = 0;
    70     assocOrigin1.AssociatedView = nullNXOpen_View;
    71     assocOrigin1.AssociatedPoint = nullNXOpen_Point;
    72     assocOrigin1.OffsetAnnotation = nullNXOpen_Annotations_Annotation;
    73     assocOrigin1.OffsetAlignmentPosition = NXOpen::Annotations::AlignmentPositionTopLeft;
    74     assocOrigin1.XOffsetFactor = 0.0;
    75     assocOrigin1.YOffsetFactor = 0.0;
    76     assocOrigin1.StackAlignmentPosition = NXOpen::Annotations::StackAlignmentPositionAbove;
    77     draftingNoteBuilder1->Origin()->SetAssociativeOrigin(assocOrigin1);
    78     NXOpen::Point3d point1(0.0, 0.0, 0.0);
    79     draftingNoteBuilder1->Origin()->Origin()->SetValue(NULL, nullNXOpen_View, point1);
    80     draftingNoteBuilder1->Origin()->SetInferRelativeToGeometry(true);
    81     NXOpen::NXObject* nXObject1;
    82     nXObject1 = draftingNoteBuilder1->Commit();
    83     draftingNoteBuilder1->Destroy();
    84 }
  • 相关阅读:
    【bzoj2280】[Poi2011]Plot 二分+倍增+二分+最小圆覆盖
    【bzoj1336/1337/2823】[Balkan2002]Alien最小圆覆盖 随机增量法
    【bzoj4999】This Problem Is Too Simple! 树链剖分+动态开点线段树
    【bzoj3435】[Wc2014]紫荆花之恋 替罪点分树套SBT
    【bzoj3217】ALOEXT 替罪羊树套Trie树
    【bzoj3065】带插入区间K小值 替罪羊树套权值线段树
    【bzoj4012】[HNOI2015]开店 动态点分治+STL-vector
    【bzoj3924】[Zjoi2015]幻想乡战略游戏 动态点分治
    【bzoj1095】[ZJOI2007]Hide 捉迷藏 动态点分治+堆
    【bzoj3329】Xorequ 数位dp+矩阵乘法
  • 原文地址:https://www.cnblogs.com/liuxiaoqing1/p/13572761.html
Copyright © 2011-2022 走看看