Personal tools
You are here: Home Forum Use multiple fuse operation

Re: multiple fuse operation

Posted by Richard S. at September 22. 2010

Previously Erwan ADAM wrote:

Hi Richard,


Copy the two sample files into a directory (C:\Salome5.1.4_ForTestsOnWindows\release\plugins in my case), then right click on salome.bat to modify it and add
@set SALOME_PLUGINS_PATH=C:\Salome5.1.4_ForTestsOnWindows\release\plugins
just before
@runSalome %*

It should work. Erwan.


Hello Erwan,

now i´m using SalomeMeca2010.2 on a CAELinux VM and want to add my plugin I made on the Windows version.

Could you give me a hint where to define the PLUGINS_PATH_VARIABLE?

Best regards,

Richard.

 

Re: multiple fuse operation

Posted by Richard S. at September 27. 2010

Previously Richard S. wrote:

Could you give me a hint where to define the PLUGINS_PATH_VARIABLE?


Ok, I found it out.

for those who could have the same question:

add the line

export  SALOME_PLUGINS_PATH="path of your geom_plugins.py file"

in

SALOME5/V5_1_4/envSalome-V5_1_4.sh

Regards,

Richard

Powered by Ploneboard
Document Actions

multiple fuse operation

Up to Use

multiple fuse operation

Posted by vaina at July 05. 2010

Hi everybody.

I'd like to know if it's possibile a multiple 'fuse' operation. I don't think so, but maybe I'm wrong. If I build a partition and I want to fuse all resulting solids (after exploding tha partition itself into solids), in order to obtain a single solid with a larger number of faces, I have to fuse two solids at a time. This is an annoying and easy-to-mistake operation, in case of a large number of sub-solids. Am I correct? Is there any alternative procedure?

 

Attachments

Re: multiple fuse operation

Posted by Robert Langner at July 05. 2010

Hi vaina,

 

if you need a geometry which acts like one body (may be for FEM), but consists of a number of solids, do the following:

Collect your solids you want to have 'fused' together into a COMPOUND and use "glue faces"(repairOperation) on the compound. It removes the doubled faces between neighbour solids and if two solids share the same face, they are mechanically connected.

There is just one rule (I see you already took care of it): The doubled faces have to have 100% the same size, otherwise your shell can't be closed.

 

Regards,

Robert

Re: multiple fuse operation

Posted by vaina at July 05. 2010

Thanks for your hint, Robert. But I already tried that and I obtain funny errors, as in the picture. Unfortunately I can't have full control on faces of solids resulting from partition exploding. I also change the tolerance setting, but it doesn't work. In the future it could be interesting to have a multiple fuse operation available in Salome.

 

Attachments

Re: multiple fuse operation

Posted by Robert Langner at July 06. 2010

I've made that experience to: partitioning often produces weird faces( i.e.: intercecting them self by their own edges or single faces which consist of two faces). Sometimes faces not belong together will be rebuild as one face and that causes these problems. You can figure such errors out by exploding the solid and measuring the faces for thier number of edges.

But you better not use an already damaged solid further. You never know, if there's no bug remaining.

 

If I had to build such blades, I would try to get access to the edges of the intercecting faces (parallel in x-direction) and use them to build two "filling" to get the whole blade as one solid (except the sharp top end).

Or do you really need your blade consist of several pieces

 

:-?

Re: multiple fuse operation

Posted by Erwan ADAM at July 06. 2010

Previously vaina wrote:

Thanks for your hint, Robert. But I already tried that and I obtain funny errors, as in the picture. Unfortunately I can't have full control on faces of solids resulting from partition exploding. I also change the tolerance setting, but it doesn't work. In the future it could be interesting to have a multiple fuse operation available in Salome.

 

The following code do a multiple fuse on the solids contained in a shape :

# ---------

def MakeSolidsFuseOnSelectedShape():
    msg = "Please select one and only one geom shape !"
    from salome import sg
    selection = sg.getAllSelected()
    if len(selection) != 1:
        print msg
        return
    selection = selection[0]
    from salome import IDToObject
    selection = IDToObject(selection)
    key = "<GEOM._objref_GEOM_Object instance"
    if str(selection)[:len(key)] != key:
        print msg
        return
    import geompy
    solids = geompy.SubShapeAllSorted(selection, geompy.ShapeType["SOLID"])
    if len(solids) == 0:
        print "The selected shape contains no solids !"
        return
    result = solids[0]
    for shape in solids[1:]:
        result = geompy.MakeFuse(result, shape)
        pass
    return result

