Personal tools
You are here: Home Forum Use Problem with MakeCut

Problem with MakeCut

Up to Use

Problem with MakeCut

Posted by Nigirim at December 05. 2012

Hi all,

I have got a problem relating geompy.MakeCut, I'm currently using Salome 6.5.0 on Ubuntu 12.10

 

I have written a script to automatically cut and mesh my geometry. During the cutting there is a loop to iterate the volume of my geometry and cut it down to a value I specify earlier. My problem here is it works only sometimes and if it doesnt work I can got to the GUI and make the cut on my own and then there is no error. Sometimes the loop works perfectly but the cut afterwards crashes.

In Conclution my script works sometimes and sometimes it crashes with RuntimeError "non valid shape", but I can create the cut manually every time (using the GUI or write geompy.MakeCut(Shape1,cylinder) into the python console. 

So my questions are:

Is there anything like a maximum number of cuts per session or script?

Am I just unlucky?

Are there any known bug relating to this?

 

My while-loop to iterate the volume goes like this:

volumeLiquid = minVolume

[code]

while volumeSigma<=sigma 

dz=dzNominal-j*0.1e-4

cylinder = geo.MakeCylinder(topPoint, vectorDown, 2*Xmax1, dz)

cut = geo.MakeCut(Shape1,cylinder)

propsTemp = geo.BasicProperties(cut)

volumeSigma = propsTemp[2]-volumeLiquid

j=j+1

[/code]

dz=dzNominal-j*0.1e-4

cylinder = geo.MakeCylinder(topPoint, vectorDown, 2*Xmax1, dz)

cut = geo.MakeCut(Shape1,cylinder)

propsTemp = geo.BasicProperties(cut)

volumeSigma = propsTemp[2]-volumeLiquid

j=j+1

[/code]

Thanks in advance

Nigirim

My English isnt the best so if you dont understand something just ask me :D

Re: Problem with MakeCut

Posted by William Tougeron at December 05. 2012

Hello Nigirim,

Maybe you could give your whole script, else it is difficult to test it...

But it should be no reason that your script isn't able to do the same than you in the GUI. Anyway, you can maybe increase your chances of success by using the Limit tolerance tool (in the Repair menu of the GUI).

This permits to change the tolerance used during the boolean operations. Maybe it can help.

Best regards,

William

Re: Problem with MakeCut

Posted by Nigirim at December 05. 2012

Hello St.Michael and William

Thanks for your replies

 

@William

I don't feel comfortable giving my whole script, it is embedded in a bashscript and doesn't work without it.

Thanks for the tip with the limit tolerance tool I will give it a try (what is the default tolerance of salome?)

 

I made some tests and there is one thing I want to try but I don't know how to write it in python.

My loop for iteration is the one I posted earlier and I would like to add something that deletes the created cut after I get my new value for volumeSigma. So that there are not like 200 cuts with the same name but different heights in my ram.

 

Thanks in advance

Nigirim

 

Re: Problem with MakeCut

Posted by William Tougeron at December 07. 2012

Hello Nigirim,

what is the default tolerance of salome?

I guess it is the one appearing by default when you open a Limit tolerance window in the GUI. :)

I would like to add something that deletes the created cut after I get my new value for volumeSigma

It seems to be one shortcoming of Python to not release completely memory when deleting an object... See for example here:

http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm

So, in your script, you have only one object called "cut", which is erased at each loop (in theory). Each time you call "cut = geompy.MakeCut( etc.)", the "cut" object is deleted and replace with the new one (still in theory). But the memory increases even though...

I am afraid there is no solution for this problem for the moment...

Best regards,

William

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012

Hello William,

 

Thanks for your reply.

 

I didn't know there was an issue regarding the release of memory, that might be a problem. Thanks for that.

This may have brought me onto the wrong track, trying to delete the cuts right after the volume was calculated.

 

Regarding the problem with makeCut I found something rather interesting.

 

Salome seems to have problems importing some of my step files, sometimes the wires are closed right after the cut and sometimes they aren't (not the same step file but the same geometry) that might cause the problem of a non valid shape Error

