closed wire faces not showing as filled...

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
kugelfang
Posts: 5
Joined: Wed Mar 01, 2017 4:36 pm

closed wire faces not showing as filled...

Post by kugelfang »

This is my first time tinkering with FreeCAD and Python. I'm really just blundering about trying to figure things out.

My goal is to import a non-triangulated model as a collection of faces and then use FreeCAD to normalize and stitch the faces together to allow a printable and foldable model to be constructed from paper or cardstock. I've seen a couple of FreeCAD macros that unfold on a very limited basis, so I'm pretty sure the ability is there.

Attached is a zip file containing a Python macro which creates a ship model in FreeCAD. The Python script is output of a Ruby script I wrote which allows me to parse in and manipulate a *.obj file. The script parses the model polygons and writes Python code to create FreeCAD wires as closed faces. Eventually, if I can get FreeCAD to do what I want I'll probably rewrite the Ruby in Python so the whole process can be done as a FreeCAD macro. But that's some time in the future.

For now, there are a couple of things have cropped up which I'm not sure how to resolve. First, not all the faces come out as faces in FreeCAD. I don't know why since all the polygons of the model are handled the same way. The wires appear to be correct, but the faces are not filled in. Anyone have any suggestions as to what's going on here?

Second, is it possible to assign the faces to the various groups in the model? I can of course do it in the FreeCAD GUI, but it would be a lot more convenient to do it in the generated code. Sadly, when doing this in the GUI I do not see the equivalent code in the Python window, otherwise this would be a non-question. I understand there's not much functionality to groups, but simply showing and hiding them would be helpful later on in the process of 'unfolding' the model.

FInally, what is the 'support=None' in this sample code:

Draft.makeWire(wire,closed=False,face=False,support=None)

Thanks!

--jeff


OS: Linux Mint 17.3 Rosa
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
katie.py.zip
(20.11 KiB) Downloaded 28 times
kugelfang
Posts: 5
Joined: Wed Mar 01, 2017 4:36 pm

Re: closed wire faces not showing as filled...

Post by kugelfang »

I found an example of adding the wires to the groups in code so that question has been answered.

--jeff
kugelfang
Posts: 5
Joined: Wed Mar 01, 2017 4:36 pm

Re: closed wire faces not showing as filled...

Post by kugelfang »

After a bit of tinkering I now suspect that the non-showing faces suffer from being non-coplanar. (If I triangulate the model all the triangles show as faces. But that defeats the purpose of what I'm trying to accomplish.) Is there a way to adjust the tolerance of a face or enforce that a wire is planar?

Thanks,

--jeff
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: closed wire faces not showing as filled...

Post by yorik »

Indeed non-planar wires don't create faces. There isn't really a way to enforce it, but there are several macros on the wiki and functions in DraftGeomUtils to fix non-planar wires. You might find some material there to add to your script.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: closed wire faces not showing as filled...

Post by microelly2 »

It's possible with FreeCAD to create such non planar surfaces

http://freecadbuch.de/doku.php?id=blog: ... auer_bauen

it's to late for today to study your script :P ,
but we are working on a shoe last project where we import a shoe scan and create our model
https://forum.freecadweb.org/viewtopic.php?f=3&t=20525
maybe the ideas are reusable
Post Reply