Problem with MakeCut

Problem with MakeCut

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

Re: Problem with MakeCut

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.

Re: Problem with MakeCut

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.

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...

Re: Problem with MakeCut

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

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)

Re: Problem with MakeCut

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.

Re: Problem with MakeCut

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.