Part Box: Difference between revisions

From FreeCAD Documentation
(Rewritten Description section)
(New version of the Part Box wiki entry.)
Line 33: Line 33:
[[Image:Part_Box_Example.jpg|Part_Box]]
[[Image:Part_Box_Example.jpg|Part_Box]]
<translate>
<translate>

<!
The Box command from the [[Part_Workbench|Part Workbench]] inserts a parametric, [http://en.wikipedia.org/wiki/Cuboid#Rectangular_cuboid rectangular cuboid], geometric primitive into the active document. By default, the Box command will insert a 10x10x10 mm cube, positioned at the origin, with the label "cube". These parameters may be modified after the object has been added.
-->


== Usage == <!--T:39-->
== Usage == <!--T:39-->


<!--T:21-->
<!--T:21-->
# Switch to the [[Image:Workbench_Part.svg|16px]] [[Part_Workbench|Part Workbench]]
First, make sure you are using the [[Image:Workbench_Part.svg|16px]] [[Part_Workbench|Part Workbench]].
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Part_Box.svg|16px]] Cube}} button in the toolbar.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Box.svg|16px]] Cube}} from the menu bar.


There are two ways to create a Part Box:
<!--T:36-->
* press the {{Button|[[Image:Part_Box.svg|16px]] Cube}} button in the toolbar
'''Result:''' The default result is a box with an equal length, width and height of 10 mm. It is attached to the global xy-plane and one edge is coincident with the global z-axis.
* use the menu: {{MenuCommand|Part → Primitives → [[Image:Part_Box.svg|16px]] Cube}}


<!--T:37-->
<!--T:8-->
To edit the Part Box:
The properties of the box can be edited later, either in the property editor or by double-clicking on the box in the model tree.
* either
# select it in the tree and double-click on it
# edit the parameters in the appearing dialog
* or use the the [[Property_editor|Property Editor]] to edit its Properties


== Example ==
== Example ==
Line 60: Line 58:
== Notes ==
== Notes ==


The inserted box is a parametric, [http://en.wikipedia.org/wiki/Cuboid#Rectangular_cuboid rectangular cuboid].
By default, a box is created with three sides (edges) of equal length, each one 10 mm long.


== Properties == <!--T:40-->
== Properties == <!--T:40-->
Line 69: Line 67:


=== Data ===
=== Data ===

{{TitleProperty|Attachment}}

The object has the same attachment properties as a [[Part_Part2DObject#Data|Part Part2DObject]].

{{TitleProperty|Base}}

The objects [[Placement|placement]] and its label.


<!--T:41-->
<!--T:41-->
Line 82: Line 72:


<!--T:24-->
<!--T:24-->
*{{PropertyData|Length|Length}}: The length of the box. This is the dimension in the x-direction.
* {{PropertyData|Length|Length}}: The length of the box. This is the dimension in the x-direction.
*{{PropertyData|Width|Length}}: The width of the box. This is the dimension in the y-direction.
* {{PropertyData|Width|Length}}: The width of the box. This is the dimension in the y-direction.
*{{PropertyData|Height|Length}}: The height of the box. This is the dimension in the z-direction.
* {{PropertyData|Height|Length}}: The height of the box. This is the dimension in the z-direction.


== Scripting == <!--T:42-->
== Scripting == <!--T:42-->


<!--T:26-->
<!--T:26-->
A '''Part Box''' can be created using the following function:
A Part Box is created created with the {{Incode|addObject()}} method of the document.


</translate>
</translate>
Line 98: Line 88:


<!--T:27-->
<!--T:27-->
* Where {{Incode|myBox}} is the {{Incode|Name}} for the object. The name must be unique for the entire document.
* Where {{Incode|myBox}} is the name for the object. The name must be unique for the entire document.
* The function returns the newly created object.
* The function returns the newly created object.



Revision as of 21:30, 17 February 2022

This documentation is not finished. Please help and contribute documentation.

GuiCommand model explains how commands should be documented. Browse Category:UnfinishedDocu to see more incomplete pages like this one. See Category:Command Reference for all commands.

See WikiPages to learn about editing the wiki pages, and go to Help FreeCAD to learn about other ways in which you can contribute.

Part Box

Menu location
Part → Primitives → Cube
Workbenches
Part
Default shortcut
None
Introduced in version
-
See also
Part Primitives

Description

The Part Box command creates a parametric box solid.

FreeCAD creates a cube, each side with an equal length of 10 millimetre.

By default, the box is positioned with the lower left corner at the origin (0,0,0). The bottom of the cube is on the xy-plane. Its extension in x, y and z direction follows the positive axis values.

Part_Box

Usage

First, make sure you are using the Part Workbench.

There are two ways to create a Part Box:

  • press the Cube button in the toolbar
  • use the menu: Part → Primitives → Cube

To edit the Part Box:

  • either
  1. select it in the tree and double-click on it
  2. edit the parameters in the appearing dialog

Example

Part Box scripting example.

A Part Box object with the values of the bottom scripting example are shown here.

Notes

The inserted box is a parametric, rectangular cuboid.

Properties

See also: Property editor.

A Part Box object is derived from a Part Feature object and inherits all its properties. It also has the following additional properties:

Data

Box

  • DataLength (Length): The length of the box. This is the dimension in the x-direction.
  • DataWidth (Length): The width of the box. This is the dimension in the y-direction.
  • DataHeight (Length): The height of the box. This is the dimension in the z-direction.

Scripting

A Part Box is created created with the addObject() method of the document.

box = FreeCAD.ActiveDocument.addObject("Part::Box", "myBox")
  • Where myBox is the name for the object. The name must be unique for the entire document.
  • The function returns the newly created object.

The Label is the user editable name for the object. It can be easily changed by

box.Label = "new myBoxName"

You can access and modify attributes of the box object. For example, you may wish to modify the length, width and height parameters.

box.Length = 4
box.Width = 8
box.Height = 12

You can change its placement with:

box.Placement = FreeCAD.Placement(FreeCAD.Vector(1, 2, 3), FreeCAD.Rotation(75, 60, 30))