怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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();

 

 

posted on 2021-04-14 11:26  怡宁塑胶模具设计  阅读(511)  评论(0编辑  收藏  举报