Welcome to Part 6 of this blog series on Transitioning Macros from CATIA V5 to 3DEXPERIENCE.
For reference, here are all of the blogs in this series:
Part 1: Framework
Part 2: Creating, Opening, and Saving Files
Part 3: Services
Part 4: Product Modeler
Part 5: Part Modeling and Drafting
Part 6: Selections
Part 7: Deployment
---------------------------------------------------------
In this blog I discuss Selections. The good news here – it’s almost identical to CATIA V5.
The differences:
- The Selection object now belongs to the Editor, rather than to the Document as it was in V5.
- Some V5 methods have been deprecated. Replaced with new functions.
To get a hold of the Selection object for the current window, in V5 you would write:
01: Dim oSel As Selection
02: Set oSel = CATIA.ActiveDocument.Selection
While in the 3DEXPERIENCE, that would be:
01: Dim oSel As Selection
02: Set oSel = CATIA.ActiveEditor.Selection
Figure 1
The SelectedElement objects are nearly identical. The only difference is that in 3DEXPERIENCE, the object doesn’t have the Document property.
The VisPropertySet objects, which control the graphics properties, are also nearly identical.
The differences lie in the functions/methods. The SelectElement2 and SelectElement3 methods in V5, which enable interactive selections, have been deprecated. Replaced by the SelectElement and SelectMultipleElements methods in 3DX.
The syntax, however, remained the same as in V5. Both selection methods require a filter and a prompt and return a string indicating whether the selection succeeded, as shown below.
- Func SelectElement (CATSafeArrayVariant iFilterType, CATBSTR iMessage, boolean iMaySkipInteractiveSelection) As CATBSTR
- Func SelectMultipleElements (CATSafeArrayVariant iFilterType, CATBSTR iMessage, boolean iMaySkipInteractiveSelection, CATMultiSelectionMode iMultiSelectionMode, boolean iTooltip) As CATBSTR
The other methods, such as Copy, Cut, Delete, Paste, etc., are identical to V5.
And that’s it. Nice and easy!
The next post will be the last one where I'll be talking about deploying the macros in the company-wide environment.
About the Author
Follow on Linkedin Visit Website More Content by Iouri Apanovitch