The script in Spaceclaim encountered an error in the ACT Stage Page
I developed a script that can run on SpaceClaim, but when the script is integrated into the ACT Stage Page, the following error is reported.
Comments
-
Are you importing the SpaceClaim API packages in to ACT as described here?:
0 -
This operation has already been executed, still reporting this error.
0 -
Try this:
import os, sys clr.AddReference("Ans.Utilities") from Ansys.Utilities import ApplicationConfiguration version = ApplicationConfiguration.DefaultConfiguration.VersionInfo.VersionString sys.path.append(os.environ["AWP_ROOT"+version]+"/scdm/Scripting") clr.AddReference("SpaceClaim.Api.V{}".format(version)) clr.AddReference("SpaceClaim.Api.V{}.Scripting".format(version)) exec('from LoadSCDMAPITypesV{} import *'.format(version)) exec('from UtilitiesOnLoadV{} import *'.format(version)) exec('from SpaceClaim.Api.V{}.Scripting import Extensions'.format(version)) exec('arg = SpaceClaim.Api.V{}.Scripting.Extensions'.format(version)) clr.ImportExtensions(arg) GetRootPart().GetComponents()
If it works on your end, I will file a bug to add:
from SpaceClaim.Api.V241.Scripting import Extensions clr.ImportExtensions(SpaceClaim.Api.V241.Scripting.Extensions)
to LoadSCDMAPITypesV241.py
0 -
@Landon Mitchell Kanner said:
Try this:import os, sys clr.AddReference("Ans.Utilities") from Ansys.Utilities import ApplicationConfiguration version = ApplicationConfiguration.DefaultConfiguration.VersionInfo.VersionString sys.path.append(os.environ["AWP_ROOT"+version]+"/scdm/Scripting") clr.AddReference("SpaceClaim.Api.V{}".format(version)) clr.AddReference("SpaceClaim.Api.V{}.Scripting".format(version)) exec('from LoadSCDMAPITypesV{} import *'.format(version)) exec('from UtilitiesOnLoadV{} import *'.format(version)) exec('from SpaceClaim.Api.V{}.Scripting import Extensions'.format(version)) exec('arg = SpaceClaim.Api.V{}.Scripting.Extensions'.format(version)) clr.ImportExtensions(arg) GetRootPart().GetComponents()
If it works on your end, I will file a bug to add:
from SpaceClaim.Api.V241.Scripting import Extensions clr.ImportExtensions(SpaceClaim.Api.V241.Scripting.Extensions)
to LoadSCDMAPITypesV241.py
The problem has been solved using this method, thank you.
1 -
The Ansys team has decided not to fix this bug, because there is a workaround and because SpaceClaim and SpaceClaim ACT are in maintenance mode. We recommend starting to transition SpaceClaim ACT usage to the Discovery customization functionality, which uses the same script editor and provides more functionality, including an extension builder.
0