Feature editing

Introduction
This page explains the way the PartDesign Workbench is intended to be used starting with FreeCAD 0.17.

While the Part Workbench and other workbenches construct models by combining shapes together (see Constructive solid geometry), the  PartDesign workbench uses. A feature is an operation that modifies the shape of a model.

Feature editing methodology
The first feature is commonly called the base feature. As more features are added to the model, each feature takes the shape of the previous one and adds or removes matter, creating linear dependencies from one feature to the next. In effect, this methodology mimics a common manufacturing process: a block is cut on one side, then on another side, holes are added, then rounds, etc.

All features are listed sequentially in the Model tree and can be edited at any time, with the last feature at the bottom representing the final part.

Features can be sorted into different categories:


 * Profile-based: these features start from a profile to define the shape of the matter to be added or removed. The profile can be a sketch, a planar face on existing geometry (a profile will be extracted from its edges), a ShapeBinder or a Draft object that has been included in the active Body.


 * Additive: adds matter to the existing model. Additive features show yellow icons.


 * Subtractive: removes matter from the existing model. Subtractive features show red and blue icons.


 * Primitive-based: based on geometric primitives (cube, cylinder, cone, torus…). They can be additive or subtractive.


 * Transformation features: they apply a transformation to existing features (mirrored, linear pattern, polar pattern, multitransform).


 * Dress-up: features that apply a treatment to edges or faces, such as fillets/rounds, chamfers and drafts.


 * Procedural: can be said of features that are not based on sketches, like the transformation and dress-up features.

Body
Working in PartDesign requires first creating a Body. The PartDesign Body is a container that groups a sequence of features forming a single contiguous solid.



What is a single contiguous solid? It is an object like a casting or something machined from a single block of metal. If the object involves nails, screws, glue or welding, it is not a single contiguous solid. As a practical example, a wooden chair would be made of multiple bodies, with one for each of its sub-components (legs, slats, seat, etc).

Multiple bodies can be created in a FreeCAD document; they can also be combined to form a single contiguous solid.

Only one body can be active in a document. The active body gets the new created features. A body can be activated or deactivated by double clicking on it. An activated body is highlighted in light blue. The highlighting color can be set in the preferences under Display/Colors/Active container since version 0.18.

When a model requires multiple bodies, like the previous wooden chair example, the general purpose Part container can be used to group them and move the whole as a unit.

Body visibility management
A body will present by default its most recent feature to the outside. This feature is defined by default as the tip. A good analogy is the expression the tip of the iceberg: only the tip is visible above the water, most of the iceberg's mass (the other features) is hidden. As a new feature is added to the body, visibility of the previous feature is turned off, and the new feature becomes the tip.

There can only be one feature visible at a time. It is possible to toggle the visibility of any feature in the body, by selecting it in the Model tree and pressing the, in effect going back in the history of the body.

Body Origin
The body has an Origin which consists of reference planes (XY, XZ, YZ) and axes (X, Y, Z) that can be used by sketches and features. Sketches can be attached to Origin planes, and they no longer need to be mapped to planar faces for features based on them to be added or subtracted from the model.

Moving and Reordering Objects
It is possible to temporarily redefine the tip to a feature in the middle of the Body tree to insert new objects (features, sketches or datum geometry). It is also possible to reorder features under a Body, or to move them to a different Body. Select the object and right-click to get a contextual menu that will offer both options. The operation may be prevented if the object has dependencies in the source Body, such as being attached to a face. To move a sketch to another Body, it should not contain links to external geometry.

Difference with other CAD systems
A fundamental difference between FreeCAD and other programs, like Catia, is that FreeCAD doesn't allow you to have many disconnected solids in the same PartDesign Body. That is, a new feature should always be built on top of the previous one. Or said in a different way, the newer feature should "touch" the previous feature, so that both features are fused together and become a single solid. You cannot have "floating" solids.



Datum geometry
Datum geometry consists of custom planes, lines, points or externally linked shapes. They can be created for use as reference by sketches and features. There is a multitude of attachment possibilities for datum objects.

In some CAD systems you can define a datum plane that is offset from the previous body and you can create a disconnected solid. So, placing a lot of datum planes, and building objects on them is okay and won't cause an error. Typically, you would eventually adjust the planes to their final positions, so that the individual objects are fused together.

In FreeCAD, as mentioned in the previous section, disconnected solids are NOT allowed, so a sketch on a datum plane that would create a non-contiguous will fail.

In FreeCAD, datum planes make sense if you are placing sketches (and padding, pocketing, etc.) in non-standard orientations, that is, in planes offset or rotated around the three main axes. Since sketches can also be placed in non-standard orientations in the same way as datum planes, often there is no need to use datum planes.

