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!
User avatar
DeepSOIC
Posts: 6445
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

New feature: FaceMakers

Postby DeepSOIC » Sun Oct 02, 2016 12:48 pm

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 1929 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
Posts: 2855
Joined: Wed Oct 05, 2011 7:36 am

Re: New feature: FaceMakers

Postby ickby » Sun Oct 02, 2016 12:54 pm

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
Posts: 6445
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: New feature: FaceMakers

Postby DeepSOIC » Sun Oct 02, 2016 1:08 pm

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

Re: New feature: FaceMakers

Postby wmayer » Sun Oct 02, 2016 1:26 pm

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
Posts: 6445
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: New feature: FaceMakers

Postby DeepSOIC » Sun Oct 02, 2016 1:34 pm

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
Posts: 8278
Joined: Mon Dec 12, 2011 4:45 pm

Re: New feature: FaceMakers

Postby triplus » Mon Oct 03, 2016 7:51 pm

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 1854 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
Site Admin
Posts: 10826
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: New feature: FaceMakers

Postby yorik » Tue Oct 04, 2016 6:20 pm

@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
Posts: 6445
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: New feature: FaceMakers

Postby DeepSOIC » Tue Oct 04, 2016 6:23 pm

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.
pablogil
Posts: 694
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: New feature: FaceMakers

Postby pablogil » Wed Oct 05, 2016 7:43 am

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