嘿,在CAD程序SiemensNX中,我有一个活跃的工作部分。在这个WorkPart中,我有一些特性(例如曲线)。为了实现这些功能,我创建了一个FeatureGroup,就像在windows资源管理器中包含文档的文件夹一样。现在,我尝试在active WorkPart中查找所有FeatureGroups的编程接口。我用C#做这件事,但在VBA中的任何帮助对我来说也是可以的。
我试试这个:
foreach(FeatureGroup FGroupX in workpart.Features)
{
do something with current FGroupX ...
}"workpart.features“为我提供了active WorkPart中所有功能的集合。但是对于这个集合中不是来自"Featuregroup“类型的每个特征,for-loop都会发生冲突。
是否有其他合适的解决方案来查找active WorkPart中的所有FeatureGroups?
发布于 2020-11-03 21:46:23
通过对特征类型进行额外的if-check解决了这个问题:
foreach(Feature curFeature in workpart.Features)
{
Type type = curFeature.getType();
if(type == typeof(FeatureGroup))
{
FeatureGroup fg = (FeatureGroup)curFeature //explicite conversion to FeatureGroup-Type
//do something with fg
}
}https://stackoverflow.com/questions/64541478
复制相似问题