def MakeSolidsFuseOnSelectedShapeAndAddToStudy(name):
    shape = MakeSolidsFuseOnSelectedShape()
    if shape:
        import geompy
        geompy.addToStudy(shape, name)
        from salome import sg
        sg.updateObjBrowser(0)
        pass
    return

# ---------

To test it, you have to save the content in a multiplefuse.py file in the directory where
you launch salome or in a directory pointed by your PYTHONPATH. Then, select the compound
which contain all you shapes you want to fuse the solids, then in the python console, type :

>>> import multiplefuse
>>> multiplefuse.MakeSolidsFuseOnSelectedShapeAndAddToStudy("aaaa")

Don't forget to replace "aaaa" by the name you want to appear in study ...

If it fits your need, we can try to integrate this piece of code directly in the geom menubar ...

Regards,

                             E.A.

Re: multiple fuse operation

Posted by Robert Langner at July 07. 2010

Hi EA,

 

did you figured out why partitioning sometimes produce such weird faces ?

(I saw it mostly occurs concerning with non-planar faces.)

Without knowing the reason I can't use partitioning in large scripts without a potential risk.

 

Regards,

Robert

Re: multiple fuse operation

Posted by vaina at July 20. 2010

Hi all,

 

   sorry if I hadn't posted anymore. A lot of things to do - and I haven't found yet a way to monitor threads by e-mail :)

I thank Robert, I tested his suggestions but I find it laborious. Yes, I need all that partitioning because I use NETGEN to generate meshes and it doesn't like 'large' faces which have  a high curvature in many directions.

I thank a lot Erwan for his (how can I call that?) python script, I'm going to test it on next days, I'll post a feedback.

Re: multiple fuse operation

Posted by Erwan ADAM at July 20. 2010

Previously vaina wrote:

Hi all,

 

   sorry if I hadn't posted anymore. A lot of things to do - and I haven't found yet a way to monitor threads by e-mail :)


Log in, click on your name, edit your profile, select "Subscribe to new forum messages", save and you will receive every forum messages by email with a link to reach directly the discussion. But, may be I missed the problem ...

Re: multiple fuse operation

Posted by vaina at July 20. 2010

No, you don't (almost) miss the problem. It should be useful the subscription to own (or interesting too) threads. Anyway, I checked Subscribe to new forum messages.

Thank you, I'll give you feedbacks for the multiple fuse operation script.

Re: multiple fuse operation

Posted by vaina at July 20. 2010

I just tested the python script with my partitioned blade and it seems perfect. I haven't tested the object with a NETGEN mesh yet but in Salome it's OK (one solid and 'multiple' faces):

solid: 1
compsolid: 0
compound: 0
shape: 140

Thanks you again, Erwan. I think the script could be very useful for other purposes, please include it in the next release.

PS for other Ubuntu users: I saved the script in /salome_5.1.3/Pytho-2.4.4/lib/python2.4

 

Previously Erwan ADAM wrote:

Previously vaina wrote:

Hi all,

 

   sorry if I hadn't posted anymore. A lot of things to do - and I haven't found yet a way to monitor threads by e-mail :)


Log in, click on your name, edit your profile, select "Subscribe to new forum messages", save and you will receive every forum messages by email with a link to reach directly the discussion. But, may be I missed the problem ...

 

Re: multiple fuse operation

Posted by pierre_j at July 21. 2010

Hi all,

Your discussion is very interesting.

I just have a small question concerning integration. Erwan, when you say: "If it fits your need, we can try to integrate this piece of code directly in the geom menubar ...": what does it mean?

I mean, is there a kind of python macro management in GEOM? or will you implement in C++ and extend GEOM library? I am interested in that topic: I have several macros in mind that I would like to write in python. A system to manage python macros in GEOM (a bit similar to what can be done in ParaView to manage filters maybe) would be really interesting so that macros can be usable 'easily' for other users, without having to deal with too much with the TUI.

I thank you in advance for your feedback.

Bests,

Pierre

 

Re: multiple fuse operation

Posted by Erwan ADAM at July 21. 2010

Previously pierre_j wrote:

Hi all,

Your discussion is very interesting.

I just have a small question concerning integration. Erwan, when you say: "If it fits your need, we can try to integrate this piece of code directly in the geom menubar ...": what does it mean?

