【封闭系列】size_t

本文深入探讨了C++中的size_t类型、numeric_limits类、static_cast运算符、typename与class关键字的区别及应用,以及vector的reserve和resize方法的具体含义与使用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. size_t 

size_t 类型定义在cstddef头文件中,该文件是C标准库的头文件stddef.h的C++版。它是一个与机器相关的unsigned类型,其大小足以保证存储内存中对象的大小。

在C++中,设计 size_t 就是为了适应多个平台的 。size_t的引入增强了程序在不同平台上的可移植性。size_t是针对系统定制的一种数据类型,一般是整形,因为C/C++标准只定义一最低的位数, 而不是必需的固定位数。而且在内存里,对数的高位对齐存储还是低位对齐存储各系统都不一样。为了提高代码的可移植性,就有必要定议这样的数据类型。一般这种类型都会定义到它具体占几位内存等。当然,有些是编译器或系统已经给定义好的。经测试发现,在32位系统中size_t是4字节的,而在64位系统中,size_t是8字节的,这样利用该类型可以增强程序的可移植性。

 

2. 

http://support.microsoft.com/kb/156810

Representation of positive infinity for float " <<
        numeric_limits<float>::infinity() << endl;

numeric_limits 类提供有关给定类型的信息。例如对于您可以确定给定的类型是否已签名或完全或方式,它可能表示无穷大。
标准库的 char、 bool、 有符号的字符、 无符号的字符,较短的无符号短,int、 无符号的整数、 长的无符号长,浮点,双,和长双实例化 numeric_limits。 此类可能还能实例化的用户定义的类型。

下面的代码示例阐释如何使用 Visual c + + 中的从 numeric_limits 类以下成员:

 

3. 用法:static_cast < type-id > ( expression )

  该运算符expression转换为type-id类型,但没有运行时类型检查来保证转换的安全性。它主要有如下几种用法:

  ①用于类层次结构中基类(父类)和派生类(子类)之间指针或引用的转换。

  进行上行转换(把派生类的指针或引用转换成基类表示)是安全的;

  进行下行转换(把基类指针或引用转换成派生类表示)时,由于没有动态类型检查,所以是不安全的。

  ②用于基本数据类型之间的转换,如把int转换成char,把int转换成enum。这种转换的安全性也要开发人员来保证。

  ③把空指针转换成目标类型的空指针。

  ④把任何类型的表达式转换成void类型。

  注意:static_cast不能转换掉expression的const、volitale、或者__unaligned属性。

  

   C++primer第五章里写了 编译器隐式执行任何类型转换都可由static_cast显示完成;

   C++中的static_cast执行非 多态 的转换,用于代替C中通常的转换操作。因此,被做为隐式类型转换使用。比如:

  int i;

  float f = 166.7f;

  i = static_cast<int>(f);

  此时结果,i的值为166。

 

4. C++ Template 中的typename、class关键字

http://blog.youkuaiyun.com/wzq981264/article/details/705002

在c++Template中很多地方都用到了typename与class这两个关键字,而且好像可以替换,是不是这两个关键字完全一样呢?
相信学习C++的人对class这个关键字都非常明白,class用于定义类,在模板引入c++后,最初定义模板的方法为: template<class T>......

这里class关键字表明T是一个类型,后来为了避免class在这两个地方的使用可能给人带来混淆,所以引入了typename这个关键字,它的作用同
class一样表明后面的符号为一个类型,这样在定义模板的时候就可以使用下面的方式了: template<typename
T>......
在模板定义语法中关键字class与typename的作用完全一样。
typename难道仅仅在模板定义中起作用吗?其实不是这样,typename另外一个作用为:使用嵌套依赖类型(nested depended name)

+++++++++++++++++++++++++++++++++++++++++++++++++++

为什么我不能运行????????????

#include<iostream>
using namespace std;

  template <typename T>
     int compare(const T &v1, const T &v2)
     {
         if (v1 < v2) return -1;
         if (v2 < v1) return 1;
         return 0;
     }    
int main ()
     {
         // T is int;
         // compiler instantiates int compare(const int&, const int&)
         cout << compare(1, 0) << endl;
         // T is string;
         // compiler instantiates int compare(const string&, const string&)
         string s1 = "hi", s2 = "world";
         cout << compare(s1, s2) << endl;
         return 0;
     }