.

 

My step files are made with SolidEdge v20, so there are two new things that might be the problem.

 

1. Salome can't read step files properly sometime

 

2. SolidEdge v20 exports broken step files sometime

 

I guess I'll have to search the error here and not in makeCut, some of the files have edges that do not end properly (one line just goes on right where it should have ended)

 

Are there any known issues regarding the step files with Salome or SolidEdge v20 (Maybe someone knows about something with SolidEdge)?

 

 

P.S. I have to deal with the exporting problem of .unv files and I don't want to open another topic so I just ask it here.

 

I found the topic relating the problem of one missing space, but the quick and dirty python fix didn't work for me and i can't find the SMESH_SRC/src/DriverUNV/UNV

164_Structure.cxx file. Where should I search for the file or is there a python fix that works?

I'm using ubuntu 12.10

 

Thanks in advance

 

Nigirim

 

 

Re: Problem with MakeCut

Posted by William Tougeron at December 07. 2012

Hello Nigirim,

sometimes the wires are closed right after the cut and sometimes they aren't

If the wires get open only after the cut, I think it is not because of an import problem, but of a cut problem. But without any information about your geometry (at least screenshots of the geometry to cut and of the cylinder), it is difficult to make any diagnostic...

(I have never used SolidEdge.)

I don't want to open another topic

Maybe you should open another topic, because both problems are quite different (one about Geometry module, the other about Mesh module)

Personnaly, I don't have any experience with this problem.

Best regards,

William

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012

Hello William

 

I have made some screenshots, all with one step file, but two different cuts, I always used the startGeometry and a box at the x-z-plane to cut it in half.

 

The other screenshots will follow right after this post

 

 

Well then I guess I have to open another topic

 

Thanks in advance

 

Nigirim

 

 

Attachments

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012

The first try of cutting it in half

Attachments

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012
The second try of cutting it in half

.

It might be hard to see so I point it out.

 

If you take a look at the first cut there are two wires not cut, if I use cut the second time the two edges are missing where the

wires in the first cut were

 

Nigirim

Attachments

Re: Problem with MakeCut

Posted by William Tougeron at December 07. 2012

Hello Nigirim,

I agree that it is a bit strange that the same input shapes give different results at different times...

I see two ways to maybe have better results:

- The first is to use the Limit tolerance tool that I told about earlier. (Don't hesitate to increase both tolerance of the shape to cut and of the tool shape)

- The second is to use the Operations, Partition instead of make a cut. This tool allows to split shapes, and it works sometimes better than boolean operations. After the partition, you just have to explode the compound it creates and to extract the shape you want to keep. Logically, the ID of the shape to keep should be each time the same. Else you can make some test in your script to know which shape to keep (for example, checking the position of the center of mass).

In addition, if you want to cut with a plane, you can use the "partition with plane" (second icon in the partition pop-up window). This is more robust and fast than the classical partition tool.

Hope this help :)

Best regards,

William

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012

Hello William,

 

Thanks for your help so far.

 

Limit tolerance didn't bring any solutions to my problem with this file (My other files seem to work, but I'm not really sure if it lasts long).

 

This file is really hard, Partition doesn't even scratch the shape. It still looks like i didn't do anything if I use the different ways of Partition, no extra edges and right after the partition i can't even cut it.

 

I'm starting to wonder if the problem is the step file i got from SolidEdge, but why should it be so, the step looks good right after the import I just can't cut it or use Partition.

I also tried to cut it with planes or other shapes, nothing gives any reasonable results.

 

Maybe I just have to find a workaround for this specific file.

Nigirim

Re: Problem with MakeCut

Posted by Nigirim at December 07. 2012

It seems I found my problem as simple as i can be.

The original file from SolidEdge (.par) seems to be damaged, I rebuild the whole geometry from the beginning and it works now. :D

 

Greets

Nigirim

Re: Problem with MakeCut

Posted by William Tougeron at December 10. 2012

Congratulation ! :)

Glad to read this :)

Have a nice week :)

William

Powered by Ploneboard
Document Actions