4.1.2      Cylinder

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

The Create Cylinder dialogue with default parameters and preview of the cylinder solid will appear.


Name and Medium

We can set the name of the cylinder and choose the medium assigning to the cylinder 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 the cylinder radius (Radius), height (Height) and angle (Angle), which permit the creation of a portion of the cylinder.


Position

The Position section contains X, Y and Z centre 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 cylinder at origin position and along X axis.


The cylinder at origin position and along Y axis.


The cylinder at origin position and alongZ axis.


The cylinder shifted from origin position and along Z axis.


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


Map to face

From Pick option allows adjusting the centre 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 cylinder in the middle of the selected face.


Select Use minimum dimension from the list and press From Pick button to place the cylinder in the middle of the selected face and adjust the radius (Radius) to the minimal dimension of the face.


Select Use maximum dimension from the list and press From Pick button to place the cylinder in the middle of the selected face and adjust the radius (Radius) to the maximal dimension of the face.


Python code

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


from FreeCAD import Base

import Part,PartGui

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

App.ActiveDocument.Cylinder.Radius = 10.00000

App.ActiveDocument.Cylinder.Angle = 360.00000

App.ActiveDocument.Cylinder.Height = 10.00000

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

App.ActiveDocument.Cylinder.Label = "Cylinder"

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

Gui.SendMsgToActiveView("ViewFit")

App.ActiveDocument.recompute()