Alan Lowbands
Aerospace
Hi Gents,
I'm trying to get all the selected parts in an assembly to have the main body set as the 'in work object'.
Could anyone tell me where i'm going wrong please ?
thanks
Alan
------------------------------------
Language="VBSCRIPT"
Sub CATMain()
Set oSel = CATIA.ActiveDocument.Selection
oSel.Search "CATPrtSearch.BodyFeature,all"
intNbSelected = oSel.Count2
If intNbSelected > 0 Then
For intIndex = 1 to intNbSelected
Dim oPart
Set oPart = oSel
Set documents1 = oPart
Set partDocument1 = documents1
Set part1 = partDocument1
Set bodies1 = part1.Bodies
Set body1 = bodies1.Item("PartBody")
part1.InWorkObject = body1
Next
End If
oSel.Clear
End Sub
I'm trying to get all the selected parts in an assembly to have the main body set as the 'in work object'.
Could anyone tell me where i'm going wrong please ?
thanks
Alan
------------------------------------
Language="VBSCRIPT"
Sub CATMain()
Set oSel = CATIA.ActiveDocument.Selection
oSel.Search "CATPrtSearch.BodyFeature,all"
intNbSelected = oSel.Count2
If intNbSelected > 0 Then
For intIndex = 1 to intNbSelected
Dim oPart
Set oPart = oSel
Set documents1 = oPart
Set partDocument1 = documents1
Set part1 = partDocument1
Set bodies1 = part1.Bodies
Set body1 = bodies1.Item("PartBody")
part1.InWorkObject = body1
Next
End If
oSel.Clear
End Sub