Personal tools
You are here: Home Forum Use on generating complex geometry

on generating complex geometry

Up to Use

on generating complex geometry

Posted by Francesco at November 19. 2012

Hello,

as my activity in this forum shows, i am trying to generate a mesh of complex irregular geometry composed by 100s of cylinders.

The generation of the geometry (compound) itself is relatively fast.  However,  as documented before, as soon i try to generate the solid with Boolean operation the code crashed or terribly slow down so at today i am still have not been able to obtain a result.

Thus i feel the need to change approach, and need to explore different procedures that avoid fuse operations between the solid cylinders.

A) My first hope is to find a way to extract only the external surface from a compound object. Is that possible? I was trying to use the repair tools to remove the internal wire but they are ineffective. 

B) elaborating what Saint Michael was suggesting me in  http://www.salome-platform.org/forum/forum_10/151095632#458677606 another option for me is  a)  generate all cylinder(solid)  b) extract the shell of  cylinder c) intersect shell with neighbour cylinders  (to remove internal surfaces) d) glue all shells together g) create solid from resulting shell.  Will this option be more stable? in this way i think i have more operation but each operation is simpler... Do you think i will gain in speed or stability?

Any Idea or comment will be very well accepted.

thank you

francesco

 

 

 

 

 

 

Re: on generating complex geometry

Posted by William Tougeron at November 20. 2012

Hello, Francesco,

Thinking about what said pierre_j here:

http://www.salome-platform.org/forum/forum_10/151095632#324568112

I would say: In your structure, lots of elements have the same shape. Actually, there are two types of element shape: the one of elements being inside the structure, and the one being at its periphery (at least, I think ; I didn't check it but it seems logical to me).

So, maybe you can prepare these two shapes and then copy, translate and rotate them so that they find there final position in the structure. Then, the fuse or the partition operations should work better because you won't have any intersected faces.

You can even create only the external faces of your shapes, and then once positioned make a shell of all your faces and create a solid from it.

Is it relevant?

Best regards,

William

Re: on generating complex geometry

Posted by Francesco at November 20. 2012

Unfortunatly the final structure i am trying to obtain is not regular. Attached is a figure of the  "compound" structure. To reach this point it is pretty easy and i obtain this compound in 2-3 minutes. My problem is to build a grid out of this compound and eventually to obtain some geometrical property of the solid (i.e. surface and volume which is obviously not the the simple summ of the surface of the cylinders.

What i also want to point out is that now i am actually not worried of number of operation or speed, since salome' itself crashes doing the fuse operation, and thus i do not have any result independently on how long i wait. So i think first i need to find a more stable approach that uses different kind of operations or entities (not that just reduces the number of operations). 

"create only the external faces of your shapes, and then once positioned make a shell of all your faces and create a solid from it."  this is exactly what i am hoping to do and before coding it i was asking if working with shells is stable and reliable than using solids. ....

 

thank your time and help...

francesco

 

 

Attachments

Re: on generating complex geometry

Posted by William Tougeron at November 20. 2012

Hello Francesco,

I don't have the solution to the boolean operation problems, however I maybe know how to sort "external" and "internal" faces. But actually the shape of the final structure is a bit different (see the enclosed picture). Here is the strategy:

1 - First, you don't need to create the cylinders (solids) but only their surface of revolution (not their disks). This is to accelerate the following operations. Or you can create solids, then explode them to get these surfaces (using the New Entity, Explode tool).

2 - Then, you create a big partition of all these surfaces. If you use the Operations, Partition tool without giving any "tool" object (by putting all the geometrical objects in the field called "Objects"), it will intersect and cut all the surfaces and put them into a compound object.

3 - Then, you will need to delete the surfaces you don't want any more (the "internal" surfaces). To do so, you can explode your partition and make a loop in your script checking all the exploded surface areas. You can do it using the Measures, Basic Properties tool. Since the surfaces to remove are smaller than the one to keep, you can just set a threshold above which you keep the surface.

4 - Once done, you can create a new shell (New Entity, Shell) with the surfaces you sorted out.

5 - Finally, you can use the Repair, Suppress Holes tool to close all the holes automatically. This will close them very properly with smooth tangential surfaces as on the enclosed picture.

On the paper, it works... But I think such problems encountered with the fuse operations will also occur here.

Hope this helps

William

Attachments

Re: on generating complex geometry

Posted by Francesco at November 20. 2012

Thank you William,

 

I am currently under deadline but i will try this as soon as possible. It is exactely what i was trying to do and on paper is perfect:

it covers also the hole between the cylinders (something i was planning to do with an extra sphere), and will allow me to use also cylinders with different radius (I am never satisfied :) ..) since its automatically smooth out the steps at the cylinder intersection.

 

Point 2-3 is the operation that i did not thought about. Point 3 give me the little constraint that i can not use very short cylinders. But this is not a problem.  

 

I obviously have to learn better the python scripting in order to do this and this may be a good thing :D .

 

As you said on paper it works, in practice i am wondering if Salome is smart enough to be able to close the correct holes (point 5) in such a complex geometry ...  Lets hope for the best.

 

 

I will try this and keep you updated...

 

Meanwhile THANK YOU A LOT , i really appreciate your help.

francesco

 

 

 

Re: on generating complex geometry

Posted by William Tougeron at November 28. 2012

I FOUND THE SOLUTION !!!! :D

You just have to use the Repair, Limit tolerance tool! :)

It permits to change the "tolerance" of the shape, which is then used during boolean operations or partitions!

I tested it and it simply works! :)

Champagne!

