CATIA V5 - Composite Design exposed to automation?
CATIA V5 - Composite Design exposed to automation?
(OP)
Hello all! First post, so let me thank you for your help in my learning up until now. I'm an intern whose job is almost exclusively CATIA programming, and most of my CATIA specific coding knowledge comes from posts on here!
I've been using CATIA's Composite Design workbench (CPX & CGX), and have found that most operations within that workbench aren't exposed to automation. As an example, a simple operation; Adding Plygroups, sequences, and plies.
Below is the only code I've managed to pull from the recorder and modify.
Things I have tried (searched through):
I've been using CATIA's Composite Design workbench (CPX & CGX), and have found that most operations within that workbench aren't exposed to automation. As an example, a simple operation; Adding Plygroups, sequences, and plies.
Below is the only code I've managed to pull from the recorder and modify.
CODE --> VBA
Sub CATMain()
'Code to declare certain plies/sequences as the InWork Object.
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Stacking")
Dim hybridBodies2 As HybridBodies
Set hybridBodies2 = hybridBody1.HybridBodies
'Up til here is necessary. Assumption is that 'Stacking' HybridBody exists as a CATIA internal (reserved) name.
Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies2.Item("Plies Group.1")
Dim hybridBodies3 As HybridBodies
Set hybridBodies3 = hybridBody2.HybridBodies
Dim hybridBody3 As HybridBody
Set hybridBody3 = hybridBodies3.Item("Sequence.1")
Dim hybridBodies4 As HybridBodies
Set hybridBodies4 = hybridBody3.HybridBodies
Dim hybridBody4 As HybridBody
Set hybridBody4 = hybridBodies4.Item("Sequence.2")
Dim hybridBodies5 As HybridBodies
Set hybridBodies5 = hybridBody4.HybridBodies
Dim hybridBody5 As HybridBody
Set hybridBody5 = hybridBodies5.Item("Ply.1")
part1.InWorkObject = hybridBody5
part1.InWorkObject = hybridBody4
End Sub Things I have tried (searched through):
- V5 Automation.chm
- Recording macros in VBA Module, catvbs, and CATScript. None resulted in very useful material, except that I can access plygroups and stacking as HybridBodies, but cannot create (Add()) them except as Geometrical Sets... (shown above)
- The internet, where nobody seems to specifically have questions about coding in this workbench. Or my search parameters are wrong. This & this are the only posts I've found.





RE: CATIA V5 - Composite Design exposed to automation?
Thanks for posted code. Stacking and everything inside it works exactly like Geo. sets. Yo can also move stacking review wherever you want.
RE: CATIA V5 - Composite Design exposed to automation?
Thanks for your reply! A pity to hear it isn't exposed. If you hear anything from your support rep, please let the community know!
Do you know of anything else in composites workbench that can be accessed, even with workarounds?
RE: CATIA V5 - Composite Design exposed to automation?
RE: CATIA V5 - Composite Design exposed to automation?
I am also interested in this topic. I know that something can be done, since custom commands and tools that interface with Composites workbench do exist on the market. Perhaps, as Jenial says, not for "users like us".
To the standard VB scripting interface, entities related to CPX are totally obscure. By querying them with my script that writes out Type and checks for geometry class, it says
and