码迷,mamicode.com
首页 > 其他好文 > 详细

NXOpen遍历尺寸 UF获取尺寸值

时间:2021-04-15 11:59:30      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:clu   遍历   cti   alt   bsp   write   view   循环   work   

VS2010  NX8.5

 

#include <NXOpen/Annotations_Dimension.hxx>
#include <NXOpen/Annotations_DimensionCollection.hxx>
#include <NXOpen/Annotations.hxx>
#include <NXOpen/Drawings_DraftingView.hxx>
#include <NXOpen/Drawings_DraftingViewCollection.hxx>

 

 

UF_initialize();
//遍历图纸上的标注尺寸
NXOpen::Annotations::Dimension*Dimensions;//定义类型
vector<NXOpen::Annotations::Dimension*> DimensionsVector;//尺寸vector
NXOpen::Annotations::DimensionCollection *DIM=workPart->Dimensions();//迭代
NXOpen::Annotations::DimensionCollection::iterator itr = workPart->Dimensions()->begin();
for (;itr!=DIM->end();++itr) //循环获得所有尺寸
{
Dimensions=(*itr); //获得尺寸
DimensionsVector.push_back(Dimensions);
Point3d DimOrigin = Dimensions->AnnotationOrigin();//获取尺寸的位置
sprintf(msg,"尺寸位置 X:%.2f Y:%.2f Z:%.2f",DimOrigin.X,DimOrigin.Y,DimOrigin.Z);
theSession->ListingWindow()->WriteLine(msg);
//获取尺寸的值
int dim_type = 0;//尺寸的类型
double dim_origin[3];//原点坐标
UF_DRF_dim_info_p_t dim_info;
UF_DRF_ask_dim_info(Dimensions->Tag(), &dim_type, dim_origin, &dim_info);
string DimValue = dim_info->text_info->text->string;
theSession->ListingWindow()->WriteLine(DimValue);

}

UF_terminate();

 

技术图片

 

NXOpen遍历尺寸 UF获取尺寸值

标签:clu   遍历   cti   alt   bsp   write   view   循环   work   

原文地址:https://www.cnblogs.com/hqsalanhuang/p/14657015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!