4.1.7      Prism

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

The Create Prism dialogue with default parameters and preview of the prism solid will appear.


Name and medium

We can set the name of the torus and choose the medium assigned to the prism 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 prism dimensions: the number of sides of the polygon which describes the cross section of the prism (Polygon), the distance from the centre of the polygon to a vertex (Circumradius) and the height (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 prism at origin position and along X axis.


The prism at origin position and along Y axis.


The prism at origin position and along Z axis.


The prism shifted from origin position and along Z axis.


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


Map to face

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


Press left mouse button for face selection.


Press From Pick button to place the prism in the middle of the selected face.


Select Use minimum dimension from the list and press From Pick button to place the torus in the middle of the selected face and adjust the Circumradius to the minimal dimension of the face.


Select Use maximum dimension from the list and press From Pick button to place the prism in the middle of the selected face and adjust the Circumradius to the maximal dimension of the face.


Python code

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


from FreeCAD import Base

import Part,PartGui

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

App.ActiveDocument.Prism.Polygon = 6

App.ActiveDocument.Prism.Circumradius = 2.00000

App.ActiveDocument.Prism.Height = 10.00000

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

App.ActiveDocument.Prism.Label = "Prism"

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

Gui.SendMsgToActiveView("ViewFit")

App.ActiveDocument.recompute()