Draft Facebinder: Difference between revisions

From FreeCAD Documentation
No edit summary
Line 70: Line 70:


<!--T:6-->
<!--T:6-->
See also: [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
See also: [https://www.freecadweb.org/api Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:7-->
<!--T:7-->
To create a Draft Facebinder use the {{incode|make_facebinder}} method of the Draft module:
The Facebinder tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

</translate>
</translate>
{{Code|code=
{{Code|code=
Facebinder = makeFacebinder(selectionset)
facebinder = make_facebinder(selectionset)
}}
}}
<translate>
<translate>

<!--T:8-->
<!--T:8-->
* Creates a {{incode|Facebinder}} object from the given {{incode|selectionset}}, which is a list of {{incode|SelectionObject}}s as returned by {{incode|FreeCADGui.Selection.getSelectionEx()}}. Only selected faces are taken into account.
* Creates a {{incode|facebinder}} object from the given {{incode|selectionset}}, which is a list of {{incode|SelectionObject}}s as returned by {{incode|FreeCADGui.Selection.getSelectionEx()}}. Only selected faces are taken into account.
** {{incode|selectionset}} can also be a {{incode|PropertyLinkSubList}}.
** {{incode|selectionset}} can also be a {{incode|PropertyLinkSubList}}.
Line 102: Line 104:
<!--T:9-->
<!--T:9-->
Example:
Example:

</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD
import FreeCAD as App
import FreeCADGui
import FreeCADGui as Gui
import Draft
import Draft


# Insert a solid box
# Insert a solid box
Box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box")
box = App.ActiveDocument.addObject("Part::Box", "Box")
Box.Length = 2300
box.Length = 2300
Box.Width = 800
box.Width = 800
Box.Height = 1000
box.Height = 1000

# selection = Gui.Selection.getSelectionEx()
selection = [(box, ("Face1", "Face6"))]
facebinder = Draft.make_facebinder(selection)
facebinder.Extrusion = 50

App.ActiveDocument.recompute()


facebinder.Placement.Base = App.Vector(1000, -1000, 100)
# selection = FreeCADGui.Selection.getSelectionEx()
facebinder.ViewObject.ShapeColor = (0.99, 0.99, 0.4)
selection = [(Box, ("Face1", "Face6"))]
Facebinder = Draft.makeFacebinder(selection)
Facebinder.Extrusion = 50
FreeCAD.ActiveDocument.recompute()


App.ActiveDocument.recompute()
Facebinder.Placement.Base = FreeCAD.Vector(1000, -1000, 100)
Facebinder.ViewObject.ShapeColor = (0.99, 0.99, 0.4)
}}
}}
<translate>
<translate>

Revision as of 14:36, 17 March 2021

This documentation is a work in progress. Please don't mark it as translatable since it will change in the next hours and days.

Draft Facebinder

Menu location
Drafting → Facebinder
Workbenches
Draft, Arch
Default shortcut
F F
Introduced in version
0.14
See also
Arch Wall

Description

The Draft Facebinder command creates a surface object from the selected faces of solid objects. A Draft Facebinder is parametric, meaning that if you modify the original object, it will update accordingly. Even if you move and rotate a Draft Facebinder, it will stay linked to the original faces.

It can be used to create an extrusion from a collection of faces. A typical use is in architectural design to build an object that covers several walls, for example a wall finish.

Facebinder created from the faces of solid walls

Usage

  1. Pick one face, or hold Ctrl and pick several faces, from solid objects.
  2. There are several ways to invoke the command:
    • Press the Draft Facebinder button.
    • Select the Drafting → Facebinder option from the menu.
    • Use the keyboard shortcut: F then F.

Notes

  • A Draft Facebinder can be edited with the Draft Edit command. Faces can be added or removed.

Properties

Data

  • DataExtrusion: specifies an extrusion thickness to apply to all faces of the shape.
  • DataRemove Splitter: if it is true it tries to fuse the internal intersections of the Facebinder when it extruded.
  • DataSew: if it is true it tries to perform a topological sewing operation on the Facebinder when it extruded.
  • DataOffset: specifies an offset distance to apply betweenthe facebinder and the original faces, prior to extrusion.
  • DataArea: the total area of this facebinder.

View

  • ViewPattern: specifies a Draft Pattern with which to fill the face of the shape. This property only works if ViewDisplay Mode is "Flat Lines".
  • ViewPattern Size: specifies the size of the Draft Pattern.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To create a Draft Facebinder use the make_facebinder method of the Draft module:

facebinder = make_facebinder(selectionset)
  • Creates a facebinder object from the given selectionset, which is a list of SelectionObjects as returned by FreeCADGui.Selection.getSelectionEx(). Only selected faces are taken into account.
    • selectionset can also be a PropertyLinkSubList.

A PropertyLinkSubList is a list of tuples; each tuple contains as first element an object, and as second element a list (or tuple) of strings; these strings indicate the names of the sub-elements (faces) of that object.

PropertyLinkSubList = [tuple1, tuple2, tuple3, ...]
PropertyLinkSubList = [(object1, list1), (object2, list2), (object3, list3), ...]
PropertyLinkSubList = [(object1, ['Face1', 'Face4', 'Face6']), ...]
PropertyLinkSubList = [(object1, ('Face1', 'Face4', 'Face6')), ...]

The thickness of the Facebinder can be added by overwriting its Extrusion attribute; the value is entered in millimeters.

The placement of the Facebinder can be changed by overwriting its Placement attribute, or by individually overwriting its Placement.Base and Placement.Rotation attributes.

Example:

import FreeCAD as App
import FreeCADGui as Gui
import Draft

# Insert a solid box
box = App.ActiveDocument.addObject("Part::Box", "Box")
box.Length = 2300
box.Width = 800
box.Height = 1000

# selection = Gui.Selection.getSelectionEx()
selection = [(box, ("Face1", "Face6"))]
facebinder = Draft.make_facebinder(selection)
facebinder.Extrusion = 50

App.ActiveDocument.recompute()

facebinder.Placement.Base = App.Vector(1000, -1000, 100)
facebinder.ViewObject.ShapeColor = (0.99, 0.99, 0.4)

App.ActiveDocument.recompute()