I enclose a script building the Kelvin structure by the way we told about: create cylinder surfaces, partition them, sort out the surfaces, make a shell, close its holes, and then make a solid.

And another last "improvement" of the script: To create the cylinders, I now create one and then copy it n times thanks to a function which makes transformations "from a vector to another". This permits by example to copy easily other shapes than cylinders - even if I don't know if you will find it usefull... :)

:)

William

Attachments

Re: on generating complex geometry

Posted by Francesco at November 30. 2012

YUHUUUUUU...

Thank you a lot...

 

I was coming back to report that i was able to make your last suggestion to work. And i found that you precede me on the updates... 

THANK YOU A LOT FOR THE WORK...

Thank you to find the "Repair, Limit tolerance tool"  that was the tool needed in the first place.

However now i have built the surface approach and i think i will keep using it since it has no Boolean operations. ( well it has only the partition tool).

 

I see that you :

get the hole edges, their id and then you close them.

 

*** Is ther a reason to do so?

what i do (but i have few problem..) is just create a compound of the relevant surfaces, create the shell, then use directly the SuppressHoles tool, then i am ready to  make the solid ...

 

Up to now I have been successful in creating a 5X5X4 regular Kelving cells structure(see atachment).

Up to now i have 2 problems when the structure is randomized.

 

*** a) for the randomized structure 5X5X4  the partition tool failed. ( here maybe i should try the  Repair, Limit tolerance

tool ...)

*** b) when only two cylinders intersect in a node and the edge of the hole to be closed is really has a sharp angle the

      suppress hole tools works but basicalli it creates a very very long been ... (see attachment in next post ...)

 

I have an extra question ...

to create the structure i have a loong list of operations to place the cylinders, i would like to have  these cylinders in a separate file and call this file from the main script.

what i was trying is :

 

import sys

sys.path.append("/home/francesco/WORK/3Dmodels/GRIDGenerator")

import shell1x1

 

where shell1x1 has just the list of operations to place the cylinders...

it works ir creates the cylinders, i can see the cylinders in the gui, but the main script does not see the cylinders ...

***Any idea on how to do this correctly...?

 

 

GREAT GREAT

AND THANK YOU EVERYBODY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

 

 

 

 

 

 

 

 

Attachments

Re: on generating complex geometry

Posted by Francesco at November 30. 2012

this is an extra picture of the suppress hole,:

 

THANK YOU EVERYBODY AGAIN

francesco

Attachments

Re: on generating complex geometry

Posted by William Tougeron at December 03. 2012

Hello, Francesco :)

"Is ther a reason to do so?"

Actually, I didn't see any other way to do it in a script, because the geompy.SuppressHoles() function needs the precise list of edges to "close". At least, it is what I understood. I didn't find any way to do it in one single step like in the GUI.

"here maybe i should try the Repair, Limit tolerance tool ...)"

Indeed :)

"the suppress hole tools works but basicalli it creates a very very long been"

Yes... I noticed this problem. But maybe the use of suppressHole is not always necessary. Maybe you can close the holes just by creating faces from the "hole wires" that you can get in a script using the geompy.GetFreeBoundary() function (like in my script). The faces won't be tangential, and maybe not always very pretty, but I think it will be better than on your picture :)

"i can see the cylinders in the gui, but the main script does not see the cylinders ..."

Maybe you could enclose a script example (main script + script to import)... Personnaly I don't have experience with such things...

Best regards,

William

Re: on generating complex geometry

Posted by DAVID Gilles at December 03. 2012

"i can see the cylinders in the gui, but the main script does not see the cylinders ..."

If you try:

<pre>from shell1x1 import *</pre>

Do you have access to the cylinders ?

Re: on generating complex geometry

Posted by William Tougeron at December 04. 2012

Hello Francesco,

I think I would do this way: In the file to import, I would create a function which returns the cylinders.

Example:

- In the file shell1x1:

def PositionedCylinders():

___ Cylinders = []

___ # code in which cylinders are positionned and appened to the array "Cylinders"

___ (...)

___ #-

___ return Cylinders

- In the main script:

import sys

sys.path.append("/home/francesco/WORK/3Dmodels/GRIDGenerator")

from shell 1x1 import *

Cylinders = PositionedCylinders()

(...)

William

Re: on generating complex geometry

Posted by Francesco at December 12. 2012

Hi everybody,

I didn't replied to some issues ...

 

to DAVID Gilles :

tank you a lot  ,

from shell 1x1 import *

has solved my script issue, at least in a test  with 36 cylinders.

 

to William Tougeron :

thank you a lot.

a) about the geompy.SuppressHoles() function :

     i do it without the edges but creating a compound of the faces :

CompoundExternalCylinders = geompy.MakeCompound(ShapeListCompound)
Shell_1 = geompy.MakeShell([CompoundExternalCylinders])
SupressHoles_1 = geompy.SuppressHoles(Shell_1, [])

      where ShapeListCompound is the list of all the external faces.

      It seems to me that this is working properly.

 

b)  about ""i can see the cylinders in the gui, but the main script does not see the cylinders ..."

    well probably this was just BS. I was not seen the cylinders in the gui ... So i was not accurate in the description of the problem.

    anyway (from shell 1x1 import * )  solved it.

 

c) i will test the geompy.GetFreeBoundary option

 

d) Finally thank you a lot fo your script solution of the previous post. Maybe i will not use it but for sure it has tought me something. 

 

Finally thank you all again for the help.

francesco

Re: on generating complex geometry

Posted by William Tougeron at December 12. 2012

Your welcome :)

By helping you I learned also about the Limit tolerance... So... :)

All the best :)

William

Powered by Ploneboard
Document Actions