Hello everyone,
I am struggling with a VBA macro in 3DEXPERIENCE (R202x). My goal is simple: Select several Parts (Instances) within an Assembly and export their overall dimensions (X, Y, Z / Bounding Box) to Excel.
However, I have hit a wall with every common method:
- SPAWorkbench / GetService: When I try to use
oEditor.GetService("SPAWorkbench"), the method fails with a run-time error. Furthermore, I cannot manually add Library References (Tools -> References is grayed out in our environment), so I must rely on Late Binding. - GetBoundingBox: Calling
oItem.GetBoundingBoxon the selected instances/PartBodies returns 0 for all coordinates, even though the parts are clearly visible and are solid bodies (approx. 50mm to 1500mm in size). - Inertia: Attempting to use
obj.GetItem("Inertia")also returns zeroed results in the assembly context.
The macro correctly identifies the names of the parts and triggers the Excel export, but the geometry seems "unreachable" for measurement unless I manually open each part in a new window, which defeats the purpose.
Key questions:
- Is there a specific 3DEXPERIENCE Service (other than SPAWorkbench) required to measure instances in a Product context?
- How can I programmatically "force" the geometry into Design Mode or access the RepRef of an Instance to get its real dimensions via VBA without having to add manual References?
- Is there a modern 3DX-specific way (Experience API) to get a bounding box from a
VPMShapeInstance?
Any code snippets or pointers toward the correct 3DX API calls would be greatly appreciated.
Thank you in advance!
