上等兵
UID2290366
U币1
G币127
技术0
主题1
精华0
阅读权限20
注册时间2015-1-15
最后登录2020-3-12
在线时间14 小时
上等兵
|
初学NXOpenC++,需要创建PMI注释,根据录制编写代码,但运行到pmiNoteBuilder->Text()->TextBlock()->SetText( strArrText ); 总是出错,提示:存储管理器中错误的内存定位请求大小(内存出错)。很简单的代码,不知道为什么会有这样的问题,请教各位大神,谢谢!
附代码:
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart = NULL;
workPart = theSession->Parts()->Work();
NXOpen::Annotations::PmiNoteBuilder *pmiNoteBuilder = NULL;
NXOpen::Annotations::SimpleDraftingAid *simpleDraftingAid = NULL;
pmiNoteBuilder = workPart->Annotations()->CreatePmiNoteBuilder( simpleDraftingAid );
pmiNoteBuilder->Origin()->Plane()->SetPlaneMethod( NXOpen::Annotations::PlaneBuilder::PlaneMethodTypeXyPlane );
pmiNoteBuilder->Origin()->SetInferRelativeToGeometry(false);
NXOpen::Annotations::OriginBuilder::AlignmentPosition setAnchor = NXOpen::Annotations::OriginBuilder::AlignmentPositionMidCenter ;
pmiNoteBuilder->Origin()->SetAnchor( setAnchor );
std::vector< NXOpen::NXString > strArrText(6);
strArrText[0] = NXOpen::NXString( "JianCeDian 1", NXOpen::NXString::Locale );
strArrText[1] = NXOpen::NXString( "LiLunZhi : (X)-72.836 (Y)47.835 (Z)0.000", NXOpen::NXString::Locale );
strArrText[2] = NXOpen::NXString( "ShiCeZhi: (X)-72.836 (Y)47.835 (Z)0.000", NXOpen::NXString::Locale );
strArrText[3] = NXOpen::NXString( "ZhouXiangPianChaZhi: (X)0.0054 (Y)0.2154 (Z)0.0254", NXOpen::NXString::Locale );
strArrText[4] = NXOpen::NXString( "ZongHeWuChaZhi: 0.005 (NG)", NXOpen::NXString::Locale );
strArrText[5] = "";
pmiNoteBuilder->Text()->TextBlock()->SetText( strArrText );
------------------------------------------------------
#include <NXOpen/Session.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/Features_BlockFeatureBuilder.hxx>
#include <NXOpen/Features_Block.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Features_FeatureCollection.hxx>
#include <NXOpen/UI.hxx>
#include <NXOpen/NXMessageBox.hxx>
#include <NXOPEN/NXString.hxx>
#include <NXOpen/NXException.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/Annotations_AnnotationManager.hxx>
#include <NXOpen/Annotations_AssociatedObjectsBuilder.hxx>
#include <NXOpen/Annotations_DimensionStyleBuilder.hxx>
#include <NXOpen/Annotations_DraftingNoteBuilder.hxx>
#include <NXOpen/Annotations_FrameBarElementStyleBuilder.hxx>
#include <NXOpen/Annotations_FrameBarStyleBuilder.hxx>
#include <NXOpen/Annotations_HatchStyleBuilder.hxx>
#include <NXOpen/Annotations_LeaderBuilder.hxx>
#include <NXOpen/Annotations_LeaderData.hxx>
#include <NXOpen/Annotations_LeaderDataList.hxx>
#include <NXOpen/Annotations_LetteringStyleBuilder.hxx>
#include <NXOpen/Annotations_LineArrowStyleBuilder.hxx>
#include <NXOpen/Annotations_OrdinateStyleBuilder.hxx>
#include <NXOpen/Annotations_OriginBuilder.hxx>
#include <NXOpen/Annotations_PlaneBuilder.hxx>
#include <NXOpen/Annotations_PmiNoteBuilder.hxx>
#include <NXOpen/Annotations_RadialStyleBuilder.hxx>
#include <NXOpen/Annotations_StyleBuilder.hxx>
#include <NXOpen/Annotations_SymbolStyleBuilder.hxx>
#include <NXOpen/Annotations_TextWithEditControlsBuilder.hxx>
#include <NXOpen/Annotations_TextWithSymbolsBuilder.hxx>
#include <NXOpen/Annotations_UnitsStyleBuilder.hxx>
#include <NXOpen/Builder.hxx>
#include <NXOpen/Drawings_SelectDraftingView.hxx>
#include <NXOpen/ModelingView.hxx>
#include <NXOpen/ModelingViewCollection.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/ObjectList.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Point.hxx>
#include <NXOpen/PointCollection.hxx>
#include <NXOpen/SelectDisplayableObject.hxx>
#include <NXOpen/SelectDisplayableObjectList.hxx>
#include <NXOpen/SelectObject.hxx>
#include <NXOpen/SelectObjectList.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/TaggedObject.hxx>
#include <NXOpen/Xform.hxx>
//
|
|