Part Cylinder: Difference between revisions

From FreeCAD Documentation
(Added Scripting section)
(Marked this version for translation)
(3 intermediate revisions by the same user not shown)
Line 51: Line 51:
* {{PropertyData|Second Angle}}: Angle in second direction. {{Version|0.20}}
* {{PropertyData|Second Angle}}: Angle in second direction. {{Version|0.20}}


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

The Cylinder command can by used in [[Macros|macros]] and from the python console using the following function:
<!--T:23-->
A Part Cylinder can be created using the following function:

</translate>
{{Code|code=
{{Code|code=
FreeCAD.ActiveDocument.addObject("Part::Cylinder", "myCylinder")
cylinder = FreeCAD.ActiveDocument.addObject("Part::Cylinder", "myCylinder")
}}
}}
<translate>
* Where "myCylinder" is the label for the Cylinder object.

* Returns newly created object of type Cylinder.
<!--T:24-->
* Where {{Incode|"myCylinder"}} is the name for the object.
* The function returns the newly created object.





Revision as of 14:02, 8 January 2022

Part Cylinder

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

Description

Creates a simple parametric cylinder, with position, angle, radius and height parameters.

Usage

  1. Switch to the Part Workbench
  2. There are several ways to invoke the command:
    • Press the Cylinder button in the toolbar.
    • Select Part → Primitives → Cylinder entry from the top menu

Result: The default result is a full cylinder with a radius of 2 mm and height of 10 mm, centered along the global z-axis and attached to the global xy-plane.

The cylinder properties can later be edited, either in the Property editor or by double-clicking the cylinder in the Tree view.

a cylinder created with the Cylinder tool

Properties

  • DataAngle: This is the rotation angle that permits the creation of a portion of cylinder (it is set to 360° by default)
  • DataHeight: The height is the distance in the z-axis
  • DataRadius: The radius defines a plane in x-y.
  • DataFirst Angle: Angle in first direction. introduced in version 0.20
  • DataSecond Angle: Angle in second direction. introduced in version 0.20

Scripting

A Part Cylinder can be created using the following function:

cylinder = FreeCAD.ActiveDocument.addObject("Part::Cylinder", "myCylinder")
  • Where "myCylinder" is the name for the object.
  • The function returns the newly created object.