I mean, is there a kind of python macro management in GEOM? or will you implement in C++ and extend GEOM library? I am interested in that topic: I have several macros in mind that I would like to write in python. A system to manage python macros in GEOM (a bit similar to what can be done in ParaView to manage filters maybe) would be really interesting so that macros can be usable 'easily' for other users, without having to deal with too much with the TUI.

I thank you in advance for your feedback.

Bests,

Pierre

 

Hi Pierre,

I see that you have read carefully the thread ... Indeed, since Salome 5.1.4 and thanks to a terrific improvement due to Christian Caremoli, you can now customize the menubar of salome and of geom module. For the moment, you can only add functionalities into a "Tools/Plugins" menu for salome and into a "New Entity/Other" menu for GEOM. As far as I know, it is not implemented for other modules.

To play with plugins, you must define a SALOME_PLUGINS_PATH variable which contain the directories in which the plugins python files can be found. For instance, just define SALOME_PLUGINS_PATH to one directory in which you copy the files
http://files.salome-platform.org/cea/adam/salome/scripts/salome_plugins.py
http://files.salome-platform.org/cea/adam/salome/scripts/geom_plugins.py
Launch salome, open a study, an item "Tools/Plugins/About plugins" should appear. You can test it, it only launches a message dialog box
Activate GEOM module, an item "New Entity/Other/Fuse all solids" should appear. To test it, you have to select a geom shape to proceed, give a name, click on OK and it should do the job. Please, note that the dump / restore study works with this new added functionality but, of course, the generated python script contains the "atomic" calls to usual geompy features.

Any feedback / remark about this facility is welcome.

Regards, Erwan.

Re: multiple fuse operation

Posted by pierre_j at July 21. 2010

Thanks Erwan!

I'm gonna try to have a closer look on this.

Bests,

Pierre

Re: multiple fuse operation

Posted by vaina at July 22. 2010

Today I tested Erwan's script with a more complex case. It concernes two separated wings, but the partition 'to fuse' includes both (see attached image). I had troubles about memory allocation, I think.

 

>>> multiplefuse.MakeSolidsFuseOnSelectedShapeAndAddToStudy("blades")
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 27, in MakeSolidsFuseOnSelectedShapeAndAddToStudy
    shape = MakeSolidsFuseOnSelectedShape()
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 22, in MakeSolidsFuseOnSelectedShape
    result = geompy.MakeFuse(result, shape)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2357, in MakeFuse
    return self.MakeBoolean(s1, s2, 3)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2332, in MakeBoolean
    RaiseIfFailed("MakeBoolean", self.BoolOp)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 93, in RaiseIfFailed
    raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
RuntimeError: MakeBoolean : Impossibile allocare memoria

 

 

 

What kind of problem is it and how could I fix it? I'm sure that 'manual' fusing operation works, so I don't think it's a geometry problem.

Thanks for your attention.

Attachments

Re: multiple fuse operation

Posted by Erwan ADAM at July 22. 2010

Previously vaina wrote:

Today I tested Erwan's script with a more complex case. It concernes two separated wings, but the partition 'to fuse' includes both (see attached image). I had troubles about memory allocation, I think.

 

>>> multiplefuse.MakeSolidsFuseOnSelectedShapeAndAddToStudy("blades")
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 27, in MakeSolidsFuseOnSelectedShapeAndAddToStudy
    shape = MakeSolidsFuseOnSelectedShape()
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 22, in MakeSolidsFuseOnSelectedShape
    result = geompy.MakeFuse(result, shape)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2357, in MakeFuse
    return self.MakeBoolean(s1, s2, 3)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2332, in MakeBoolean
    RaiseIfFailed("MakeBoolean", self.BoolOp)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 93, in RaiseIfFailed
    raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
RuntimeError: MakeBoolean : Impossibile allocare memoria

 

 

 

What kind of problem is it and how could I fix it? I'm sure that 'manual' fusing operation works, so I don't think it's a geometry problem.

Thanks for your attention.

Is it possible to have a brep copy of the initial shape ?

Re: multiple fuse operation

Posted by Erwan ADAM at July 23. 2010

Previously vaina wrote:

Today I tested Erwan's script with a more complex case. It concernes two separated wings, but the partition 'to fuse' includes both (see attached image). I had troubles about memory allocation, I think.

 

