SpaceClaim and Discovery scripting: unexpected error when trying to access datum points from compone
Dear SpaceClaim scripting gurus,
I have a very simple test case with two datum points: one belonging to the main Design component and one put into the additional component Point. Accessing the first one via script is no problem, the attempt to access the second one results in an error message that Component object has no DatumPoint attribute (see screenshot).
Please note that the variables GetRootPart().DatumPoints[0] and GetRootPart().Components[0].DatumPoints[0] were derived through the "Insert Selection" (i.e. the button with the black arrow and the small green '+' symbol in the script editor) button which is supposed to provide the correct variable.
Is this the expected behavior? To me, it looks more like a bug. The issue is also reproducible with Discovery v2024R2.
Thanks,
Nikolay
Answers
-
Hi Nikolay!
The GetRootPart() function returns a Part object, and GetRootPart().Components[0] returns a component. The component does not have a DatumPoints attribute.
0 -
You can access the points, for example, like this:
points = Selection.CreateByNames("Point") point1, point2 = points.Items
0 -
Hello,
there is already a bug report on this: Bug 1154531 Insert selection for DatumPoints in components doesn't work
Apparently the recorder is not working correctly. The right should be would be
GetRootPart().Components[0].Content.DatumPoints[0]
instead of
GetRootPart().Components[0].DatumPoints[0]
A special thank to Matrin Husek who provided the workaround and the bug number.
Regards,
Nikolay0