Datum planes also make sense if there will be more than one sketch in the same non-standard orientation. In this case a datum plane can be used and the orientation only needs to be adjusted for the datum plane to adjust all associated sketches and the features created from the sketches.

Both sketches and datum planes should be attached to base planes. Referencing generated geometry (geometry that is the result of a feature creating operation, for example a pad or pocket) should be avoided. (See Advice for creating stable models below).

Even if not used for supporting sketches, datum objects are still helpful as visual indicators, to draw attention to important features or distances in the modelling process. (Though, simply adding geometry to a sketch also provides similar visual feedback.)



Cross-referencing
It is possible to cross-reference elements from a body in another body via datums. For example the datum shape binder allows to copy over faces from a body as reference in another one. This should make it easy to build a box with fitting cover in two different bodies. FreeCAD helps you to not accidentally link to other bodies and queries your intent.

Attachment
Object attachment is not a specific PartDesign tool, but rather a Part utility introduced in v0.17 that can be found in the Part menu. It is heavily used in the PartDesign workbench to attach sketches and reference geometry to the standard planes and axes of the Body. Very extensive ways of creating datum points, lines and planes are available. Optional attachment offset parameters make this tool very versatile.

More info can be found in the Attachment page and the Basic Attachment Tutorial.

Advice for creating stable models
The idea of parametric modeling implies that you can change the values of certain parameters and subsequent steps are changed according to the new values. However, when severe changes are made, the model can break due to the topological naming problem that is still unresolved in FreeCAD. Breakage can be minimized when you respect the following design principles:


 * Avoid attaching sketches and datums to generated geometry of the model. (Generated geometry is any face or edge created as a result of a pad, pocket, etc..)
 * Place your sketches on standard planes, or on custom datum planes.
 * Sketches with attachment offests or attached to datum planes with attachment offsets, are less at risk of being unexpectedly reattached to a different reference.
 * When creating datum geometry, do not attach it to generated geometry
 * Attach it to standard planes/axes and/or sketches and use attachment offsets to position it as needed
 * Use a "master sketch".
 * A master sketch should be as simple as possible, containing basic geometric elements of your model.
 * Master sketch elements can be referenced when modelling subsequent features.
 * A master sketch can be the first sketch in the Body, or outside the body completely
 * A master sketch can be referenced as external geometry or via a ShapeBinder.
 * Don't create ShapeBinders from generated geometry
 * Keep in mind that ShapeBinders can be an issue when geometry is deleted from the sketch it is based on.
 * If you inevitably have to reference an intermediate feature, e.g. the result of a thickness operation
 * Use the first reference possible in the list of subsequent features where the referenced geometric element occurs.
 * From FreeCAD 0.17 on you don't have to use the latest feature.
 * If you take an early feature as reference, all changes to intermediate steps won't break your model.
 * Try to reference a sketch or sketch geometry rather than generated geometry.
 * Use dress ups, like fillets and chamfers, as late in the feature tree as possible
 * Note, using spreadsheets, dynamic data, master sketches, etc. generally produce more parametric models and help avoid the topological naming issue.

Body building workflow
There are several workflows that are possible with the PartDesign Workbench. What should always be noticed is that all the features created inside a PartDesign Body will be fused together to obtain the final object.

Different sketches
Sketches need to be supported by a plane. This plane can be one of the main planes (XY, XZ, or YZ) defined by the Origin of the Body. A sketch is either extruded into a positive solid (additive), with a tool like PartDesign Pad, or into a negative solid (subtractive), with a tool like  PartDesign Pocket. The first adds volume to the final shape of the body, while the latter cuts volume from the final shape. Any number of sketches and partial solids can be created in this way; the final shape (tip) is the result of fusing these operations together. Naturally, the Body can't consist of only subtractive operations, as the final shape should be a positive solid with a non-zero volume.



Sequential features
Sketches can be supported by the faces of previous solid operations. This may be necessary if you need to access a face that is only available after a certain feature has been created. However, this workflow isn't recommended as if the original feature is modified, the following features in the sequence may break. This is the topological naming problem.



Use of datum planes for support
Datum planes are useful to support the sketches. These auxiliary planes can be based on the Origin of the Body, or can be based on the features (edges, faces) of previously created solids. In addition, a PartDesign ShapeBinder can be used to import external geometry into the body to serve as reference; then sketches can be attached to this auxiliary body, either using datum planes or not. Using datum objects is often the best way to produce stable models, although it requires a bit more work from the user.

Tutorials
The tutorials page provides some examples of using the feature editing method of the PartDesign Workbench.
 * Creating a simple part with PartDesign
 * Basic Part Design Tutorial
 * Basic Attachment Tutorial

Related

 * Constructive solid geometry