How to keep CATIA constraints when copy and pasting
|If you cut and paste parts within a CATIA V5 assembly you could end up breaking the assembly constraints that hold your product together. Luckily, there is an option that allows us to cut and paste and keep these constraints intact. Here’s two methods you can use to access that option.
Tools Options Method
Go to Tools>Options>Mechanical Design>Assembly Design> tab: Constraints/Paste components. Check the box for “Always with the assembly constraints.”
Programmatic Method
Another way is to automatically set the option by adding the following lines of code into your CATIA macro program:
Dim settingControllers1 As SettingControllers Set settingControllers1 = CATIA.SettingControllers Dim asmConstraintSettingAtt1 As AsmConstraintSettingAtt Set asmConstraintSettingAtt1 = settingControllers1.Item("CATAsmConstraintSettingCtrl") asmConstraintSettingAtt1.PasteComponentMode = catPasteWithCstOnCopyAndCut
There you have it! This code is particularly useful when you reorder the specification tree so the assembly constraints are not broken.