Dialga1
Mechanical
- Jan 1, 2023
- 15
I added example about what am I needed in picture. Is this possible to create parts and assembles like this with 1 macro? I tried my best but I got stuck.
Code:
Language="VBSCRIPT"
Sub CATMain()
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("Part1.CATPart")
Set part1 = partDocument1.Part
Set bodies1 = part1.Bodies
Set body1 = bodies1.Add()
part1.Update
Set body2 = bodies1.Add()
part1.Update
Set body3 = bodies1.Add()
part1.Update
Set body4 = bodies1.Add()
part1.Update
Set body5 = bodies1.Add()
part1.Update
Set body6 = bodies1.Add()
part1.Update
Set body7 = bodies1.Add()
part1.Update
Set body8 = bodies1.Add()
part1.Update
Set shapeFactory1 = part1.ShapeFactory
shapeFactory1.AddNewAssemble body2
Set shapes1 = body1.Shapes
Set assemble1 = shapes1.Item("KABUK.1")
part1.UpdateObject assemble1
Set assemble2 = shapes1.Item("Assemble.2")
part1.UpdateObject assemble2
Set assemble3 = shapes1.Item("Assemble.3")
part1.UpdateObject assemble3
Set assemble4 = shapes1.Item("Assemble.4")
part1.UpdateObject assemble4
Set assemble5 = shapes1.Item("Assemble.5")
part1.UpdateObject assemble5
Set assemble6 = shapes1.Item("Assemble.6")
part1.UpdateObject assemble6
part1.Update
Set body9 = bodies1.Add()
part1.Update
shapeFactory1.AddNewAssemble body9
part1.Update
End Sub