我一直在尝试从注释中获取表面数据并测量曲线并检查注释是否正确。
使用annotation.getsurfaces(variant1())
但这里返回的是字符串而不是曲面。我不能用part1.createreferencefromname(variant(0))
或part1.findobjectbyname(variant(0))
我需要测量从annotation.getsurfaces(variant1())
返回的表面谢谢你,
嗨,我玩注释很少,所以我可能不会给出最好的答案。你可以从这样的东西改变字符串(对不起,我让自己挤出:))
"Part1/Geometrical Set.1/Extrude.1/Face"
"Part1/Geometrical Set.1/!Extrude.1"
然后使用
Dim PartDoc as PartDocument 'your part document
Dim Ref as Reference
Set Ref = PartDoc.Product.CreateReferenceFromName("Part1/GeometricalSet.1/!Extrude.1")
另一个选项是获取特性"Extrude.1"
的名称并使用:
Dim Shape as HybridShape 'here you have to declare the right type for you
Set Shape = PartDoc.Part.FindObjectByName("Extrude.1")
要小心,因为如果你在其他地方有相同的名字,你可能会得到不同的对象!
如果你足够勇敢,你可以更多地探索BRep语法,并创建类似这样的东西(只是api文档中的示例)
CreateReferenceFromName("Produit1/Column_2/!Selection_FVertex:(Vertex:(Neighbours:(Face:(Brp:(StrFunRibSweep.1;0:(Brp:(GSMLine.1);Brp:(IntSection.1;9999)));None:();Cf11:());Face:(Brp:(StrFunRibSweep.1;1);None:();Cf11:());Face:(Brp:(StrFunRibSweep.1;0:(Brp:(GSMLine.1);Brp:(IntSection.1;10018)));None:();Cf11:()));Cf11:());StrFunRibSweep.1;Z0;G4702)")
要测量某物,你可以使用Space Analysis
中的Measurable
和Func GetMeasurable(Reference iMeasuredItem) As Measurable