因为string 类型没有默认的>.<的运算,所以出错。
你可以把这两句注释掉再跑,就没有问题。 如果你想比较字符串大小,需要先重载字符串的operator>,operator<

+++++++++++++++++++++++++++++++++++++++++++++++++++++

 5.  vector的reserve 

   vector 的reserve增加了vector的capacity,但是它的size没有改变!而resize改变了vector的capacity同时也增加了它的size!
原因如下:
       reserve是容器预留空间,但在空间内不真正创建元素对象,所以在没有添加新的对象之前,不能引用容器内的元素。加入新的元素时,要调用push_back()/insert()函数。

       resize是改变容器的大小,且在创建对象,因此,调用这个函数之后,就可以引用容器内的对象了,因此当加入新的元素时,用operator[]操作符,或者用迭代器来引用元素对象。此时再调用push_back()函数,是加在这个新的空间后面的。

 

 

int qiaowei_tool::apply_cb() { int errorCode = 0; // 错误代码,0表示成功 try { // 获取NX会话和工作部件 NXOpen::Session* theSession = NXOpen::Session::GetSession(); NXOpen::Part* workPart = theSession->Parts()->Work(); NXOpen::UI* theUI = NXOpen::UI::GetUI(); // ===== 1. 获取边界边曲线 ===== std::vector<NXOpen::Curve*> boundaryCurves; if (bianjie_edge) { // 获取曲线选择器属性列表 std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(bianjie_edge->GetProperties()); // 获取选中的对象集合 std::vector<NXOpen::TaggedObject*> selObjs = props->GetTaggedObjectVector("SelectedObjects"); // 遍历选中对象并转换为曲线 for (NXOpen::TaggedObject* obj : selObjs) { if (NXOpen::Curve* curve = dynamic_cast<NXOpen::Curve*>(obj)) { boundaryCurves.push_back(curve); } } } // ===== 2. 获取出料边曲线 ===== std::vector<NXOpen::Curve*> dischargeCurves; if (chuliao_edge) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(chuliao_edge->GetProperties()); std::vector<NXOpen::TaggedObject*> selObjs = props->GetTaggedObjectVector("SelectedObjects"); for (NXOpen::TaggedObject* obj : selObjs) { if (NXOpen::Curve* curve = dynamic_cast<NXOpen::Curve*>(obj)) { dischargeCurves.push_back(curve); } } } // ===== 3. 获取出料沉桥值 ===== double materialThickness = 0.0; if (expression_clcq) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_clcq->GetProperties()); // 获取表达式数值 materialThickness = props->GetDouble("Value"); } // ===== 4. 获取上模厚度值 ===== double scanHeight = 0.0; if (expression_smh) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_smh->GetProperties()); scanHeight = props->GetDouble("Value"); } // ===== 5. 获取进料沉桥值 ===== double clearanceValue = 0.0; if (expression_jlcq) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_jlcq->GetProperties()); clearanceValue = props->GetDouble("Value"); } // ===== 6. 获取倒桥角度值 ===== double currentAngle = 0.0; if (expression_dqjiaodu) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_dqjiaodu->GetProperties()); currentAngle = props->GetDouble("Value"); } // ===== 7. 获取倒角开关状态 ===== bool chamferToggle = false; if (toggle_daojiao) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(toggle_daojiao->GetProperties()); // 获取开关状态(选中/未选中) chamferToggle = props->GetLogical("Value"); } // ===== 8. 获取倒角半径值 ===== double chamferRadius = 0.0; if (expression_rjiao && chamferToggle) // 仅在倒角开启时获取 { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_rjiao->GetProperties()); chamferRadius = props->GetDouble("Value"); } // ===== 9. 获取偏移开关状态 ===== bool offsetToggle = false; if (toggle_pianzhi) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(toggle_pianzhi->GetProperties()); offsetToggle = props->GetLogical("Value"); } // ===== 10. 获取偏移距离值 ===== double offsetDistance = 0.0; if (expression_pianzhi && offsetToggle) // 仅在偏移开启时获取 { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(expression_pianzhi->GetProperties()); offsetDistance = props->GetDouble("Value"); } // ===== 11. 获取矢量方向 ===== NXOpen::Vector3d directionVector(0.0, 0.0, 1.0); // 默认Z轴方向 if (vector0) { std::unique_ptr<NXOpen::BlockStyler::PropertyList> props(vector0->GetProperties()); // 获取用户指定的矢量方向 directionVector = props->GetVector("Vector"); } // ===== 12. 验证必要输入 ===== if (boundaryCurves.size() < 2) { throw std::runtime_error("需要选择两条桥位边界曲线!"); } if (dischargeCurves.empty()) { throw std::runtime_error("出料边曲线未选择!"); } if (scanHeight <= 0) { throw std::runtime_error("上模厚度必须大于0!"); } //// ===== 13. 计算两条边界曲线端点间的最短距离并创建两条连接直线 ===== try { // 获取前两条边界曲线 NXOpen::Curve* curve1 = boundaryCurves[0]; NXOpen::Curve* curve2 = boundaryCurves[1]; // 声明存储曲线端点的数组 double curve1Start[3] = { 0.0, 0.0, 0.0 }; // 曲线1起点坐标 double curve1End[3] = { 0.0, 0.0, 0.0 }; // 曲线1终点坐标 double curve2Start[3] = { 0.0, 0.0, 0.0 }; // 曲线2起点坐标 double curve2End[3] = { 0.0, 0.0, 0.0 }; // 曲线2终点坐标 // 获取第一条曲线的端点 tag_t curve1Tag = curve1->Tag(); UF_EVAL_p_t evaluator1 = NULL; if (UF_EVAL_initialize(curve1Tag, &evaluator1) != 0) { throw std::runtime_error("无法初始化曲线1的评估器"); } double limits1[2]; if (UF_EVAL_ask_limits(evaluator1, limits1) != 0) { UF_EVAL_free(evaluator1); throw std::runtime_error("无法获取曲线1的参数范围"); } // 确保参数范围从小到大排序 if (limits1[0] > limits1[1]) { std::swap(limits1[0], limits1[1]); } // 评估曲线1的起点 if (UF_EVAL_evaluate(evaluator1, 0, limits1[0], curve1Start, NULL) != 0) { UF_EVAL_free(evaluator1); throw std::runtime_error("无法评估曲线1的起点"); } // 评估曲线1的终点 if (UF_EVAL_evaluate(evaluator1, 0, limits1[1], curve1End, NULL) != 0) { UF_EVAL_free(evaluator1); throw std::runtime_error("无法评估曲线1的终点"); } UF_EVAL_free(evaluator1); // 获取第二条曲线的端点 tag_t curve2Tag = curve2->Tag(); UF_EVAL_p_t evaluator2 = NULL; if (UF_EVAL_initialize(curve2Tag, &evaluator2) != 0) { throw std::runtime_error("无法初始化曲线2的评估器"); } double limits2[2]; if (UF_EVAL_ask_limits(evaluator2, limits2) != 0) { UF_EVAL_free(evaluator2); throw std::runtime_error("无法获取曲线2的参数范围"); } // 确保参数范围从小到大排序 if (limits2[0] > limits2[1]) { std::swap(limits2[0], limits2[1]); } // 评估曲线2的起点 if (UF_EVAL_evaluate(evaluator2, 0, limits2[0], curve2Start, NULL) != 0) { UF_EVAL_free(evaluator2); throw std::runtime_error("无法评估曲线2的起点"); } // 评估曲线2的终点 if (UF_EVAL_evaluate(evaluator2, 0, limits2[1], curve2End, NULL) != 0) { UF_EVAL_free(evaluator2); throw std::runtime_error("无法评估曲线2的终点"); } UF_EVAL_free(evaluator2); // 转换为NXOpen点对象 NXOpen::Point3d p1_start(curve1Start[0], curve1Start[1], curve1Start[2]); NXOpen::Point3d p1_end(curve1End[0], curve1End[1], curve1End[2]); NXOpen::Point3d p2_start(curve2Start[0], curve2Start[1], curve2Start[2]); NXOpen::Point3d p2_end(curve2End[0], curve2End[1], curve2End[2]); // 计算两点间距离的函数 auto distance = [](const NXOpen::Point3d& a, const NXOpen::Point3d& b) -> double { return sqrt(pow(a.X - b.X, 2) + pow(a.Y - b.Y, 2) + pow(a.Z - b.Z, 2)); }; // 计算四种可能的端点组合距离 double dist1 = distance(p1_start, p2_start); double dist2 = distance(p1_start, p2_end); double dist3 = distance(p1_end, p2_start); double dist4 = distance(p1_end, p2_end); // 找出最小距离对应的点对 double minDist = std::min({ dist1, dist2, dist3, dist4 }); NXOpen::Point3d minPoint1, minPoint2; int minIndex = 0; if (minDist == dist1) { minPoint1 = p1_start; minPoint2 = p2_start; minIndex = 1; } else if (minDist == dist2) { minPoint1 = p1_start; minPoint2 = p2_end; minIndex = 2; } else if (minDist == dist3) { minPoint1 = p1_end; minPoint2 = p2_start; minIndex = 3; } else { minPoint1 = p1_end; minPoint2 = p2_end; minIndex = 4; } // 确定剩余的两个端点 NXOpen::Point3d remainingPoint1, remainingPoint2; auto isPointEqual = [](const NXOpen::Point3d& a, const NXOpen::Point3d& b, double tolerance = 1e-6) -> bool { return (fabs(a.X - b.X) < tolerance) && (fabs(a.Y - b.Y) < tolerance) && (fabs(a.Z - b.Z) < tolerance); }; // 对于曲线1,找出未使用的端点 if (isPointEqual(minPoint1, p1_start)) { remainingPoint1 = p1_end; } else { remainingPoint1 = p1_start; } // 对于曲线2,找出未使用的端点 if (isPointEqual(minPoint2, p2_start)) { remainingPoint2 = p2_end; } else { remainingPoint2 = p2_start; } // ===== 14. 创建两条连接直线 ===== try { // 创建第一条直线(最短距离连接) UF_CURVE_line_t line1Coords; line1Coords.start_point[0] = minPoint1.X; line1Coords.start_point[1] = minPoint1.Y; line1Coords.start_point[2] = minPoint1.Z; line1Coords.end_point[0] = minPoint2.X; line1Coords.end_point[1] = minPoint2.Y; line1Coords.end_point[2] = minPoint2.Z; tag_t line1Tag = NULL_TAG; int status1 = UF_CURVE_create_line(&line1Coords, &line1Tag); if (status1 != 0 || line1Tag == NULL_TAG) { throw std::runtime_error("创建最短距离直线失败"); } // 设置第一条直线属性) int workLayer = workPart->Layers()->WorkLayer(); UF_OBJ_set_layer(line1Tag, workLayer); UF_OBJ_set_color(line1Tag, 31); // 改色 // 创建第二条直线(剩余端点连接) UF_CURVE_line_t line2Coords; line2Coords.start_point[0] = remainingPoint1.X; line2Coords.start_point[1] = remainingPoint1.Y; line2Coords.start_point[2] = remainingPoint1.Z; line2Coords.end_point[0] = remainingPoint2.X; line2Coords.end_point[1] = remainingPoint2.Y; line2Coords.end_point[2] = remainingPoint2.Z; tag_t line2Tag = NULL_TAG; int status2 = UF_CURVE_create_line(&line2Coords, &line2Tag); if (status2 != 0 || line2Tag == NULL_TAG) { // 即使第二条直线失败,第一条直线已创建 throw std::runtime_error("创建剩余端点直线失败"); } // 设置第二条直线属性 UF_OBJ_set_layer(line2Tag, workLayer); UF_OBJ_set_color(line2Tag, 31); // 改色 // 计算第二条直线的距离 double remainingDist = distance(remainingPoint1, remainingPoint2); // 更新显示 UF_DISP_refresh(); // 显示成功信息 char msg[256]; snprintf(msg, sizeof(msg), "已创建两条连接直线:\n" "1. 最短距离直线: %.2f mm (青色)\n" "2. 剩余端点直线: %.2f mm (青色)", minDist, remainingDist); theUI->NXMessageBox()->Show("操作成功", NXOpen::NXMessageBox::DialogTypeInformation, msg); } catch (std::exception& ex) { char errMsg[256]; snprintf(errMsg, sizeof(errMsg), "创建直线失败: %s", ex.what()); theUI->NXMessageBox()->Show("错误", NXOpen::NXMessageBox::DialogTypeError, errMsg); errorCode = 2; } } catch (std::exception& ex) { char errMsg[256]; snprintf(errMsg, sizeof(errMsg), "端点距离计算失败: %s", ex.what()); theUI->NXMessageBox()->Show("错误", NXOpen::NXMessageBox::DialogTypeError, errMsg); errorCode = 2; } } catch (exception& ex) { // 捕获并显示通用错误 char errMsg[256]; snprintf(errMsg, sizeof(errMsg), "错误: %s", ex.what()); theUI->NXMessageBox()->Show("MiCH-明提示", NXOpen::NXMessageBox::DialogTypeError, errMsg); errorCode = 1; } return errorCode; // 确保返回错误代码 }请在创建直线后把下方拉伸代码加上,: // ===== 3. 创建拉伸特征 ===== if (!sectionCurves1.empty() && hk1sdValue != 0.0) { // 设置撤销标记 NXOpen::Session::UndoMarkId markId = theSession->SetUndoMark( NXOpen::Session::MarkVisibilityVisible, "后空一级"); // 创建拉伸构建器 NXOpen::Features::ExtrudeBuilder* extrudeBuilder = workPart->Features()->CreateExtrudeBuilder(nullptr); // 创建截面 NXOpen::Section* section = workPart->Sections()->CreateSection( 0.001, 0.001, 0.05); extrudeBuilder->SetSection(section); // 创建曲线规则 - 使用dumb规则 std::vector<NXOpen::SelectionIntentRule*> rules; if (!sectionCurves1.empty()) { // 创建dumb曲线规则 - 直接传递曲线向量 NXOpen::SelectionIntentRule* curveRule = workPart->ScRuleFactory()->CreateRuleCurveDumb(sectionCurves1); rules.push_back(curveRule); } // 获取帮助点(曲线中点)- 使用UF_CURVE_ask_centroid获取曲线中心点 NXOpen::Point3d helpPoint(0.0, 0.0, 0.0); if (!sectionCurves1.empty()) { double centroid[3] = { 0.0, 0.0, 0.0 }; // 使用UF函数获取曲线中心点 if (UF_CURVE_ask_centroid(sectionCurves1[0]->Tag(), centroid) == 0) { helpPoint = NXOpen::Point3d(centroid[0], centroid[1], centroid[2]); } else { // 如果获取中心点失败,使用曲线端点作为备选 tag_t curveTag = sectionCurves1[0]->Tag(); double twoEnd[2][3] = { {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} }; // 使用UF_EVAL系列函数获取曲线端点 UF_EVAL_p_t evaluator = NULL; double limits[2]; // 初始化评估器 if (UF_EVAL_initialize(curveTag, &evaluator) == 0) { // 获取参数范围 if (UF_EVAL_ask_limits(evaluator, limits) == 0) { // 确保参数范围有序 if (limits[0] > limits[1]) { double temp = limits[0]; limits[0] = limits[1]; limits[1] = temp; } // 评估起点 if (UF_EVAL_evaluate(evaluator, 0, limits[0], twoEnd[0], NULL) == 0) { helpPoint = NXOpen::Point3d(twoEnd[0][0], twoEnd[0][1], twoEnd[0][2]); } // 如果起点评估失败,尝试评估终点 else if (UF_EVAL_evaluate(evaluator, 0, limits[1], twoEnd[1], NULL) == 0) { helpPoint = NXOpen::Point3d(twoEnd[1][0], twoEnd[1][1], twoEnd[1][2]); } } // 释放评估器资源 UF_EVAL_free(evaluator); } // 如果所有方法都失败,使用原点 if (helpPoint.X == 0.0 && helpPoint.Y == 0.0 && helpPoint.Z == 0.0) { // 记录错误信息 char msg[256]; sprintf_s(msg, "无法获取曲线 %d 上的点", curveTag); hkjm::theUI->NXMessageBox()->Show("MICH-明警告", NXOpen::NXMessageBox::DialogTypeWarning, msg); } } } // 添加到截面 - 使用正确的API签名 section->AddToSection( rules, // 规则向量 sectionCurves1[0], // 种子曲线 NULL, // 起始连接对象(无) NULL, // 结束连接对象(无) helpPoint, // 帮助点 NXOpen::Section::ModeCreate // 创建模式 ); // 设置拉伸方向 - 使用正确的CreateDirection重载 NXOpen::Point3d origin(0.0, 0.0, 0.0); NXOpen::Direction* extrudeDirection = workPart->Directions()->CreateDirection( origin, directionVec, NXOpen::SmartObject::UpdateOptionWithinModeling ); extrudeBuilder->SetDirection(extrudeDirection); // 设置拉伸范围 NXOpen::GeometricUtilities::Limits* limits = extrudeBuilder->Limits(); limits->StartExtend()->Value()->SetRightHandSide(std::to_string(hk1sdValue).c_str()); // 起始距离设为hk1sdValue limits->EndExtend()->Value()->SetRightHandSide("0"); // 结束距离设为0 // ===== 添加拔模角度设置 ===== if (hk1jdValue != 0.0) // 只有拔模角度不为0时才设置 { // 设置拔模类型:从起始位置简单拔模 extrudeBuilder->Draft()->SetDraftOption( NXOpen::GeometricUtilities::SimpleDraft::SimpleDraftTypeSimpleFromStart); // 设置前拔模角度(从截面开始处拔模) extrudeBuilder->Draft()->FrontDraftAngle()->SetRightHandSide( std::to_string(hk1jdValue).c_str()); // 设置后拔模角度(这里我们设为0,因为只需要单边拔模) extrudeBuilder->Draft()->BackDraftAngle()->SetRightHandSide("0"); } //// 设置布尔操作类型(创建新实体) //extrudeBuilder->BooleanOperation()->SetType( // NXOpen::GeometricUtilities::BooleanOperation::BooleanTypeCreate); // 设置布尔操作类型(求差) extrudeBuilder->BooleanOperation()->SetType( NXOpen::GeometricUtilities::BooleanOperation::BooleanTypeSubtract); // 设置求差目标体 if (!selectedBodies.empty()) { extrudeBuilder->BooleanOperation()->SetTargetBodies(selectedBodies); } else { // 如果没有选择目标体,显示警告信息 theUI->NXMessageBox()->Show("MICH-明警告", NXOpen::NXMessageBox::DialogTypeWarning, "未选择求差目标体,将创建独立特征"); } // 在执行拉伸操作前记录目标体的面 std::map<tag_t, std::set<tag_t>> bodyFacesBeforeMap; for (NXOpen::Body* body : selectedBodies) { std::set<tag_t> faceTags; std::vector<NXOpen::Face*> faces = body->GetFaces(); for (NXOpen::Face* face : faces) { faceTags.insert(face->Tag()); } bodyFacesBeforeMap[body->Tag()] = faceTags; } // 执行拉伸操作 NXOpen::NXObject* featureNXObject = extrudeBuilder->Commit(); NXOpen::Features::Feature* feature = dynamic_cast<NXOpen::Features::Feature*>(featureNXObject); // 收集新创建的面 std::vector<NXOpen::Face*> newFaces; // 方法1:比较特征创建前后的面差异 for (NXOpen::Body* body : selectedBodies) { std::vector<NXOpen::Face*> facesAfter = body->GetFaces(); std::set<tag_t> faceTagsBefore = bodyFacesBeforeMap[body->Tag()]; for (NXOpen::Face* face : facesAfter) { tag_t faceTag = face->Tag(); // 如果这个面在创建前不存在,则是新面 if (faceTagsBefore.find(faceTag) == faceTagsBefore.end()) { newFaces.push_back(face); } } } // 仅给新面设置颜色 if (colorIndex1 > 0 && !newFaces.empty()) { for (NXOpen::Face* face : newFaces) { tag_t faceTag = face->Tag(); UF_OBJ_set_color(faceTag, colorIndex1); UF_DISP_set_highlight(faceTag, 0); } // 刷新显示 theSession->Parts()->Work()->Views()->WorkView()->UpdateDisplay(); } // 清理资源 extrudeBuilder->Destroy(); section->Destroy(); } 不需要收集面跟改色的部分,只需要拉伸。拉伸截面是“bianjie_edge跟创建出来的直线”。设置拉伸范围:“起始距离设为expression_clcq。结束距离设为expression_smh减去expression_jlcq”。拔模角度不需要
最新发布
08-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值