New feature: FaceMakers

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

New feature: FaceMakers

Post by DeepSOIC »

since 0.17.8573:
General-purpose make-face-from-wires classes were introduced.

As a consequence, Part MakeFace (in menu Part->Make face from sketch wires) is now capable of making faces with holes with islands, such as bull's-eye pattern:
Image
Now it also accepts wires regardless of object type, as long as it has shape (it used to accept only Part2DObjects).

The new facemaking also applies to Part Extrude and Part Revolve, when "solid" is set to true.
revolve-bullseye.png
revolve-bullseye.png (182.79 KiB) Viewed 4789 times
The facemaker class in Part Extrude, Part Revolve and Part Face can be altered if necessary by editing their FaceMakerClass property. In future, I hope to make UI for selecting facemaker class of Part Face. As of now, there is no way to find out the class names other than browsing the source code, so I list them here:
* Part::FaceMakerSimple <-- makes faces from all closed planar wires, ignoring overlaps
* Part::FaceMakerCheese <-- made from code in Part Extrude. makes faces with holes, but no faces within holes.
* Part::FaceMakerExtrusion <-- legacy one used by Part Extrude
* Part::FaceMakerBullseye <-- new default

@wandererfan: I invite you to write a new facemaker based on TechDraw's EdgeWalker!

EDIT: forgot to mention, that facemakers can be used from Python, too.

Code: Select all

face = Part.Face(compound_of_wires, "Part::FaceMakerBullseye")
many_faces = Part.makeFace(compound_of_even_more_wires, "Part::FaceMakerBullseye")
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: New feature: FaceMakers

Post by ickby »

as of now, there is no way to find out the class names other than browsing the source code, so I list them here:
why did you not use a enumeration property?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: New feature: FaceMakers

Post by DeepSOIC »

Because then it would be impossible to define custom facemakers in other modules.
Enumeration properties are very annoying to extend.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: New feature: FaceMakers

Post by wmayer »

Code: Select all

Type::getAllDerivedFrom
gives you an array of subtypes of the given type. This way you can easily fill up the enumeration.

The only problem that may happen in the future is that after creating a feature and filling up the enumeration other modules are loaded with new face maker methods. This way it's not easy to add the new methods.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: New feature: FaceMakers

Post by DeepSOIC »

I actually thought of creating a special property type for this case (say, derived from PropertyEnumeration).

But the actual plan was to make a task dialog for Part Face that will have the UI to choose facemaker. The properties themselves can then be hidden.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: New feature: FaceMakers

Post by triplus »

I tested the feature and when using sketcher geometry or draft geometry in compound it produced expected results:
Face.png
Face.png (10.03 KiB) Viewed 4714 times
P.S. As there isn't a drop-down menu with options in it i feel that exposing the Face Maker Class doesn't make much sense.
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: New feature: FaceMakers

Post by yorik »

@DeepSOIC I don't know where/when that problem appeared, and if this is the right topic, but I cannot use Part.Extrude with solid = True on Draft objects that have a face anymore:

Code: Select all

rect = Draft.makeRectangle(length=100,height=100,face=True,support=None)
extr = App.ActiveDocument.addObject("Part::Extrusion","extrusion")
extr.Base=rect
extr.Dir=App.Vector(0,0,100)
extr.Solid=True # <-- here is the problem
Error: Exception (Tue Oct 4 15:13:04 2016): Shape must be a wire, edge or compound. Something else was supplied.
I think we should allow faces, no?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: New feature: FaceMakers

Post by DeepSOIC »

yorik wrote:Error: Exception (Tue Oct 4 15:13:04 2016): Shape must be a wire, edge or compound. Something else was supplied.I think we should allow faces, no?
Yes, I made it strict, and it's causing too much trouble.
issue #2720
Needs to be relaxed again, I think.
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: New feature: FaceMakers

Post by pablogil »

Really cool feature, thanks!
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
Post Reply