I would like to accomplish the following in Shaper or Geom modules.
Every time an object (e.g. shell, face, solid, etc.) is to be exported, a dialog box pops up and asks for path and file name. This is not an efficient way of exporting hundreds of entities at once. Is there any way to set the saving path once for a selection of objects and let the export use the object names assigned by Salome, e.g. Solid_11, Solid_12, etc.?
hello,
this should do the work (in geometry module).
#!/usr/bin/env python
exportPath="C:/Users/user/Downloads/"
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'C:/Users/user/Desktop')
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
n_Selected=salome.sg.SelectedCount()
for i in range(n_Selected):
selected=salome.sg.getSelected(i)
selected_object=salome.IDToObject(selected)
geompy.ExportSTEP(selected_object, exportPath+selected_object.GetName()+".step", GEOM.LU_METER )```
regards,
F.
Thanks a lot. Works like a charm.
What changes should I make to this script to make it work with the newer Salome versions?
Man.
please read some indications in how to ask? Make a post that is functional to the other person in trying to help you.
this from what I read of the script should still work correctly. Without issues. But you did not post what is not working. Nor what is the error. Or what you are observing. I highly recommend you to search on how to ask? Or give enough information to get help? Posts around the web. I imagine that you didn’t do it in a bad intentioned way but you should learn how to ask and give information.
I apologise for the bad post. There was a mistake in the code. Specifically in the export path. The code still works with 9.13. Thank you for your response.