Part Spiral: Difference between revisions

From FreeCAD Documentation
Line 62: Line 62:
== Scripting ==
== Scripting ==


See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation], [[Part_scripting|Part scripting]] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].
A Part Spiral is created with the {{Incode|addObject()}} method of the document.

A Part Spiral can be created with the {{Incode|addObject()}} method of the document:


</translate>
</translate>
Line 70: Line 72:
<translate>
<translate>


* Where {{Incode|mySpiral}} is the name for the object. The name must be unique for the entire document.
* Where {{Incode|"mySpiral"}} is the name for the object.
* The function returns the newly created object.
* The function returns the newly created object.


Example:
The {{Incode|Label}} is the user editable name for the object. It can be easily changed by


</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD as App
spiral.Label = "new mySpiralName"
}}
<translate>


doc = App.activeDocument()
You can access and modify attributes of the {{Incode|spiral}} object. For example, you may wish to modify the growth, radius and rotations parameters.


spiral = doc.addObject("Part::Spiral", "mySpiral")
</translate>
{{Code|code=
spiral.Growth = 2
spiral.Growth = 2
spiral.Radius = 3
spiral.Radius = 3
spiral.Rotations = 4
spiral.Rotations = 4
spiral.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(75, 60, 30))

doc.recompute()
}}
}}
<translate>
<translate>


You can change its placement and orientation with:

</translate>
{{Code|code=
spiral.Placement = FreeCAD.Placement(FreeCAD.Vector(1, 2, 3), FreeCAD.Rotation(75, 60, 30))
}}
<translate>


<!--T:9-->
<!--T:9-->
Line 110: Line 105:


</translate>
</translate>
{{Part Tools navi{{#translation:}}}}
{{Part_Tools_navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Revision as of 10:37, 2 March 2022

This documentation is not finished. Please help and contribute documentation.

GuiCommand model explains how commands should be documented. Browse Category:UnfinishedDocu to see more incomplete pages like this one. See Category:Command Reference for all commands.

See WikiPages to learn about editing the wiki pages, and go to Help FreeCAD to learn about other ways in which you can contribute.

Part Spiral

Menu location
Part → Create primitives → Spiral
Workbenches
Part
Default shortcut
None
Introduced in version
0.14
See also
Part Primitives

Description

A Part Spiral is a parametric shape that can be created with the Part Primitives command. In the coordinate system defined by its DataPlacement property, the spiral lies on the XY plane with its center at the origin and its start point on the X axis. It widens as it turns counterclockwise.

Usage

See Part Primitives.

Example

Part Spiral from the scripting example

A Part Spiral object created with the scripting example below is shown here.

Properties

See also: Property editor.

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

Data

Attachment

The object has the same attachment properties as a Part Part2DObject.

Spiral

  • DataGrowth (Length): The distance between two consecutive turns of the spiral. The default is 1mm.
  • DataRadius (Length): The start radius of the spiral, the distance between its center and its start point. Can be 0mm. The default is 1mm.
  • DataRotations (QuantityConstraint): The number of rotations, or turns, of the spiral. The default is 2.
  • DataSegment Length (QuantityConstraint): The number of turns per spiral subdivision. The default is 1, meaning each full turn of the spiral is a separate segment. Use 0 to suppress subdivision.

Scripting

See also: Autogenerated API documentation, Part scripting and FreeCAD Scripting Basics.

A Part Spiral can be created with the addObject() method of the document:

spiral = FreeCAD.ActiveDocument.addObject("Part::Spiral", "mySpiral")
  • Where "mySpiral" is the name for the object.
  • The function returns the newly created object.

Example:

import FreeCAD as App

doc = App.activeDocument()

spiral = doc.addObject("Part::Spiral", "mySpiral")
spiral.Growth = 2
spiral.Radius = 3
spiral.Rotations = 4
spiral.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(75, 60, 30))

doc.recompute()