TAGGED: api, spaceclaim
-
-
January 12, 2024 at 6:12 pm
user deleted
SubscriberHello, I need help with the spaceclaim api v21 C#. I'm migrating python scripts to .net and I'm having problems:
1) How to get a body transformation matrix to find out its position;
2) How to get a body ID;
3)I can't find in SpaceClaim.Api.V21.dll analogs of methods from phyton MeasureHelper class, such as GetCenterOfMass(), DistanceBetweenObjects() and others. I have connected SpaceClaim.Api.V21.Scripting.dll and I tried to use these methods, but some kind of exception related to serialization is thrown.
To solve 3 issues, I use Application.RunScript(path, args, out res) from c#, but it is very inconvenient and slow to work
-
January 15, 2024 at 8:41 am
Atharv Joshi
Forum ModeratorHi Alex,ÂÂCan you please share the screenshot or the error message that comes up in 3rd question?Let me check the other parts of the question and get back to you. ÂÂThanks and RegardsAtharv -
January 15, 2024 at 10:16 am
user deleted
SubscriberHi Atharv.
Â
This python code works:
Â
This same c# code throws an exception on the last line:
Exception text: "System.Runtime.Serialization.SerializationException: 'Type 'SpaceClaim.NominalBody' in Assembly 'Nom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7210645d4d5e3a39' is not marked as serializable.'"
-
January 16, 2024 at 11:18 am
Atharv Joshi
Forum ModeratorHi Alex,
If the add-in uses the same AppDomain (this is set in the manifest.xml file):
Then you can add a reference to the scripting dll (should be located here: "C:\Program Files\ANSYS Inc\v241\scdm\SpaceClaim.Api.V242.Scripting.dll") and then they can make the same calls as scripting.Â
Please check if that helps accessing the call for GetCenterOfMass().
Thanks and Regards
Atharv -
January 16, 2024 at 1:28 pm
user deleted
SubscriberHi Atharv. It works, Thanks!!!Â
Now the second question is no longer relevant, but the first one is still interesting to me.
-
January 16, 2024 at 3:36 pm
Atharv Joshi
Forum ModeratorHi Alex,Â
Thanks for the update! Glad that's it working.
Will update you on the first part of the question.
Regards
Atharv
-
- The topic ‘SpaceClaim Api C#’ is closed to new replies.
-
6485
-
1906
-
1458
-
1308
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.


