找回密码
 立即注册

QQ登录

只需一步,快速开始

微信扫码登录

搜索
查看: 2425|回复: 1

[求助] 创建PMI注释

[复制链接]

1

主题

10

回帖

153

积分

上等兵

积分
153
发表于 2018-3-19 10:55:03 | 显示全部楼层 |阅读模式
初学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>

//

3

主题

19

回帖

184

积分

上等兵

积分
184
发表于 2019-5-16 17:33:43 | 显示全部楼层
内存问题应该是电脑缓存的问题,删除temp下缓存文件
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

咨询QQ:1359218528|发帖须知!|Archiver|手机版|小黑屋|UG爱好者论坛 ( 京ICP备10217105号-2 )

GMT+8, 2024-12-23 08:48

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表