我想检查我正在使用的身体的身体类型BodyCollection
(如果身体是Sphere
)。
我该怎么写?
这是我尝试过的:
public void ChamferAll()
{
int subtype = 1;
string offset1 = "5", offset2 = "0", angle = "5";
BodyCollection bodyCollection = theSession.Parts.Work.Bodies;
List<Tag> edgeTags = new List<Tag>();
foreach (Body body in bodyCollection)
{
if (body.GetType() == NXOpen.Features.Sphere)
continue;
else
{
Edge[] edges = body.GetEdges();
foreach (Edge edge in edges)
{
edgeTags.Add(edge.Tag);
theUFSession.Modl.CreateChamfer(subtype, offset1, offset2, angle, edgeTags.ToArray(), out Tag chamferTag);
}
edgeTags.Clear();
}
}
}