Part Torus: Difference between revisions

From FreeCAD Documentation
m (Precise Label.)
No edit summary
Line 32: Line 32:


<!--T:5-->
<!--T:5-->
# There are several ways to invoke the command:
# Switch to the [[Image:Workbench_Part.svg|16px]] [[Part_Workbench|Part Workbench]]
#* Press the {{Button|[[Image:Part_Torus.svg|16px]] [[Part Torus|Torus]]}} button.
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Part_Torus.svg|16px]] Torus}} button in the toolbar.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Torus.svg|16px]] Torus}} option from the menu.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Torus.svg|16px]] Torus}} from the menu bar.


<!--T:21-->
'''Result:''' The torus will be positioned at origin (point 0,0,0) on creation.<br />
The angle parameters (angle1, angle2, angle3), as well as the radius parameters (radius1, radius2) permit to parametrize the torus, see next section.


== Example ==
== Example ==

Revision as of 19:23, 19 February 2022

Part Torus

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

Description

Creates a simple parametric torus, with position, angle1, angle2, angle3, radius1 and radius2 as parameters.

Usage

  1. There are several ways to invoke the command:
    • Press the Torus button.
    • Select the Part → Primitives → Torus option from the menu.

Example

Part Torus scripting example.

A Part Torus object with the values of the bottom scripting example are shown here.

Option

Parameter

A torus can be assimilated to a small disc that makes a circular orbit around an imaginary axe. Thus the parametric torus is defined by the following parameters:

Torus

  • DataRadius1 (Length): Radius of the circle around which the disc circulate
  • DataRadius2 (Length): Radius of the disc defining the form of the torus
  • DataAngle1 (Angle): 1st angle to cut / define the disc of the torus
  • DataAngle2 (Angle): 2nd angle to cut / define the disc of the torus
  • DataAngle3 (Angle): 3rd angle to define the circumference of the torus.

As well as the standard set of placement parameters. The pictures below give a visual overview of the parameters antecedently mentioned:

The parameter Radius1 has a value of 20 mm.

The parameter Radius2 has a value of 2 mm.

The parameter Angle1 has a value of -90°. Notice that, the 'angle measure' tool cannot display negative angle. Considered the displayed value in picture as '-90°'.

The parameter Angle2 has a value of 90°.

The parameter Angle3 has a value of 90°.

Scripting

A Part Torus can be created using the following function:

torus = FreeCAD.ActiveDocument.addObject("Part::Torus", "myTorus")
  • Where myTorus is the user editable name for the object.
  • The function returns the newly created object.

The label text of the object can be easily changed by

torus.Label = "new myTorusName"

You can access and modify attributes of the torus object. For example, you may wish to modify the radii or angle parameters.

torus.Radius1 = 20
torus.Radius2 = 10
torus.Angle1 = -90
torus.Angle2 = 45
torus.Angle3 = 270

The result will be a three-quarter torus.

You can change its placement and orientation with:

torus.Placement = FreeCAD.Placement(FreeCAD.Vector(1, 2, 3), FreeCAD.Rotation(30, 45, 10))