有客户问道如何得知焊缝的轮廓,其实WeldBead.BeadFaces 就返回焊缝的每个面,根据它们就能得知焊缝的轮廓。以下代码将这些面用Client Graphics的形式体现出来,为了和焊缝本身区分,故意将其偏移了一些位置。
Public Sub test()
'get document and definition
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As AssemblyComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
'if this is a weld document
If oCompDef.Type = kWeldmentComponentDefinitionObject Then
Dim wcd As WeldmentComponentDefinition
Set wcd = oCompDef
Else
Exit Sub
End If
' get one weld bead
Dim oWB As WeldBead
Set oWB = wcd.Welds.WeldBeads(1)
On Error Resume Next
Dim oClientGraphics As ClientGraphics
Set oClientGraphics = oC

通过WeldBead.BeadFaces属性可以获取焊缝的各个面,从而得到焊缝的轮廓信息。示例代码利用Client Graphics展示轮廓,并进行偏移处理以区分焊缝本身。
最低0.47元/天 解锁文章
3509

被折叠的 条评论
为什么被折叠?



