Part Box: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Usage)
Line 34: Line 34:
<!--T:4-->
<!--T:4-->
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Part_Box.svg|16px]] [[Part Cube|Cube]]}} button.
#* Press the {{Button|[[Image:Part_Box.svg|16px]] [[Part_Box|Part Box]]}} button.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Box.svg|16px]] Cube}} option from the menu.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Box.svg|16px]] Cube}} option from the menu.
# A box is created.
# Optionally change the dimensions and {{PropertyData|Placement}} of the box by doing one of the following:
#* Double-click the object in the [[Tree_view|Tree view]]:
#*# The {{MenuCommand|Geometic Primitives}} task panel opens.
#*# Change the required properties.
#*# The object updates dynamically.
#*# Press the {{Button|OK}} button.
#* Change the properties in the [[Property_editor|Property editor]].
#* To change the {{PropertyData|Placement}} in the [[3D_view|3D view]]: Right-click the object in the [[Tree_view|Tree view]] and select {{MenuCommand|Transform}}. See [[Image:Std_TransformManip.svg|16px]] [[Std_TransformManip|Std TransformManip]].


== Example ==
== Example ==

Revision as of 13:55, 1 March 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, a rectangular cuboid. In the coordinate system defined by its DataPlacement property, the bottom face of the box lies on the XY plane with its front left corner at the origin, and its front edge parallel to the X axis.

Usage

  1. There are several ways to invoke the command:
    • Press the Part Box button.
    • Select the Part → Primitives → Cube option from the menu.
  2. A box is created.
  3. Optionally change the dimensions and DataPlacement of the box by doing one of the following:
    • Double-click the object in the Tree view:
      1. The Geometic Primitives task panel opens.
      2. Change the required properties.
      3. The object updates dynamically.
      4. Press the OK button.
    • Change the properties in the Property editor.
    • To change the DataPlacement in the 3D view: Right-click the object in the Tree view and select Transform. See Std TransformManip.

Example

Part Box scripting example

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

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

Attachment

The object has the same attachment properties as a Part Part2DObject.

Box

  • DataLength (Length): The length of the box. This is the dimension in its X direction. The default is 10mm.
  • DataWidth (Length): The width of the box. This is the dimension in its Y direction. The default is 10mm.
  • DataHeight (Length): The height of the box. This is dimension in its Z direction. The default is 10mm.

Scripting

A Part Box is 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 and orientation with:

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