C#:通用方法总结—第16集

大家好,今天继续介绍我们的通用方法系列。

下面是今天要介绍的通用方法:

(1)这个通用方法为将TaggedObject转换为Face

Public void ConvertTag()

{

TaggedObject\[\] GetSelectedObjects = face_select0.GetSelectedObjects();

Face\[\] faces = new Face0;

foreach (var to in GetSelectedObjects)

{

Array.Resize(ref faces, faces.Length + 1);

facesfaces.Length - 1 = (Face)to;

}

}

(2)这个通用方法为UG获取面属性

Public void GetFaceAttr(Face faces)

{

for (int a = 0; a < faces.Length; a++)

{

NXObject.AttributeInformation\[\] attributeInformation1 = facesa.GetUserAttributes();

foreach (var ai in attributeInformation1)//遍历面属性

{

if (ai.Type == NXObject.AttributeType.String)//属性是string类型

{

if (ai.Title == "A")//属性名

{

string value= (ai.StringValue);

}

}

}

}

}

(3)这个通用方法为 判断圆形边是不是封闭的

/// <summary>

/// 判断圆形边是不是封闭的,返回的是bool值

/// </summary>

/// <param name="edgetag"></param>

/// <returns></returns>

bool judgecircle(Tag edgetag)//判断圆形边是不是封闭的,返回的是bool值

{

IntPtr uFEval1;

theUfSession.Eval.Initialize(edgetag, out uFEval1);

UFEval.Arc arc1;

theUfSession.Eval.AskArc(uFEval1, out arc1);

bool boolvar = false;

if (arc1.is_periodic)//判断是否为整圆

{

double\[\] arccenter = new double100;

arccenter0 = arc1.center0;

arccenter1 = arc1.center1;

arccenter2 = arc1.center2;

double\[\] arcxaxis = new double100;

arcxaxis0 = arc1.x_axis0;

arcxaxis1 = arc1.x_axis1;

arcxaxis2 = arc1.x_axis2;

double\[\] arcyaxis = new double100;

arcyaxis0 = arc1.y_axis0;

arcyaxis1 = arc1.y_axis1;

arcyaxis2 = arc1.y_axis2;

double\[\] arcR = new double100;

arcR0 = arc1.radius;

bool boolisarc;

theUfSession.Eval.IsArc(uFEval1, out boolisarc);

if (Math.Abs(arc1.limits0) < 0.001 && Math.Abs(arc1.limits1 - 2 * Math.PI) < 0.001)

{

boolvar = true;

}

theUfSession.Eval.Free(uFEval1);

}

return boolvar;

}

今天要介绍的就是这么多,我们下篇文章再见。

相关推荐
꧁细听勿语情꧂4 小时前
二叉树余题,排序、直接插入排序、希尔排序
c语言·开发语言·数据结构·算法
是main不是漫5 小时前
【C++——类和对象(上)】筑基篇:以封装奠定面向对象之基
c语言·开发语言·c++
apcipot_rain9 小时前
C++转Java日记(06)
java·开发语言
SomeOtherTime15 小时前
Rust所有权(AI回答)
开发语言·后端·rust
Easyhood16 小时前
Android 开发入门实践(十四):Compose 副作用入门与四个常用 API
android·开发语言·kotlin·android jetpack·compose
白杨尚青16 小时前
C++进阶篇(六):map 和 set 的模拟实现——用红黑树封装 mymap/myset(迭代器 + operator[])
开发语言·c++·迭代器·stl·set·map·红黑树
饮水桶_T20 小时前
JAVA IO流笔记
开发语言·数据结构·算法
Felven1 天前
C. Brr Brrr Patapim
c语言·开发语言
路溪非溪1 天前
python标准库使用总结
开发语言·python
SomeOtherTime1 天前
Rust 面向对象介绍(AI回答)
开发语言·python·rust