zoukankan      html  css  js  c++  java
  • NX二次开发-获取图纸尺寸上椭圆边界框的大小

    void AskDimBoundary(tag_t dim_tag)
    {
           //获得尺寸字体大小
           int dim_subtype = 0;
           double dim_origin[3];
           UF_DRF_dim_info_p_t dim_info;
           UF_DRF_ask_dim_info(dim_tag, &dim_subtype, dim_origin, &dim_info);
           double DimSize = dim_info->text_info->size;
           NXOpen::Session *theSession = NXOpen::Session::GetSession();
           NXOpen::Part *workPart(theSession->Parts()->Work());
           NXOpen::Part *displayPart(theSession->Parts()->Display());
           //获得尺寸的高度因子
           NXOpen::Annotations::HorizontalDimension *horizontalDimension1(dynamic_cast<NXOpen::Annotations::HorizontalDimension *>(NXOpen::NXObjectManager::Get(dim_tag)));
           NXOpen::Annotations::LinearDimensionBuilder *linearDimensionBuilder1;
           linearDimensionBuilder1 = workPart->Dimensions()->CreateLinearDimensionBuilder(horizontalDimension1);
           double height_size = linearDimensionBuilder1->Style()->LetteringStyle()->GdtFrameHeightFactor();
           //计算椭圆框的高度(字体大小*高度因子)
           double block_height = DimSize * height_size;
           //计算椭圆框的宽度(字体大小*高度因子*2)
           double block_length = DimSize * height_size * 2;
           
           //打印
           char msg[256];
           sprintf_s(msg, "高度%f 宽度%f", block_height, block_length);
           UF_UI_open_listing_window();
           UF_UI_write_listing_window(msg);
    }
     
    宽度乘以2我记得好像是之前请教的唐工
     
    阿飞
    2021年8月2日
  • 相关阅读:
    python INFO: Can't locate Tcl/Tk libs and/or headers
    关于 android 中 postDelayed方法的讲解
    python两个dataframe的合并
    Android异步加载访问网络图片-解析json
    ThinkCMF----调用指定栏目的文章列表
    thinkCMF----使用自定义函数
    thinkCMF----公共模板的引入
    thinkCMF----如何写标签
    thinkCMF----列表页跳转
    thinkCMF----导航高亮显示
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/14880081.html
Copyright © 2011-2022 走看看