>>> multiplefuse.MakeSolidsFuseOnSelectedShapeAndAddToStudy("blades")
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 27, in MakeSolidsFuseOnSelectedShapeAndAddToStudy
    shape = MakeSolidsFuseOnSelectedShape()
  File "/home/maurizio/salome_5.1.4/Python-2.4.4/lib/python2.4/multiplefuse.py", line 22, in MakeSolidsFuseOnSelectedShape
    result = geompy.MakeFuse(result, shape)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2357, in MakeFuse
    return self.MakeBoolean(s1, s2, 3)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 2332, in MakeBoolean
    RaiseIfFailed("MakeBoolean", self.BoolOp)
  File "/home/maurizio/salome_5.1.4/GEOM_5.1.4/bin/salome/geompyDC.py", line 93, in RaiseIfFailed
    raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
RuntimeError: MakeBoolean : Impossibile allocare memoria

 

 

 

What kind of problem is it and how could I fix it? I'm sure that 'manual' fusing operation works, so I don't think it's a geometry problem.

Thanks for your attention.

If it is really a memory allocation error, you can try to replace :

   for shape in solids[1:]:
        result = geompy.MakeFuse(result, shape)
        pass

by

    for shape in solids[1:]:
        result_old = result
        result = geompy.MakeFuse(result, shape)
        shape.Destroy()
        result_old.Destroy()
        pass

But for a mysterious reason, it breaks the save / restore study ... I will analyze that !

Does it work better for your case ?? Erwan.

Re: multiple fuse operation

Posted by vaina at July 23. 2010

I'm going to test your suggestion. But I'm afraid your previous script is right, maybe it faults becouse of my geometry. I realized I can't 'manually' fuse the two solids forming the tipe of one wing. Looking closer, they seem to not perfectly match. I could partition again the solid with a different vertical plane...
Please, could I send the case to you by e-mail, as you proposed? I sent a private message to you yesterday.

Attachments

Re: multiple fuse operation

Posted by JMB at July 25. 2010

Previously Erwan ADAM wrote:

Any feedback / remark about this facility is welcome.

Regards, Erwan.

Hello,

I am very happy to learn that this sorely needed feature in Salome has been added into version 5.1.4.  I installed it as directed and it appears in the "New entity -> Other -> Fuse all solids".  But the "Fuse all solids" operation does not seem to work for me as expected.  Here is what I did:

1. Created a standard cube (200x200x200) called "Box_1"

2. Translated this "Box_1" by DX=200 to create "Translate_1" then DY=200 to create "Translate_2, ensuring that "Create a copy" is chosen for both operations.  Thus there are 3 cubes placed beside each other that looks like a fat letter "L" shape.

3. Selected "Box_1" and clicked on the newly added "Fuse all solids" and gave it the name "Fuse_1".

4. "Fuse_1" was created, but it has the same dimensions as the original "Box_1"...

Am I doing something wrong?

Regards,

JMB

Re: multiple fuse operation

Posted by DAVID Gilles at July 25. 2010

Hi JMB,

I think you should create a compound with Box_1, Translate_1 and Translate_2 => Compound_1.

Then you can apply the function "Fuse all solids" to the compound Compound_1.

Regards,

Gilles

Re: multiple fuse operation

Posted by JMB at July 25. 2010

Previously DAVID Gilles wrote:

Hi JMB, I think you should create a compound with Box_1, Translate_1 and Translate_2 => Compound_1. Then you can apply the function "Fuse all solids" to the compound Compound_1. Regards, Gilles

Hi,

I tried that too earlier (and I tried again today) and I get:

Traceback (most recent call last):

File "/opt/salome_5.1.4/GUI_5.1.4/lib/python2.4/site-packages/salome/salome_pluginsmanager.py", line 151, in handler script(Context(sgPyQt))

File "/home/.../Salome-plugins/geom_plugins.py", line 46, in makeSolidsFuse shape = MakeSolidsFuseOnSelectedShape()

File "/home/.../Salome-plugins/geom_plugins.py", line 12, in MakeSolidsFuseOnSelectedShape selection = IDToObject(selection)

File "/opt/salome_5.1.4/KERNEL_5.1.4/lib/python2.4/site-packages/salome/salome_study.py", line 83, in IDToObject mySO = myStudy.FindObjectID(id);

File "/opt/salome_5.1.4/KERNEL_5.1.4/lib/python2.4/site-packages/salome/SALOMEDS_idl.py", line 463, in FindOjectID return _omnipy.invoke(self, "FindObjectID", _0_SALOMEDS.Study._d_FindObjectID, args)

OBJECT_NOT_EXIST:

CORBA.OBJECT_NOT_EXIST(omniORB.OBJECT_NOT_EXIST_NoMatch, CORBA.COMPLETED_NO)

