Part Cylinder: Difference between revisions

From FreeCAD Documentation
m (→‎Scripting: and add an image.)
mNo edit summary
Line 46: Line 46:
== Properties == <!--T:11-->
== Properties == <!--T:11-->


See also: [[Property_editor|Property editor]].
<!--T:20-->
* {{PropertyData|Angle}}: This is the rotation angle that permits the creation of a portion of cylinder (it is set to 360° by default)
* {{PropertyData|Height}}: The height is the distance in the z-axis
* {{PropertyData|Radius}}: The radius defines a plane in x-y.
* {{PropertyData|First Angle}}: Angle in first direction. {{Version|0.20}}
* {{PropertyData|Second Angle}}: Angle in second direction. {{Version|0.20}}


A Part Cylinder object is derived from a [[Part_Feature|Part Feature]] object and inherits all its properties. It also has the following additional properties:

<!--T:20-->
* {{PropertyData|Angle|Angle}}: The rotation angle of the cylinder. The rotation angle permits the creation of a portion of cylinder (it is set to 360° by default).
* {{PropertyData|Height|Height}}: The height of the cylinder. This is the dimension in the Z direction.
* {{PropertyData|Radius|Radius}}: The radius of the cylinder. This defines a plane in the XY area.
* {{PropertyData|First Angle|First Angle}}: Angle in first direction. {{Version|0.20}}
* {{PropertyData|Second Angle|Second Angle}}: Angle in second direction. {{Version|0.20}}


==Limitations==
==Limitations==

Revision as of 06:09, 11 February 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

Notes

Properties

See also: Property editor.

A Part Cylinder object is derived from a Part Feature object and inherits all its properties. It also has the following additional properties:

  • DataAngle (Angle): The rotation angle of the cylinder. The rotation angle permits the creation of a portion of cylinder (it is set to 360° by default).
  • DataHeight (Height): The height of the cylinder. This is the dimension in the Z direction.
  • DataRadius (Radius): The radius of the cylinder. This defines a plane in the XY area.
  • DataFirst Angle (First Angle): Angle in first direction. introduced in version 0.20
  • DataSecond Angle (Second Angle): Angle in second direction. introduced in version 0.20

Limitations

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.

You can access and modify attributes of the cylinder object.

The name of the object can be easily changed by

cylinder.Label = "new cylinderName"

For example, you may wish to modify the width, length or of the start and finish vertex.

cylinder.Radius = 10
cylinder.Height = 25
cylinder.Angle = 270
cylinder.FirstAngle = 30
cylinder.SecondAngle = 45

The result is a three-quarter cylinder.

You can change its placement and orientation with:

cylinder.Placement = FreeCAD.Placement(FreeCAD.Vector(2, 4, 6), FreeCAD.Rotation(30, 45, 10))
Part Cylinder with the values of the scripting example.