4.1.1      Box

The  button from Primitives section in Geometry tab and Geometry->Primitives->Create Box... command from main menu invoke Create Box dialogue for creating a Box primitive object.

The Create Box dialogue with default parameters and preview of the box solid will appear.


Name and medium

We can set the name of the box and choose the medium assigned to the box from Medium list. The Medium list contains all media available in the Project Media and the default medium is taken from current active medium (see Project Media chapter for more information).


Parameters

The Parameters section contains box dimensions: Length, Width and Height.


Position

The Position section contains X, Y and Z position relative to the origin 0, 0, 0 and the axis of direction: X, Y, Z (default) or User defined described by (x, y, z) vector.

     


The box at origin position and along X axis.


The box at origin position and along Y axis.


The box at origin position and along Z axis.


The box shifted from origin position and along Z axis.


The box shifted from origin position and along axis described by (0, 1, 1) vector.


Map to face

From Pick option allows adjusting the position, axis of direction and size to the selected area.


Press left mouse button for face selection.


Press From Pick button to place the box on the selected face.


Select Use dimensions from the list and press From Pick button to place the box on the selected face and adjust the box to the face.


Python code

The python code, which can be useful when creating project scripts, generated by Create Box dialogue for default parameters:


from FreeCAD import Base

import Part,PartGui

App.ActiveDocument.addObject("Part::Box","Box")

App.ActiveDocument.Box.Length = 10.00000

App.ActiveDocument.Box.Width = 10.00000

App.ActiveDocument.Box.Height = 10.00000

App.ActiveDocument.Box.Placement = Base.Placement(Base.Vector(0.00000,0.00000,0.00000),Base.Rotation(0.00000,0.00000,0.00000,1.00000))

App.ActiveDocument.Box.Label = "Box"

App.ActiveDocument.Box.Medium = QW_Modeller.getQWMedium("metal")

Gui.SendMsgToActiveView("ViewFit")

App.ActiveDocument.recompute()