PartDesign Body: Difference between revisions

From FreeCAD Documentation
(the task panel will open to allow selecting one of the planes.)
(Button template for better presentation of the mentioned commands)
(64 intermediate revisions by 5 users not shown)
Line 8: Line 8:
|IconL=Group.svg
|IconL=Group.svg
|IconC=Workbench_PartDesign.svg
|IconC=Workbench_PartDesign.svg
|IconR=PartDesign_NewSketch.png
|IconR=PartDesign_NewSketch.svg
}}
}}


Line 23: Line 23:


<!--T:3-->
<!--T:3-->
A [[PartDesign Body|PartDesign Body]] is the base element to create solids shapes with the [[PartDesign Workbench|PartDesign Workbench]]. It can contain [[Sketch|sketches]], datums objects, and PartDesign [[Glossary#Feature|features]] in order to produce a [[PartDesign_Body#Single_contiguous_solid|single contiguous solid]].
A [[PartDesign Body|PartDesign Body]] is the base element to create solids shapes with the [[PartDesign Workbench|PartDesign Workbench]]. It can contain [[Sketch|sketches]], [[Datum|datum objects]], and [[PartDesign Feature|PartDesign Features]] that help in building a [[PartDesign_Body#Single_contiguous_solid|single contiguous solid]].


<!--T:28-->
<!--T:28-->
The Body provides an {{MenuCommand|Origin}} object which includes local X, Y, and Z axes, and planes. These elements can be used as references to attach [[Sketch|sketches]] and primitive objects.
The Body provides an {{MenuCommand|Origin}} object which includes local X, Y, and Z axes, and standard planes. These elements can be used as references to attach [[Sketch|sketches]] and [[PartDesign_CompPrimitiveAdditive|primitive objects]].


<!--T:29-->
<!--T:29-->
Since the Body is supposed to be a [[PartDesign_Body#Single_contiguous_solid|single contiguous solid]], it can be moved entirely as a unit, without moving the individual features. Multiple bodies can be placed inside [[Std_Part|Std Parts]] in order to create assemblies.
Do not confuse the [[File:PartDesign_Body.svg|24px]] [[PartDesign_Body|PartDesign Body]] with the [[File:Std_Part.svg|24px]] [[Std_Part|Std Part]]. The first one is a specific object used in the [[File:Workbench_PartDesign.svg|24px]] [[PartDesign_Workbench|PartDesign Workbench]], intended to model a [[PartDesign_Body#Single_contiguous_solid|single contiguous solid]] by means of [[PartDesign_Feature|PartDesign Features]]. The [[Std_Part|Std Part]] is a grouping object intended to create [[assembly|assemblies]]; it is not used for modelling, just to arrange different objects in space. Multiple bodies, and other [[Std_Part|Std Parts]], can be placed inside a single [[Std_Part|Std Part]] to create a complex assembly.


</translate>
</translate>
Line 37: Line 37:
{{Caption|Left: the tree view showing the features that sequentially produce the final shape of the object. Right: the final object visible in the [[3D view|3D view]].}}
{{Caption|Left: the tree view showing the features that sequentially produce the final shape of the object. Right: the final object visible in the [[3D view|3D view]].}}


==How to use== <!--T:13-->
==Usage== <!--T:13-->


<!--T:25-->
<!--T:25-->
If no previous solid is selected:
If no previous solid is selected:
# Press the {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}} button. An empty Body is created and automatically becomes active.
# Press the {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}} button. An empty Body is created and automatically becomes {{Emphasis|[[PartDesign_Body#Active_status|active]]}}.
# Now you can press {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|New sketch]]}} to create a sketch in the Body that can be used with {{Button|[[File:PartDesign_Pad.svg|16px]] [[PartDesign_Pad|Pad]]}}.
# Now you can press {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|New sketch]]}} to create a [[Sketch|sketch]] in the Body that can be used with {{Button|[[File:PartDesign_Pad.svg|16px]] [[PartDesign_Pad|Pad]]}}.
# Alternatively, add a primitive solid feature, for example, {{Button|[[File:PartDesign_AdditiveBox.svg|16px]] [[PartDesign_AdditiveBox|Additive box]]}}.
# Alternatively, add a primitive [[PartDesign Feature|PartDesign Feature]], for example, {{Button|[[File:PartDesign_AdditiveBox.svg|16px]] [[PartDesign_AdditiveBox|Additive box]]}}.


<!--T:42-->
<!--T:42-->
If a solid object is selected:
If a solid object is selected:
# Press the {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}} button. A new body is created containing a single {{MenuCommand|BaseFeature}}. This BaseFeature element is a simple reference to another object previously created or imported into the document. The BaseFeature can also be created by dragging that solid into an empty Body. This is done when we have a pre-existing solid (for example, created with the [[Part Workbench|Part Workbench]] or imported from a Step file) that we want to modify further with PartDesign tools.
# Press the {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}} button. A new Body is created containing a single {{MenuCommand|Base Feature}}. This Base Feature element is a simple reference to another object previously created or imported into the document. See [[PartDesign_Body#Base_Feature|Base Feature]] for more information. An existing Body or [[PartDesign_Feature|PartDesign Feature]] cannot be selected when pressing {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}}.


===Notes=== <!--T:26-->
===Notes=== <!--T:26-->


<!--T:43-->
<!--T:43-->
* An existing Body cannot be selected when pressing {{Button|[[Image:PartDesign_Body.svg|16px]] [[PartDesign Body|Body]]}} button. However, an existing Body can be used as the BaseFeature by adding that object to the {{PropertyData|Base Feature}} property.
* If no Body currently exists when {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|New sketch]]}} is pressed, a new Body will be automatically created. If a Body already exists, it has to be made active before using {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|New sketch]]}}.
* Double-click the Body in the [[tree view|tree view]] or open the context menu (right-click) and select {{MenuCommand|Toggle active body}} to activate or deactivate the Body. If another Body is active, it will be deactivated. See [[PartDesign_Body#Active_status|active status]] for more information.
* If no Body currently exists, when {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|New sketch]]}} is pressed on the PartDesign toolbar, a new Body will be automatically created.
* Double-click the Body in the [[tree view|tree view]] or open the context menu (right-click) and select {{MenuCommand|Toggle active body}} to activate or deactivate the Body. If another Body is active, it will be deactivated.


==Properties== <!--T:15-->
==Properties== <!--T:15-->
Line 70: Line 69:


<!--T:35-->
<!--T:35-->
* {{PropertyData|Tip}}: the feature defined as "Tip". The Tip is usually the last feature created in the Body, although any of the previous features can also be set as the Tip. This indicates which is the final shape of the Body, which is displayed when {{PropertyView|Display Mode Body}} is set to {{incode|Tip}}.
* {{PropertyData|Tip|Link}}: the [[PartDesign Feature|PartDesign Feature]] defined as "Tip", which is usually the last feature created in the Body. The Tip indicates the final shape of the Body, which is shown in the [[3D view|3D view]] when {{PropertyView|Display Mode Body}} is set to {{incode|Tip}}. See [[PartDesign_Body#Tip|Tip]] for more information.
* {{PropertyData|Base Feature}}: an external shape used as the first feature in the Body. It is usually set when dragging a solid object into an empty Body. If the first feature is created from a {{Button|[[File:PartDesign_NewSketch.svg|16px]] [[PartDesign_NewSketch|Sketch]]}} and a {{Button|[[File:PartDesign_Pad.svg|16px]] [[PartDesign Pad|Pad]]}}, or from a primitive solid, for example, an {{Button|[[File:PartDesign_AdditiveBox.svg|16px]] [[PartDesign_AdditiveBox|Additive box]]}}, then the BaseFeature is empty.
* {{PropertyData|Base Feature|Link}}: an external shape used as the first [[PartDesign Feature|PartDesign Feature]] in the Body. It is usually set when dragging a solid object into an empty Body. If no solid is imported in this way, this property will be empty. See [[PartDesign_Body#Base_Feature|Base Feature]] for more information.
* {{PropertyData|Placement|Placement}}: the position of the object in the [[3D view|3D view]]. The placement is defined by a {{incode|Base}} point (vector), and a {{incode|Rotation}} (axis and angle). See [[Placement|Placement]].
* {{PropertyData|Group}}: a list with the feature objects inside the Body.
* {{PropertyData|Group|LinkList}}: a list with the [[PartDesign Feature|PartDesign Features]] in the Body.
* {{PropertyData|Placement}}: the position of the object in the [[3D view|3D view]]. The placement is defined by a {{incode|Base}} point (vector), and a {{incode|Rotation}} (axis and angle). See [[Placement|Placement]].

==== Hidden properties Data ==== <!--T:94-->

<!--T:95-->
* {{PropertyData|Origin|Link}}: the [[App_Origin|App Origin]] object that is the positional reference for all elements listed in {{PropertyData|Group}}.
* {{PropertyData|_ Group Touched|Bool}}: whether the group is touched or not.

<!--T:96-->
Also the hidden properties described in [[Part Feature|Part Feature]].


=== View === <!--T:36-->
=== View === <!--T:36-->
Line 81: Line 89:


<!--T:49-->
<!--T:49-->
* {{PropertyView|Display Mode Body}}: sets the display mode specifically for the Body with one of two types.
* {{PropertyView|Display Mode Body|Enumeration}}: sets the display mode specifically for the Body with one of two types.
** {{incode|Through}} (default) exposes all objects inside the Body, that is, sketches, features, datum objects, etc. This mode allows visualizing partial operations done inside the Body, and thus it is the recommended mode when adding and editing features. Select the specific feature, and the set {{PropertyView|Visibility}} to {{TRUE}} or press {{KEY|Space}} on the keyboard.
** {{incode|Through}} (default) exposes all objects inside the Body, that is, [[Sketch|sketches]], [[PartDesign Feature|PartDesign Features]], datum objects, etc. This mode allows visualizing partial operations done inside the Body, and thus it is the recommended mode when adding and editing features. Select the specific feature, and the set {{PropertyView|Visibility}} to {{TRUE}} or press the {{KEY|Space}} bar on the keyboard.
** {{incode|Tip}} exposes only the final shape of the Body, which is defined by the {{PropertyData|Tip}} property. Everything else, including sketches, partial features, datums, etc., is not displayed, even if they are visible in the [[tree view|tree view]]. This mode is recommended when the Body does not need to be modified further, so a fixed shape is shown. This mode is also recommended when you wish to select the sub-elements (vertices, edges, and faces) of the final shape to use with other workbenches' tools.
** {{incode|Tip}} exposes only the final shape of the Body, which is defined by the {{PropertyData|Tip}} property. Everything else, including [[Sketch|sketches]], [[PartDesign Feature|partial features]], datums, etc., is not displayed, even if they are visible in the [[tree view|tree view]]. This mode is recommended when the Body does not need to be modified further, so a fixed shape is shown. This mode is also recommended when you wish to select the sub-elements (vertices, edges, and faces) of the final shape to use with other workbenches' tools.


== Full description == <!--T:37-->
== Body concept == <!--T:37-->


=== Single contiguous solid === <!--T:50-->
=== Single contiguous solid === <!--T:50-->


<!--T:51-->
<!--T:51-->
A PartDesign Body is intended to model a single contiguous solid. The meaning of "contiguous" is an element made in one piece, with no moving parts, or disconnected solids. Examples of contiguous solids are those that are manufactured from a single piece of raw material by a process of casting, cutting, or milling. For example, a nut, a washer, and a bolt each consists of a single solid piece of metal with no moving parts, so each can be modelled by a PartDesign Body. Objects that are created by welding two pieces can also be modelled by a single Body as long as the weld joint is solid and not intended to break apart.
A PartDesign Body is intended to model a single contiguous solid. The meaning of "contiguous" is an element made in one piece, with no moving parts, or disconnected solids. Examples of contiguous solids are those that are manufactured from a single piece of raw material by a process of casting, cutting, or milling. For example, a nut, a washer, and a bolt each consists of a single solid piece of steel with no moving parts, so each can be modelled by a PartDesign Body. Objects that are created by welding two pieces can also be modelled by a single Body as long as the weld joint is not intended to break apart.


<!--T:52-->
<!--T:52-->
Once these contiguous solids are put together in some type of arrangement, then they become an "assembly". In an assembly, the objects are not fused together, they are "stacked" or placed next to each other but remain separate solids.
Once these contiguous solids are put together in some type of arrangement, then they become an "assembly". In an assembly, the objects are not fused together, but they are simply "stacked" or placed next to each other, and remain individual parts.


</translate>
</translate>
Line 104: Line 112:


<!--T:55-->
<!--T:55-->
A PartDesign Body is intended to work by creating an initial solid, either from a Sketch or from a primitive shape, and then modifying it through "features" that add or remove material from the previous shape. For a full explanation go to [[feature editing|feature editing]].
A PartDesign Body is intended to work by creating an initial solid, either from a [[Sketch|sketch]] or from a [[PartDesign_CompPrimitiveAdditive|primitive shape]], and then modifying it through [[PartDesign Feature|"features"]] to add or remove material from the previous shape. For a full explanation go to [[feature editing|feature editing]].


<!--T:56-->
<!--T:56-->
A PartDesign Body will perform an automatic fusion of the solid elements inside of it. This means that the partial solids should be touching, and disconnected solids are not allowed.
A PartDesign Body will perform an automatic [[Part_Union|fusion]] (union) of the solid elements inside of it. This means that (1) partial solids should be touching when created, and (2) disconnected solids are not allowed.


</translate>
</translate>
Line 113: Line 121:
<translate>
<translate>
<!--T:57-->
<!--T:57-->
{{Caption|Left: two individual solids that intersect each other. Right: a single PartDesign Body with two additive features; they are automatically fused together, so instead of intersecting, they form a single contiguous solid.}}
{{Caption|Left: two individual solids that intersect each other. Right: a single PartDesign Body with two [[PartDesign Feature|additive features]]; they are automatically fused together, so instead of intersecting, they form a single contiguous solid.}}


</translate>
</translate>
Line 119: Line 127:
<translate>
<translate>
<!--T:58-->
<!--T:58-->
{{Caption|Left: two disconnected solids; this isn't a valid PartDesign Body. Right: two touching solids; this results in a valid PartDesign Body. The newer feature should always contact or intersect the previous feature so that it is fused to it, and becomes a single contiguous solid.}}
{{Caption|Left: two disconnected solids; this isn't a valid PartDesign Body. Right: two touching solids; this results in a valid PartDesign Body. The newer [[PartDesign Feature|feature]] should always contact or intersect the previous feature so that it is fused to it, and becomes a single contiguous solid.}}

<!--T:93-->
{{Emphasis|Note:}} other CAD programs like Catia allow discontiguous solids in the same "Body". As of v0.19, FreeCAD does not allow this. There has been discussions in the [https://forum.freecadweb.org/index.php FreeCAD forum] about lifting this restriction but no concrete decision has been made. If you'd like to know more or present different points of view, please discuss in the [https://forum.freecadweb.org/index.php forum].

== Detailed explanation of the properties == <!--T:80-->


===Active status=== <!--T:6-->
===Active status=== <!--T:6-->
Line 130: Line 143:
* Double click on it on the [[tree view|tree view]], or
* Double click on it on the [[tree view|tree view]], or
* Open the context menu (right click) and select {{MenuCommand|Toggle active body}}.
* Open the context menu (right click) and select {{MenuCommand|Toggle active body}}.

</translate>
[[File:PartDesign_Body_active.png]]
<translate>


<!--T:7-->
<!--T:7-->
Activating a Body automatically switches to the [[PartDesign Workbench|PartDesign Workbench]]. Only a single Body can be active at a time.
Activating a Body automatically switches to the [[PartDesign Workbench|PartDesign Workbench]]. Only a single Body can be active at a time.


<!--T:45-->
The active Body can be defined from the [[Python console|Python console]] by using the {{incode|setActiveObject}} method of the {{incode|ActiveView}}. The first argument is the fixed string {{incode|"pdbody"}}, and the second argument is the Body object itself.
</translate>
</translate>
[[File:PartDesign_Body_active.png]]
{{Code|code=
<translate>
import FreeCAD as App
import FreeCADGui as Gui
App.newDocument()
obj = App.ActiveDocument.addObject("PartDesign::Body", "Body")


<!--T:81-->
Gui.ActiveDocument.ActiveView.setActiveObject("pdbody", obj)
{{Caption|Document with two PartDesign Bodies, of which the second one is active.}}
}}
<translate>


===Origin=== <!--T:8-->
===Origin=== <!--T:8-->
Line 156: Line 159:
The Origin consists of the three standard axes (X, Y, Z) and three standard planes (XY, XZ and YZ). [[Sketch|Sketches]] and other objects can be attached to these elements when creating them.
The Origin consists of the three standard axes (X, Y, Z) and three standard planes (XY, XZ and YZ). [[Sketch|Sketches]] and other objects can be attached to these elements when creating them.
# Create the Body.
# Create the Body.
# If the Body is selected in the [[tree view|tree view]], when {{Button|[[File:PartDesign NewSketch.svg|16px]] [[PartDesign NewSketch|New sketch]]}} is pressed, the [[task panel|task panel]] will open to allow selecting one of the planes.
# If the Body is selected in the [[tree view|tree view]], press {{Button|[[File:PartDesign NewSketch.svg|16px]] [[PartDesign NewSketch|New sketch]]}}; the [[task panel|task panel]] will open to allow selecting one of the planes.
# If the Body is not selected, select the Origin instead and make it visible in the [[3D view|3D view]] by pressing {{KEY|Space}} in the keyboard. Also expand the Origin object to see the axes and planes.
# If the Body is not selected, select the Origin instead and make it visible in the [[3D view|3D view]] by pressing the {{KEY|Space}} bar in the keyboard. Also expand the Origin object to see the axes and planes.
# Select one of the planes, either in the [[tree view|tree view]] or in the [[3D view|3D view]], then press {{Button|[[File:PartDesign NewSketch.svg|16px]] [[PartDesign NewSketch|New sketch]]}}. The sketch will be created on the chosen plane.
# Select one of the planes, either in the [[tree view|tree view]] or in the [[3D view|3D view]], then press {{Button|[[File:PartDesign NewSketch.svg|16px]] [[PartDesign NewSketch|New sketch]]}}. The sketch will be created on the chosen plane.


<!--T:64-->
The same process can be used when creating auxiliary datum geometry like [[PartDesign Line|lines]], [[PartDesign Plane|planes]], and [[PartDesign_CoordinateSystem|coordinate systems]].
The same process can be used when creating auxiliary datum geometry like [[PartDesign Line|PartDesign Lines]], [[PartDesign Plane|PartDesign Planes]], and [[PartDesign_CoordinateSystem|PartDesign CoordinateSystems]].


<!--T:67-->
All elements inside the Body are referenced to the Body's Origin which means that the Body can be moved and rotated in reference to the global coordinate system without affecting the placement of elements inside.
{{Emphasis|Note:}} the Origin is an [[App_Origin|App Origin]] object ({{incode|App::Origin}} class), while the axes and planes are objects of type {{incode|App::Line}} and {{incode|App::Plane}} respectively. Each of these elements can be hidden and unhidden individually with the {{KEY|Space}} bar; this is useful to choose the correct reference when creating other objects.

<!--T:65-->
{{Emphasis|Note 2:}} all elements inside the Body are referenced to the Body's Origin which means that the Body can be moved and rotated in reference to the global coordinate system without affecting the placement of the elements inside.


</translate>
</translate>
[[File:PartDesign_Body_tree-02.png]] [[File:PartDesign_Body_Origin_view.png|x400px]]
[[File:PartDesign_Body_Origin_tree.png]] [[File:PartDesign_Body_Origin_view.png|x400px]]
<translate>
<translate>


<!--T:66-->
{{Caption|PartDesign Origin in the [[tree view|tree view]], and as it appears displayed on the [[3D view|3D view]].}}
{{Caption|Left: PartDesign Body Origin in the [[tree view|tree view]]. Right: representation of the Origin elements in the [[3D view|3D view]].}}


=== Base Feature === <!--T:9-->
The Origin is an object of class {{incode|App::Origin}}, while the axes and planes are objects of type {{incode|App::Line}} and {{incode|App::Plane}} respectively.

===Base Feature=== <!--T:9-->


<!--T:60-->
<!--T:60-->
The base feature is by definition the first PartDesign feature created in the Body. But it is possible to use a solid shape, either imported or modelled in other workbenches, as a base feature to which sketches and other features can be added.
The Base Feature is the first [[PartDesign Feature|PartDesign Feature]] in the Body when the Body is based on another solid shape. This solid can be created by any workbench, or imported from an external file, for example, a STEP file.


</translate>
</translate>[[File:PartDesign_Body_tree-03.png|none]]<translate>
[[File:PartDesign_Body_BaseFeature_tree.png]]
<translate>
<!--T:82-->
{{Caption|PartDesign Bodies, each of them with a single Base Feature, which are taken from previously created solids.}}

<!--T:68-->
To create the Base Feature:
# select a solid shape external to any Body, and
# press {{Button|[[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|Body]]}}; this will create a new Body with a single Base Feature.

<!--T:69-->
{{Emphasis|Note:}} you can't select an existing Body, or any of its [[PartDesign Feature|features]], when pressing {{Button|[[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|Body]]}}.

<!--T:70-->
If you already have a Body, you can create the Base Feature in this way:
* in the [[tree view|tree view]], pick an object, and drag and drop it inside the Body, or
* in the [[property editor|property editor]], edit the value of {{PropertyData|Base Feature}} by pressing the ellipsis {{KEY|...}}, and choosing an object from the list. In this case you can choose an existing Body to be the Base Feature.

<!--T:71-->
{{Emphasis|Note:}} dragging and dropping only works for Bodies which don't have a Base Feature already.

<!--T:72-->
{{Emphasis|Note 2:}} if the Body already has several features, when you drag and drop the external solid, the Base Feature will be created at the beginning of the list of features, that is, it will be added to the beginning of the {{PropertyData|Group}} property.

<!--T:73-->
The Base Feature is entirely optional; it is only present when including an object from outside the Body. If no external solid is included, you can still build your shape using [[Sketch|sketches]], [[PartDesign Pad|pads]], [[PartDesign_CompPrimitiveAdditive|primitive objects]], and other [[PartDesign Feature|PartDesign Features]]. In this case the {{PropertyData|Base Feature}} property remains empty.

<!--T:74-->
[[File:PartDesign_Body_BaseFeature_Tip.svg]]

<!--T:75-->
{{Caption|Left: PartDesign Body with a Base Feature that is taken from an external solid object, and many subsequent [[PartDesign Feature|PartDesign Features]] on top. Right: Body which doesn't have an explicit Base Feature.}}


===Tip=== <!--T:10-->
===Tip=== <!--T:10-->


<!--T:61-->
<!--T:61-->
The Tip is the [[PartDesign Feature|PartDesign Feature]] that is exposed outside the Body; that is, if another tool from any workbench (for example, {{Button|[[File:Part_SimpleCopy.svg|16px]] [[Part_SimpleCopy|Part SimpleCopy]]}} or {{Button|[[File:Part_Cut.svg|16px]] [[Part_Cut|Part Cut]]}}) needs to use the shape of the Body, it will use the shape of the Tip. Said in another way, the Tip is the final representation of the Body as if the parametric history didn't exist.
The tip is the feature that is exposed outside the Body. It is automatically set to the last feature at the bottom of the tree. But sometimes it can be useful to change it to an earlier feature in the Body tree, which in effect rolls back its history; then it is possible to add features that should have been added earlier. In the Body tree, the feature set to tip displays a green dot with a white down arrow in it.


<!--T:76-->
</translate>[[File:PartDesign_Body_tree-04.png|none]]<translate>
[[File:PartDesign_Body_Tip_final.svg]]


<!--T:11-->
<!--T:77-->
{{Caption|Left: PartDesign Body with full parametric history including intermediate features. Right: the Tip is the final shape that can be exported from the Body, while omitting the model's history.}}
For more details, see the [[File:PartDesign_MoveTip.png|24px]] [[PartDesign MoveTip|Move Tip]] page.


===Visibility Management=== <!--T:12-->
<!--T:78-->
The Tip is automatically set to the last feature created in the Body. Nevertheless, it can also be set to any of the intermediate features by opening the [[tree view|tree view]] context menu (right-click) and choosing {{MenuCommand|[[File:PartDesign_MoveTip.svg|16px]] [[PartDesign_MoveTip|Set tip]]}}, or by changing the Body's {{PropertyData|Tip}} value in the [[property editor|property editor]].


<!--T:62-->
<!--T:79-->
Changing the Tip in effect rolls back its history, making it possible to add features that should have been added earlier. It also exposes a different shape to external tools.
The Body's visibility supersedes the visibility of any object it contains. If the Body is hidden, the objects it contains will be hidden as well, even if their visibility is set to true. Only one feature can be visible at a time. Selecting a hidden feature and pressing the {{KEY|space bar}} will make it visible, and automatically hide the previously visible feature.

<!--T:11-->
In the [[tree_view|tree view]], the Tip of the Body is recognized by the [[PartDesign_Feature|PartDesign Feature]] that has an icon overlay consisting of a white arrow inside a green circle.

</translate>
[[File:PartDesign_Body_Tip_tree.png]]
<translate>
<!--T:83-->
{{Caption|Two PartDesign Bodies, each of them with [[PartDesign Feature|PartDesign Features]]. The Tip is the last feature in them, and is marked with an overlay symbol.}}


===Interaction with other workbenches === <!--T:17-->
===Interaction with other workbenches === <!--T:17-->


<!--T:63-->
<!--T:63-->
By default, objects underneath a Body are selectable, and this is of course required to edit and add features in PartDesign. But selecting a Body's features to create operations from other workbenches (like [[Part Module|Part]] or [[Draft Module|Draft]]) is not advised, as the results may be unexpected; in all cases, an error labelled ''Links go out of the allowed scope'' will appear in the Report view.
By default, [[PartDesign Feature|PartDesign Features]] inside a Body are selectable, as this is required to edit and add more features with the [[PartDesign Workbench|PartDesign Workbench]] tools. Nevertheless, selecting the individual features to use them with tools from other workbenches, like [[Part Module|Part]] and [[Draft Module|Draft]], is not advised, as the results may be unexpected; if this is done, in the [[Report view|report view]] an error message may appear, {{Emphasis|Links go out of the allowed scope}}.


<!--T:18-->
<!--T:18-->
Therefore, for interactions with other workbenches, only the Body itself should be selected from the Model tree. In cases where it is necessary to select specific topology on the Body (vertex, edge, face), then the Body's '''Display Mode Body''' view property can be switched from ''Through'' (default) to ''Tip''. This property is accessible from the View panel. In ''Tip'' mode, access to the objects under the Body (features, datums, sketches) is disabled; everything but the tip feature will be hidden in the 3D view, no matter which object is set as visible.
Therefore, for interactions with other workbenches, only the Body itself should be selected in the [[tree view|tree view]]. In cases where it is necessary to select specific sub-elements of the Body (vertices, edges, and faces), the Body's {{PropertyView|Display Mode Body}} property should be switched to {{incode|Tip}}. When this mode is enabled, access to objects under the Body ([[PartDesign Feature|features]], datums, [[Sketch|sketches]]) is disabled, and everything but the Body's [[PartDesign_Body#Tip|Tip]] will be hidden in the [[3D view|3D view]].


<!--T:19-->
<!--T:19-->
Once operations in other workbenches are completed, do not forget to reset the '''Display Mode Body''' property to ''Through'' to be able to edit the Body.
Once the sub-elements have been used with other workbenches, {{PropertyView|Display Mode Body}} can be set back to {{incode|Through}}.

<!--T:84-->
[[File:PartDesign_Body_Tip_Display_mode.svg]]

<!--T:85-->
{{Caption|Left: when "Display Mode Body" is set to {{incode|Through}} it is possible to select and perform operations with the individual [[PartDesign Feature|PartDesign Features]]; in general, this is not recommended. Right: when "Display Mode Body" is set to {{incode|Tip}} all selections and operations done on the Body will be done on the Tip, making sure only the final shape of the Body is exposed.}}

===Visibility management=== <!--T:12-->

<!--T:62-->
The Body's visibility supersedes the visibility of any object it contains. If the Body is hidden, the objects it contains will be hidden as well, even if their individual {{PropertyView|Visibility}} property is set to {{TRUE}}.

<!--T:86-->
Multiple [[Sketch|Sketches]] may be visible at one time, but only one [[PartDesign Feature|PartDesign Feature]] (solid result) can be visible at a time. Selecting a hidden feature and pressing the {{KEY|Space}} bar in the keyboard will make it visible, and automatically hide the previously visible feature.

<!--T:87-->
[[File:PartDesign_Body_Visibility.png]]
{{Caption|PartDesign Body: multiple [[Sketch|Sketches]] may be visible simultaneously, but only one solid [[PartDesign Feature|PartDesign Feature]] may be visible at one time, whether it is the Tip or not.}}

=== Attachment === <!--T:88-->

<!--T:89-->
[[PartDesign Feature|PartDesign Features]], just like [[Part_Part2DObject|planar objects]], can be attached to different planes, usually the standard planes defined by the Body's [[PartDesign_Body#Origin|Origin]], or to custom [[PartDesign Plane|PartDesign Planes]].

<!--T:90-->
[[Sketch|Sketches]] are normally attached to a plane when they are created. In similar way, [[PartDesign_CompPrimitiveAdditive|primitive features]] can also be attached. Attaching these objects to a plane allows them to be moved within the Body by changing their {{PropertyData|Attachment Offset}} property. For more information on the attachment modes see [[Part_Attachment|Part Attachment]].

<!--T:91-->
A [[PartDesign Feature|PartDesign Feature]] that is not attached will be shown with a red overlay symbol next to their icon in the [[tree view|tree view]].

<!--T:92-->
[[File:PartDesign_Body_Feature_attachment.png]]
{{Caption|PartDesign Body: [[PartDesign Feature|PartDesign Features]] that are not attached to a plane or coordinate system will be shown with an overlay symbol next to their icon in the [[tree view|tree view]].}}


=== Inheritance === <!--T:46-->
=== Inheritance === <!--T:46-->

<!--T:97-->
A [[PartDesign_Body|PartDesign Body]] is formally an instance of the class {{incode|PartDesign::Body}}, whose parent is [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class) through the intermediate {{incode|Part::BodyBase}} class, and is augmented with an Origin extension.


<!--T:47-->
<!--T:47-->
Line 211: Line 297:


<!--T:48-->
<!--T:48-->
{{Caption|Simplified diagram of the relationships between the core objects in the program. The {{incode|PartDesign::Body}} object is intended to build parametric 3D solids, and thus is derived from the basic {{incode|Part::Feature}} object.}}
{{Caption|Simplified diagram of the relationships between the core objects in the program. The {{incode|PartDesign::Body}} object is intended to build parametric 3D solids, and thus is derived from the basic {{incode|Part::Feature}} object, and has an Origin to control the placement of the features used inside of it.}}


== Scripting == <!--T:38-->
== Scripting == <!--T:38-->
Line 219: Line 305:


<!--T:40-->
<!--T:40-->
See [[Part_Feature|Part Feature]] for the general information.
See [[Part_Feature|Part Feature]] for the general information on adding objects to the document


<!--T:41-->
<!--T:41-->
A PartDesign Body is created with the {{incode|addObject()}} method of the document. Once a body exists, features, like additive and subtractive primitives, can be added and attached to that body.
A PartDesign Body is created with the {{incode|addObject()}} method of the document. Once a Body exists, [[PartDesign Feature|PartDesign Features]] can be added to it with the {{incode|addObject()}} or {{incode|addObjects()}} methods of this Body.


</translate>
</translate>
Line 229: Line 315:


doc = App.newDocument()
doc = App.newDocument()
obj = App.ActiveDocument.addObject('PartDesign::Body', 'Body')
obj = App.ActiveDocument.addObject("PartDesign::Body", "Body")
obj.Label = "Custom label"
obj.Label = "Custom label"


feature = App.ActiveDocument.addObject('PartDesign::AdditiveBox', 'Box')
feat1 = App.ActiveDocument.addObject("PartDesign::AdditiveBox", "Box")
feat2 = App.ActiveDocument.addObject("PartDesign::AdditiveCylinder", "Cylinder")
obj.addObject(feature)

obj.addObjects([feat1, feat2])
App.ActiveDocument.recompute()
}}
<translate>

<!--T:45-->
In a document that has many Bodies, the [[PartDesign_Body#Active_status|active Body]] can be set using the {{incode|setActiveObject}} method of the {{incode|ActiveView}}. The first argument is the fixed string {{incode|"pdbody"}}, and the second argument is the Body object that should be made active.
</translate>
{{Code|code=
import FreeCAD as App
import FreeCADGui as Gui

doc = App.newDocument()
obj1 = App.ActiveDocument.addObject("PartDesign::Body", "Body")
obj2 = App.ActiveDocument.addObject("PartDesign::Body", "Body")

Gui.ActiveDocument.ActiveView.setActiveObject("pdbody", obj1)
App.ActiveDocument.recompute()
App.ActiveDocument.recompute()
}}
}}
Line 245: Line 349:
|IconL=Group.svg
|IconL=Group.svg
|IconC=Workbench_PartDesign.svg
|IconC=Workbench_PartDesign.svg
|IconR=PartDesign_NewSketch.png
|IconR=PartDesign_NewSketch.svg
}}
}}

<!--T:23-->
{{PartDesign Tools navi}}

<!--T:24-->
{{Userdocnavi}}


</translate>
</translate>

{{PartDesign Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Revision as of 18:43, 11 October 2020

PartDesign Body

Menu location
Part Design → Create body
Workbenches
PartDesign
Default shortcut
None
Introduced in version
0.17
See also
Std Part, feature editing

Description

A PartDesign Body is the base element to create solids shapes with the PartDesign Workbench. It can contain sketches, datum objects, and PartDesign Features that help in building a single contiguous solid.

The Body provides an Origin object which includes local X, Y, and Z axes, and standard planes. These elements can be used as references to attach sketches and primitive objects.

Do not confuse the PartDesign Body with the Std Part. The first one is a specific object used in the PartDesign Workbench, intended to model a single contiguous solid by means of PartDesign Features. The Std Part is a grouping object intended to create assemblies; it is not used for modelling, just to arrange different objects in space. Multiple bodies, and other Std Parts, can be placed inside a single Std Part to create a complex assembly.

Left: the tree view showing the features that sequentially produce the final shape of the object. Right: the final object visible in the 3D view.

Usage

If no previous solid is selected:

  1. Press the Body button. An empty Body is created and automatically becomes active.
  2. Now you can press New sketch to create a sketch in the Body that can be used with Pad.
  3. Alternatively, add a primitive PartDesign Feature, for example, Additive box.

If a solid object is selected:

  1. Press the Body button. A new Body is created containing a single Base Feature. This Base Feature element is a simple reference to another object previously created or imported into the document. See Base Feature for more information. An existing Body or PartDesign Feature cannot be selected when pressing Body.

Notes

  • If no Body currently exists when New sketch is pressed, a new Body will be automatically created. If a Body already exists, it has to be made active before using New sketch.
  • Double-click the Body in the tree view or open the context menu (right-click) and select Toggle active body to activate or deactivate the Body. If another Body is active, it will be deactivated. See active status for more information.

Properties

A PartDesign Body (PartDesign::Body class) is derived from a Part Feature (Part::Feature class), therefore it shares all the latter's properties.

In addition to the properties described in Part Feature, the PartDesign Body has the following properties in the property editor.

Data

Base

  • DataTip (Link): the PartDesign Feature defined as "Tip", which is usually the last feature created in the Body. The Tip indicates the final shape of the Body, which is shown in the 3D view when ViewDisplay Mode Body is set to Tip. See Tip for more information.
  • DataBase Feature (Link): an external shape used as the first PartDesign Feature in the Body. It is usually set when dragging a solid object into an empty Body. If no solid is imported in this way, this property will be empty. See Base Feature for more information.
  • DataPlacement (Placement): the position of the object in the 3D view. The placement is defined by a Base point (vector), and a Rotation (axis and angle). See Placement.
  • DataGroup (LinkList): a list with the PartDesign Features in the Body.

Hidden properties Data

  • DataOrigin (Link): the App Origin object that is the positional reference for all elements listed in DataGroup.
  • Data_ Group Touched (Bool): whether the group is touched or not.

Also the hidden properties described in Part Feature.

View

Base

  • ViewDisplay Mode Body (Enumeration): sets the display mode specifically for the Body with one of two types.
    • Through (default) exposes all objects inside the Body, that is, sketches, PartDesign Features, datum objects, etc. This mode allows visualizing partial operations done inside the Body, and thus it is the recommended mode when adding and editing features. Select the specific feature, and the set ViewVisibility to true or press the Space bar on the keyboard.
    • Tip exposes only the final shape of the Body, which is defined by the DataTip property. Everything else, including sketches, partial features, datums, etc., is not displayed, even if they are visible in the tree view. This mode is recommended when the Body does not need to be modified further, so a fixed shape is shown. This mode is also recommended when you wish to select the sub-elements (vertices, edges, and faces) of the final shape to use with other workbenches' tools.

Body concept

Single contiguous solid

A PartDesign Body is intended to model a single contiguous solid. The meaning of "contiguous" is an element made in one piece, with no moving parts, or disconnected solids. Examples of contiguous solids are those that are manufactured from a single piece of raw material by a process of casting, cutting, or milling. For example, a nut, a washer, and a bolt each consists of a single solid piece of steel with no moving parts, so each can be modelled by a PartDesign Body. Objects that are created by welding two pieces can also be modelled by a single Body as long as the weld joint is not intended to break apart.

Once these contiguous solids are put together in some type of arrangement, then they become an "assembly". In an assembly, the objects are not fused together, but they are simply "stacked" or placed next to each other, and remain individual parts.

Left: three individual contiguous solids, each of them modelled by a PartDesign Body. Right: the individual Bodies put together in an assembly.

Feature editing

A PartDesign Body is intended to work by creating an initial solid, either from a sketch or from a primitive shape, and then modifying it through "features" to add or remove material from the previous shape. For a full explanation go to feature editing.

A PartDesign Body will perform an automatic fusion (union) of the solid elements inside of it. This means that (1) partial solids should be touching when created, and (2) disconnected solids are not allowed.

Left: two individual solids that intersect each other. Right: a single PartDesign Body with two additive features; they are automatically fused together, so instead of intersecting, they form a single contiguous solid.

Left: two disconnected solids; this isn't a valid PartDesign Body. Right: two touching solids; this results in a valid PartDesign Body. The newer feature should always contact or intersect the previous feature so that it is fused to it, and becomes a single contiguous solid.

Note: other CAD programs like Catia allow discontiguous solids in the same "Body". As of v0.19, FreeCAD does not allow this. There has been discussions in the FreeCAD forum about lifting this restriction but no concrete decision has been made. If you'd like to know more or present different points of view, please discuss in the forum.

Detailed explanation of the properties

Active status

An open document can contain multiple Bodies. To add a new feature to a specific Body, it needs to be made active. An active body will be displayed in the tree view with the background color specified by the Active container value in the preferences editor (by default, light blue). An active body will also be shown in bold text.

To activate or de-activate a Body:

  • Double click on it on the tree view, or
  • Open the context menu (right click) and select Toggle active body.

Activating a Body automatically switches to the PartDesign Workbench. Only a single Body can be active at a time.

Document with two PartDesign Bodies, of which the second one is active.

Origin

The Origin consists of the three standard axes (X, Y, Z) and three standard planes (XY, XZ and YZ). Sketches and other objects can be attached to these elements when creating them.

  1. Create the Body.
  2. If the Body is selected in the tree view, press New sketch; the task panel will open to allow selecting one of the planes.
  3. If the Body is not selected, select the Origin instead and make it visible in the 3D view by pressing the Space bar in the keyboard. Also expand the Origin object to see the axes and planes.
  4. Select one of the planes, either in the tree view or in the 3D view, then press New sketch. The sketch will be created on the chosen plane.

The same process can be used when creating auxiliary datum geometry like PartDesign Lines, PartDesign Planes, and PartDesign CoordinateSystems.

Note: the Origin is an App Origin object (App::Origin class), while the axes and planes are objects of type App::Line and App::Plane respectively. Each of these elements can be hidden and unhidden individually with the Space bar; this is useful to choose the correct reference when creating other objects.

Note 2: all elements inside the Body are referenced to the Body's Origin which means that the Body can be moved and rotated in reference to the global coordinate system without affecting the placement of the elements inside.

Left: PartDesign Body Origin in the tree view. Right: representation of the Origin elements in the 3D view.

Base Feature

The Base Feature is the first PartDesign Feature in the Body when the Body is based on another solid shape. This solid can be created by any workbench, or imported from an external file, for example, a STEP file.

PartDesign Bodies, each of them with a single Base Feature, which are taken from previously created solids.

To create the Base Feature:

  1. select a solid shape external to any Body, and
  2. press Body; this will create a new Body with a single Base Feature.

Note: you can't select an existing Body, or any of its features, when pressing Body.

If you already have a Body, you can create the Base Feature in this way:

  • in the tree view, pick an object, and drag and drop it inside the Body, or
  • in the property editor, edit the value of DataBase Feature by pressing the ellipsis ..., and choosing an object from the list. In this case you can choose an existing Body to be the Base Feature.

Note: dragging and dropping only works for Bodies which don't have a Base Feature already.

Note 2: if the Body already has several features, when you drag and drop the external solid, the Base Feature will be created at the beginning of the list of features, that is, it will be added to the beginning of the DataGroup property.

The Base Feature is entirely optional; it is only present when including an object from outside the Body. If no external solid is included, you can still build your shape using sketches, pads, primitive objects, and other PartDesign Features. In this case the DataBase Feature property remains empty.

Left: PartDesign Body with a Base Feature that is taken from an external solid object, and many subsequent PartDesign Features on top. Right: Body which doesn't have an explicit Base Feature.

Tip

The Tip is the PartDesign Feature that is exposed outside the Body; that is, if another tool from any workbench (for example, Part SimpleCopy or Part Cut) needs to use the shape of the Body, it will use the shape of the Tip. Said in another way, the Tip is the final representation of the Body as if the parametric history didn't exist.

Left: PartDesign Body with full parametric history including intermediate features. Right: the Tip is the final shape that can be exported from the Body, while omitting the model's history.

The Tip is automatically set to the last feature created in the Body. Nevertheless, it can also be set to any of the intermediate features by opening the tree view context menu (right-click) and choosing Set tip, or by changing the Body's DataTip value in the property editor.

Changing the Tip in effect rolls back its history, making it possible to add features that should have been added earlier. It also exposes a different shape to external tools.

In the tree view, the Tip of the Body is recognized by the PartDesign Feature that has an icon overlay consisting of a white arrow inside a green circle.

Two PartDesign Bodies, each of them with PartDesign Features. The Tip is the last feature in them, and is marked with an overlay symbol.

Interaction with other workbenches

By default, PartDesign Features inside a Body are selectable, as this is required to edit and add more features with the PartDesign Workbench tools. Nevertheless, selecting the individual features to use them with tools from other workbenches, like Part and Draft, is not advised, as the results may be unexpected; if this is done, in the report view an error message may appear, Links go out of the allowed scope.

Therefore, for interactions with other workbenches, only the Body itself should be selected in the tree view. In cases where it is necessary to select specific sub-elements of the Body (vertices, edges, and faces), the Body's ViewDisplay Mode Body property should be switched to Tip. When this mode is enabled, access to objects under the Body (features, datums, sketches) is disabled, and everything but the Body's Tip will be hidden in the 3D view.

Once the sub-elements have been used with other workbenches, ViewDisplay Mode Body can be set back to Through.

Left: when "Display Mode Body" is set to Through it is possible to select and perform operations with the individual PartDesign Features; in general, this is not recommended. Right: when "Display Mode Body" is set to Tip all selections and operations done on the Body will be done on the Tip, making sure only the final shape of the Body is exposed.

Visibility management

The Body's visibility supersedes the visibility of any object it contains. If the Body is hidden, the objects it contains will be hidden as well, even if their individual ViewVisibility property is set to true.

Multiple Sketches may be visible at one time, but only one PartDesign Feature (solid result) can be visible at a time. Selecting a hidden feature and pressing the Space bar in the keyboard will make it visible, and automatically hide the previously visible feature.

PartDesign Body: multiple Sketches may be visible simultaneously, but only one solid PartDesign Feature may be visible at one time, whether it is the Tip or not.

Attachment

PartDesign Features, just like planar objects, can be attached to different planes, usually the standard planes defined by the Body's Origin, or to custom PartDesign Planes.

Sketches are normally attached to a plane when they are created. In similar way, primitive features can also be attached. Attaching these objects to a plane allows them to be moved within the Body by changing their DataAttachment Offset property. For more information on the attachment modes see Part Attachment.

A PartDesign Feature that is not attached will be shown with a red overlay symbol next to their icon in the tree view.

PartDesign Body: PartDesign Features that are not attached to a plane or coordinate system will be shown with an overlay symbol next to their icon in the tree view.

Inheritance

A PartDesign Body is formally an instance of the class PartDesign::Body, whose parent is Part Feature (Part::Feature class) through the intermediate Part::BodyBase class, and is augmented with an Origin extension.

Simplified diagram of the relationships between the core objects in the program. The PartDesign::Body object is intended to build parametric 3D solids, and thus is derived from the basic Part::Feature object, and has an Origin to control the placement of the features used inside of it.

Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

See Part Feature for the general information on adding objects to the document

A PartDesign Body is created with the addObject() method of the document. Once a Body exists, PartDesign Features can be added to it with the addObject() or addObjects() methods of this Body.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("PartDesign::Body", "Body")
obj.Label = "Custom label"

feat1 = App.ActiveDocument.addObject("PartDesign::AdditiveBox", "Box")
feat2 = App.ActiveDocument.addObject("PartDesign::AdditiveCylinder", "Cylinder")

obj.addObjects([feat1, feat2])
App.ActiveDocument.recompute()

In a document that has many Bodies, the active Body can be set using the setActiveObject method of the ActiveView. The first argument is the fixed string "pdbody", and the second argument is the Body object that should be made active.

import FreeCAD as App
import FreeCADGui as Gui

doc = App.newDocument()
obj1 = App.ActiveDocument.addObject("PartDesign::Body", "Body")
obj2 = App.ActiveDocument.addObject("PartDesign::Body", "Body")

Gui.ActiveDocument.ActiveView.setActiveObject("pdbody", obj1)
App.ActiveDocument.recompute()