TAGGED: api, python, save, script, spaceclaim
-
-
July 5, 2023 at 8:39 pmSterling ButtersSubscriber
I'm looking to save my document as a V33 parasolid with shallow assembly export. I tried reverse engineering the ExportOptions with the recording feature but was only met with:
  DocumentSave.Execute(r"/path/to/file.x_t", FileSettings2)
How can I dissect the specifications of FileSettings2 or replicate something to pass to the Execute method? Thanks!
Edit: I've also noticed these objects that may be of use:
from SpaceClaim.Api.V21 import ParasolidVersion
from SpaceClaim.Api.V21 import ParasolidExportOptions -
July 11, 2023 at 3:00 ammjmiddleAnsys Employee
The FileSettings is a metadata object, which is binary data you can't see. It is tied to the geometry loaded at the time, if it involves geometry selections. It is only saved to the scscript format if you export the script, not the python format. Or you can publish the script to a group in the current model.
The only option you can explicited set in python for parasolid is the version:
import clr
clr.AddReference("SpaceClaim.Api.V22")
from SpaceClaim.Api.V22 import ParasolidVersion
exopts = ExportOptions.Create()
exopts.Parasolid.Version = ParasolidVersion.V33
DocumentSave.Execute(r"D:\myFile.x_t", exopts)In order to set the shallow assembly export, you have to do something different. Turn on the shallow assembly export in "File > SpaceClaim Options > File Options > Parasolid." Record the command as you export to parasolid.
DocumentSave.Execute(r"/path/to/file.x_t", FileSettings)
This will produce the FileSettings metadata object with the shallow assembly export turned on, as well as any other options you had set before exporting. You will need to save that script as scscript type. Any place you use the FileSettings object in this script will use the options you had set.
-
July 11, 2023 at 3:16 pmSterling ButtersSubscriber
@mjmiddle How would the FileSettings metadata object behave in a different SpaceClaim project (i.e. if I used the same scscript in a different scdoc)? Does the FileSettings object capture just the export settings or is there other captured information that might cause a discontinuity between SpaceClaim projects? I ask because once I received an error to the effect of "FileSettings object is not defined" - that is, I had to manually record an export for it to be defined. On another occasion I was able to use the scscript without having to manually record an export. I would like for other users to be able to use the script without any manual intervention so if I can understand the origin of the previously mentioned discrepancy then maybe I can address it.Â
-
July 11, 2023 at 7:55 pmSterling ButtersSubscriber
@mjmiddle I've also noticed that in the scripting editor (once the FileSettings metadata object is created), I can right-click and copy the FileSettings w/ metadata and paste that into a Notepad window. Here I can see that the ScriptOjectHelper.LoadScriptObject() class/method is transcripted. This class/method appears to take some mess of xml text which contains the information for the shallow export. Can I leverage this by simply pasting this information back into the script editor?
-
July 12, 2023 at 7:40 pmSterling ButtersSubscriber
That appears to work actually.Â
-
- The topic ‘SpaceClaim Python API:Saving a Document as Parasolid’ is closed to new replies.
- Data Center Simulation
- Unable to attach geometry 2024 R2
- Getting Mesh Faces With Specified Normal Via SpaceClaim Scripting (V241)
- How to provide blade angles in bladegen.
- DXF file loaded incorrectly
- plugin error failed to import assembly from spaceclaim
- Crash by using Script Editor
- Overlapping contact face
- Thermoelectric Cooler Model
- Temperature’s Distribution not available in Refine Mode ?
-
1216
-
543
-
523
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.