Let me know if you need any more info to track down the problem.  Thanks for your help!

Regards,

JMB

Re: multiple fuse operation

Posted by DAVID Gilles at July 25. 2010

Well I've just tested it and it works.

I created the same cubes than yours in the GUI and then a compound of all cubes.

Then I select the compound in the object browser and I apply the function "Fuse all solids".

I write a name and I have the result published in the object browser.

Re: multiple fuse operation

Posted by JMB at July 25. 2010

Previously DAVID Gilles wrote:

Well I've just tested it and it works.

I created the same cubes than yours in the GUI and then a compound of all cubes.

Then I select the compound in the object browser and I apply the function "Fuse all solids".

I write a name and I have the result published in the object browser.

 

Hello,

Thanks for testing it on your PC.  What version and OS are you testing on?  I am trying it in Ubuntu Jaunty 9.04 (64bit) with Salome vers 5.1.4 (not SalomeMeca) in Intel QuadCore PC.

Salome installed is:  md5sum ac360176044fb18b261f36e26372f8aa  InstallWizard_5.1.4_Debian_4.0_64bit.tar.gz

Kernel is: 2.6.28-19-generic #61-Ubuntu SMP Wed May 26 23:32:46 UTC 2010 x86_64 GNU/Linux

Regards,

JMB

Re: multiple fuse operation

Posted by DAVID Gilles at July 25. 2010

I tested on Ubuntu 10.04.

My Salome version is a Dev one based on 5.1.4 (compiled from sources) but there should be no difference.

I'm going to compile the 5.1.4 to test on this version.

I think that the kernel version has nothing to do with your problem ;)

Re: multiple fuse operation

Posted by JMB at July 25. 2010

Hi,

I think I have some clues to a potential bug or pitfall:

1. Previously, I had another study opened and the "Fuse all solids" had failed with all the error messages I had posted.

2. Now, I tried in a freshly opened Salome 5.1.4 window and it worked!  (Also this time I opened a previously saved Multi-Fuse.hdf file that contained the 3 cubes and the "Compound_1", without recreating it.  This little detail or change in procedure may or may not be relevant )

3. So I decided to open a new file using the same session (if that is what one would call it) and tried it again, but the "Other" option in "New entity" is not even shown, in this second Salome window!

Perhaps one can conclude that:

a) The plugin works ONLY for the first geom window that has been opened.

b) Even if the plugin option "Other -> Fuse all solids" is shown in the "New entity" menu, it is not guaranteed to work if the geom window is not the first (and freshly) opened window.

Maybe this will help in improving the robustness of this and other valuable plugins.  I have attached screen pics of the two scenarios as evidence of the anomaly.

Regards,

JMB

PS: Would you kindly verify if you can duplicate my observations 1 ~ 3.

Attachments

Re: multiple fuse operation

Posted by DAVID Gilles at July 25. 2010

Yes I reproduce your observations: the plugin manager works only on hte first study.

I guess that's a limitation: it is mono study ;)

Re: multiple fuse operation

Posted by Richard S. at September 03. 2010

Hi all,

I just wanted to test whether I can  add own plugins to the geom-toolbar, but I have no idea how to manage that.

How can I  "define the variable SALOME_PLUGINS_PATH to one directory" ?

Thanks  for your help.

Regards,

Richard

( I use Salome5.1.4 on Windows XP)

Re: multiple fuse operation

Posted by Erwan ADAM at September 03. 2010

Previously Richard S. wrote:

Hi all,

I just wanted to test whether I can  add own plugins to the geom-toolbar, but I have no idea how to manage that.

How can I  "define the variable SALOME_PLUGINS_PATH to one directory" ?

Thanks  for your help.

Regards,

Richard

( I use Salome5.1.4 on Windows XP)

Hi Richard,

Copy the two sample files into a directory (C:\Salome5.1.4_ForTestsOnWindows\release\plugins in my case), then right click on salome.bat to modify it and add
@set SALOME_PLUGINS_PATH=C:\Salome5.1.4_ForTestsOnWindows\release\plugins
just before
@runSalome %*

It should work. Erwan.

Re: multiple fuse operation

Posted by Richard S. at September 03. 2010

Hi Erwan,

Thank you for your help!

It works perfectly.

Regards,

Richard

Re: multiple fuse operation

Posted by Meeca Pommet at September 07. 2010

richard, how do u find it working perfectly? 

Movie trailers