Personal tools
You are here: Home Forum Use use currently study in shaper module

use currently study in shaper module

Up to Use

use currently study in shaper module

Posted by Anirudh Nehra at June 28. 2019

Hi,

I am working extensively with the shaper module to create parametric assemblies. I have created most of the features through GUI and I want to create the rest through python console. I have two questions:

1- How do I use the currently open study to continue adding features to it? I tried using something like this below but it creates a new part rather than continuing from last feature. 

from salome.shaper import model

model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()  

2- How do I get selection by mouse into python console to create groups of faces? It seems real hard to try to find IDs of individual elements(the name is very long with complex syntax). I just want to box select things and get them in python command argument.

 3- Sometimes there are application errors,when they appear. only option is to kill salome. Is there a way to trackback what is the problem without losing the current session?

 4- How do I box select geometry for groups in such a way that only foreground geometry is selected. The hidden faces should not get selected.

 5- When there are lot of parts to display, the operations such as rotation and zoom are rather slow. However the same geometry when exported and viewed in geometry module rotates and spins without lag.

 Is there a way to automatically update exported geometry in GEOM module and consequent meshes in meshes module? Right now, it seems we need to export the changed geometry each time and create new meshes over it.

 Thanks a lot.

 Anirudh

 

 

Re: use currently study in shaper module

Posted by Christophe Bourcier at June 29. 2019
1. Instead of using addPart, you can get the part and its doc like this:
 

 

from ModelAPI import *

model.begin()
partSet = model.moduleDocument()

aPart = objectToFeature(partSet.object("Features", 0))

aPartResult = modelAPI_ResultPart(aPart.results()[0])

Part_1_doc = aPartResult.partDoc()

 

Then you can add features like this:


Box_1 = model.addBox(Part_1_doc, 10, 10, 10)

 

I got those lines from the SHAPER sources: src/ModelAPI/Test/TestSaveOpen2.py

 

2. Some features accept other feature's result as "all-in-" prefix. For instance:

 

model.selection("COMPOUND", "all-in-Box_1")

 

But it does not work for groups.

 

You can also use the alternative mode of selection by coordinates. See the dump_geo.py file created by the dump feature. In the menu Part/Dump instead of File/Dump study.

 

For instance to select a point by naming:

model.selection("VERTEX", "[Box_4_1/Front][Box_4_1/Right][Box_4_1/Top]")

 

or by its coordinates:

model.selection("VERTEX", (10, 10, 10))

 

3. Sometimes the dialog box with application errors is just behind the Salome window. You can close it.

 

If you find some sigsegv or crashes, please try to send the steps to reproduce them.

 

4. It is not yet possible. Maybe available in next version.

 

5. You can disable some selection modes (Vertices, Edges, Faces) by right-click in the view or in the preferences of SHAPER, in the Viewer tab.

 

6. It is not yet possible. Maybe available in next version.

 

Thank you for the feedback.

 

Christophe

p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }

Re: use currently study in shaper module

Posted by Anirudh Nehra at July 06. 2019

Hello,

Thanks for the reply. There seems to be some issue in sketch update if sketch dimensions are updated with expressions and parameters created by parameter dialog box.

I am attaching the link to a study where there are many parameters in parameters dialog box. Updating monoblock_offset from 0.15 to 0.225 causes study to break down for unknown reason.

https://www.dropbox.com/s/x32sqo44i98xf35/scenerio2_geom_groups.hdf?dl=0

Regards

Anirudh

 

Re: use currently study in shaper module

Posted by Anirudh Nehra at July 06. 2019

Hi,

I think error occurs in updating of 'offset_BC5_Cut_sketch' feature. Also, after error an Application Error window pops up that does not go away and the only option is to kill and restart salome.

 

Thanks

Anirudh

Re: use currently study in shaper module

Posted by Anirudh Nehra at July 11. 2019

Hi,

I hope you could download the hdf file and spot the error. Please vary the monoblock_offset parameter from 0.15 to 0.225 to reproduce the error.

 

Thanks a lot.

Anirudh

Re: use currently study in shaper module

Posted by Franco Otaola at November 25. 2020

Hello,
how can we select solids that are the results of another feature in the TUI?
for example I am having troubles to fuse the different solids that are inside of a variable that is created from the mirror feature.

quarterBody = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Cylinder_2_1"),model.selection("SOLID", "Cylinder_3_1")], keepSubResults = False)
mirror1 = model.addSymmetry(Part_1_doc, [quarterBody.result()], model.selection("FACE", "PartSet/YOZ"), keepOriginal = True, keepSubResults = True)
mirror2 = model.addSymmetry(Part_1_doc, [mirror1.result()], model.selection("FACE", "PartSet/XOZ"), keepOriginal = True, keepSubResults = True)
mirror3 = model.addSymmetry(Part_1_doc, [mirror2.result()], model.selection("FACE", "PartSet/XOY"), keepOriginal = True, keepSubResults = True)

if I load python code to salome it creates in Part_1/Results "mirror3" that it does not have the icon of a solid ( that is a similar to a cube) but has another icon with a cube a bar and a point. the object is named
Symmetry_3_1
                                  Symmetry_3_1_1
                                                                    Symmetry_3_1_1_1
                                                                                                     Symmetry_3_1_1_1_1 (this one has the icon of solid)
                                                                                                     Symmetry_3_1_1_1_2 (this one has the icon of solid)
                                                                    Symmetry_3_1_1_2
                                                                                                     Symmetry_3_1_1_2_1 (this one has the icon of solid)
                                                                                                     Symmetry_3_1_1_2_2 (this one has the icon of solid)
                                  Symmetry_3_1_2
                                                                    Symmetry_3_1_2_1
                                                                                                     Symmetry_3_1_2_1_1 (this one has the icon of solid)
                                                                                                     Symmetry_3_1_2_1_2 (this one has the icon of solid)
                                                                    Symmetry_3_1_2_2
                                                                                                     Symmetry_3_1_2_2_1 (this one has the icon of solid)
                                                                                                     Symmetry_3_1_2_2_2 (this one has the icon of solid)

If then I select [Symmetry_3_1_1_1_1,Symmetry_3_1_1_1_2,Symmetry_3_1_1_2_1,Symmetry_3_1_1_2_2,Symmetry_3_1_2_1_1,Symmetry_3_1_2_1_2,Symmetry_3_1_2_2_1,Symmetry_3_1_2_2_2]
and fuse them I obtain what I am looking for. but I would like to do it directly in the TUI without going to go throwght the GUI.
is this possible?
I do not understand correctly how to selection works exactly and I couldn't find any documentation about this. so all I know of how it works is from dumpying studies (that does not help as it literally uses the list with each name and not something general like "all the results from this feature")
I have tried:

1.
completeBody = model.addFuse(Part_1_doc, [mirror3.result()], removeEdges = True, keepSubResults = True)

2.
completeBody = model.addFuse(Part_1_doc, [model.selection("SOLID", "all-in-mirror3")], removeEdges = True, keepSubResults = True)
with the two giving me errors....
thanks a lot,
franco

Powered by Ploneboard
Document Actions