Filip,


There are three NURBS tessellation methods currently implemented in the code.  One is an 
old one that does piecewise subdivision into Bezier patches, and then naively tessellates 
each patch to a specified mesh density.  It usually results in a highly detailed mesh 
that you'd probably want to then decimate (and it was rather slow).  The main problem 
with that method is that it is hooked into BRL-CAD's "old" / previous boundary 
representation support ('bspline' entities), which suck for other reasons and aren't what 
the step-g importer creates.



The step-g importer creates "new" NURBS boundary representation objects ('brep' 
entities), and has two basic tessellation methods.  One just does a quick iteration over surfaces 
and gest a quick set of triangles -- this is what yo usee if you draw shaded in Archer (or 
"draw -m1 object" in mged).  It's intended for visualization.



The other method is stubbed in a compile-time WATER_TIGHT preprocessor block that hasn't 
been released yet.  As the name suggests, this method goes a bit further to "seal 
the gaps" between two adjoining surfaces while it tessellates.  It was implemented 
somewhat quickly and without a lot of testing, which is why isn't not exposed yet to 
userland anywhere.  That's where I'd start, though ( src/librt/primitives/brep/brep.cpp).



If you're interested in the code, the function that currently tessellates when 
you draw is the *_plot() callback, but for g-stl what is needed is the *_tess() 
callback.



Cheers!
Sean



On Jul 26, 2017, at 11:18 AM, Filip Binkiewicz <fi...@3dhubs.com> wrote:


Hey, Robert,


I very much appreciate your effort to help me. I have tried using FreeCAD for 
this purpose.

It is, however, dependent on OCC, which runs an algorithm that is not 
satisfactory for my

application (as you can see on the example - the tessellation is far from 
smooth, and

when you increase the tessellation precision, the file gets unacceptably large, 
compared

to commercial software, like Autodesk Fusion 360).

This is why I tried BRL-CAD, which is even more mature than OCC. I may be able

to add a patch for BRL-CAD for tessellating NURBSs, but I will have to do more

research before that



Thank you for your help,

Filip



On Wed, Jul 26, 2017 at 5:00 PM, Bob Anderson <bob.ander...@survice.com> wrote:


Here is an example of the Python script to automate this from FreeCAD’s website 
(https://forum.freecadweb.org/viewtopic.php?t=13833) …

 

from PySide import QtCore

import Part, Mesh

 

d=QtCore.QDir("Directory_to_step_files")

d.setNameFilters(["*.step", "*.stp"])

files = d.entryInfoList()

 

for i in files:

    shape = Part.Shape()

    shape.read(i.absoluteFilePath())

    mesh = Mesh.Mesh()

    mesh.addFacets(shape.tessellate(0.01))

    mesh.write(i.absolutePath()+"/"+i.baseName()+".stl"

 

Robert Anderson

 

From: Filip Binkiewicz [mailto:fi...@3dhubs.com]
Sent: Wednesday, July 26, 2017 9:32 AM
To: BRL-CAD Users Mailing List <brlcad-users@lists.sourceforge.net>
Subject: Re: [brlcad-users] Hey, I'm trying to convert a STEP file into an STL 
triangle mesh, and BRL-CAD seems to be the perfect match for this task. I am 
having trouble achieving it, however. Here's what I do I take any model, let's 
say this one: https://raw....

 

Hello, Sean,

thanks for the news. When can I expect support for NURBS tesselation?

Also, you mentioned that this isn't yet exposed - does this mean it is 
implemented?

Is there a way to expose it in my local fork and if there is, where should I 
start looking?

Cheers,

Filip

 

On Wed, Jul 26, 2017 at 3:00 PM, Christopher Sean Morrison <brl...@mac.com> 
wrote:


Hi Filip,

You’re not doing anything wrong.  You ran into an unimplemented feature.

Now, when I try to produce an STL file, I get an error:
$ ./BRL-CAD_7.26.0_Linux_x86_64/bin/g-stl -o aube_pleine.stl aube_pleine.g 
Assembly1
ERROR(Brep_2.s): tessellation failure
0 triangles written

I don't know how to handle this, as I am quite new to BRL-CAD - I would 
appreciate some insight


When you imported the STEP file, it contained a NURBS boundary representation 
(brep) entity.  Support for converting NURBS into triangles (i.e., 
tessellation) isn’t yet exposed as a feature, so the export reports a failure.

There is code that turns the NURBS into triangles for display, but I don’t 
think there’s a way to get at those triangles just yet as a user.  To any devs 
interested in implementing this, look near the WATER_TIGHT define in 
src/librt/primitives/brep/brep.cpp.  Sorry I don’t have better news Filip.

Cheers!
Sean



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Users mailing list
brlcad-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-users




--

 

 




 

        

        

 

        

 




Filip Binkiewicz
R&D Support




 

        

 

                

 

        

 




T +48 725 048 447
E fi...@3dhubs.com
S filipbinkiewicz




 

        

 

                

 

        

 







 

        

 

        

 




 




 

        

 




 



        

                

                

Check out 3D Hubs Knowledge Base: quality articles for engineers and designers 
to learn about 3D printing.




 




 

        

 




 

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Users mailing list
brlcad-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-users





--



 

        
                
 
Filip Binkiewicz
R&D Support
 
                
                
 
T +48 725 048 447
E fi...@3dhubs.com
S filipbinkiewicz
 
                
                
 



 
         
         

 

        
 
 


        

        
        

        
        Check out 3D Hubs Knowledge Base: quality articles for engineers and 
designers to learn about 3D printing.

 
 
         

 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
BRL-CAD Users mailing list
brlcad-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-users
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Users mailing list
brlcad-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-users

Reply via email to