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<mailto: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<mailto:brlcad-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/brlcad-users



--





[Image removed by sender. Filip Binkiewicz]





Filip Binkiewicz
R&D Support










T +48 725 048 447<tel:+48725048447>
E fi...@3dhubs.com<mailto:fi...@3dhubs.com>
S filipbinkiewicz










[Image removed by sender. 3D HUBS]<https://www.3dhubs.com/>



















[Image removed by sender. Facebook]<http://www.facebook.com/3dhubs>

[Image removed by sender. Twitter]<http://www.twitter.com/3dhubs>

Check out 3D Hubs Knowledge Base<https://www.3dhubs.com/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

Reply via email to