有客户问道如何得知焊缝的轮廓,其实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
D