admin 发表于 2018-3-30 16:37:06

NX二次开发源码分享:最简单的创建PMI Note方法


NX二次开发源码分享:最简单的创建PMI Note方法

void CreatePmiNote(NXOpen::Point3d &pt)
{
    // ----------------------------------------------
    //   Menu: PMI->Note...
    // ----------------------------------------------
    NXOpen::Session::UndoMarkId markId1;
    markId1 = m_session->SetUndoMark(NXOpen::Session::MarkVisibilityVisible, "NXOPEN_PMINOTE");

    NXOpen::Annotations::SimpleDraftingAid *nullNXOpen_Annotations_SimpleDraftingAid(NULL);
    NXOpen::Annotations::PmiNoteBuilder *pmiNoteBuilder1;
    pmiNoteBuilder1 = m_wpart->Annotations()->CreatePmiNoteBuilder(nullNXOpen_Annotations_SimpleDraftingAid);
    std::vector<NXOpen::NXString> text1(1);
    text1 = "PMI Note";
    pmiNoteBuilder1->Text()->TextBlock()->SetText(text1);
    pmiNoteBuilder1->SetTextAlignment(NXOpen::Annotations::DraftingNoteBuilder::TextAlignBelowTopExtToMax);
    NXOpen::View *nullNXOpen_View(NULL);
    pmiNoteBuilder1->Origin()->Origin()->SetValue(NULL, nullNXOpen_View, pt);
    pmiNoteBuilder1->Origin()->Plane()->SetPlaneMethod(NXOpen::Annotations::PlaneBuilder::PlaneMethodTypeModelView);
    pmiNoteBuilder1->Origin()->SetInferRelativeToGeometry(true);
    pmiNoteBuilder1->Origin()->SetAnchor(NXOpen::Annotations::OriginBuilder::AlignmentPositionBottomLeft);

    NXOpen::NXObject *nXObject1 = pmiNoteBuilder1->Commit();
    pmiNoteBuilder1->Destroy();
}
页: [1]
查看完整版本: NX二次开发源码分享:最简单的创建PMI Note方法