For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Size of faceting.

Vishwanath's picture
Forums: 

Hi,

Does anybody know about how to control the size of facets when we export STL file from IGES or STEP or any other file format. Is there any size parameter where we can change the size of facets of STL.

Thanks
Vishwanath.

Pawel's picture

You could use something like this:

StlAPI_Writer writer;
writer.RelativeMode() = Standard_False;
writer.SetDeflection(deflection);

Pawel

Game Milky's picture

Dear Pawel,

I have above codes posted by you! I have the same problem of refining STL file

Standard_Real deflection=0.00001;
Standard_Real coefficient=1;
StlAPI_Writer myStlWriter;
myStlWriter.RelativeMode() = Standard_False;
myStlWriter.SetCoefficient(coefficient);
myStlWriter.SetDeflection(deflection);
myStlWriter.Write(shape, "simmant-3.stl");
Handle(StlMesh_Mesh) myMesh = RWStl::ReadFile(OSD_Path("simmant-3.stl"));

I don't see any error but no output too! I wait for long but wouldn't find any output

What is wrong with it, anybody can help

Regards

Game

Pawel's picture

Hi Game,

your deflection value: 0.00001 is VERY low. Choosing 1/100th of a micron might result in rather long computation times. Try adjusting this.

Pawel

Game Milky's picture

Dear Pawel,

Thank you very much! It works now but have still some problems!

I try to experiment how StlAPI_Writer works by changing deflection value and type of input CAD data (i am using IGES as an output)
I figure out three problems (cases) as below
1. Changing deflection value has no effect on written stl file
2. Works well for some CAD files (Iges) before sewing
3. After sewing, some patches are triangulated very fine and some very course and finally the output stl is very bad.

Both cases happened to my case!

What would be the case! It seems that, if i do not use sewing, the StlAPI_Writer works well.
I used the default StlAPI_Writer to write stl file, and compared with original file (Iges) in some domain of the object, there are even more than 40mm deference!
Is there a better way to write stl file, specially after sewing!

Regards

Game

some time doesn't have any change what ever change in deflection you made! For some data files, it work well.

For my case, I write an stl file after using sewing algorithm, and some patches are triangulated very fine, and some very course, and it looks really very ugly. I try to experiment