Part RegularPolygon: Difference between revisions

From FreeCAD Documentation
m (png to svg)
(Undo revision 1282083 by David69 (talk)Please don't rush like that. And please, please look at all other pages belonging to the workbench before making these adhoc changes.)
Tag: Undo
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{UnfinishedDocu|Screenshot + Formatted Parameters + Scripting section}}
<translate>
<translate>

<!--T:11-->
{{Docnav
|[[Part_Line|Line]]
|[[Part_Builder|Builder]]
|[[Part_Workbench|Part]]
|IconL=Part_Line.svg
|IconR=Part_Builder.svg
|IconC=Workbench_Part.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Part RegularPolygon
|Name=Part RegularPolygon
|MenuLocation=Part → [[Part_CreatePrimitives|Create Primitives]] → Regular Polygon
|MenuLocation=Part → [[Part_Primitives|Create primitives]] → Regular polygon
|Workbenches=[[Part Module|Part]]
|Workbenches=[[Part_Workbench|Part]], [[OpenSCAD_Workbench|OpenSCAD]]
|Version=0.14
|Version=0.14
|SeeAlso=[[Part CreatePrimitives]]
|SeeAlso=[[Part_Primitives|Part Primitives]]
}}
}}


== Description == <!--T:2-->
==Description== <!--T:9-->

Creates a RegularPolygon geometric primitive.
<!--T:2-->
A [[Image:Part_RegularPolygon.svg|24px]] '''Part RegularPolygon''' is a parametric shape that can be created with the [[Image:Part_Primitives.svg|24px]] [[Part_Primitives|Part Primitives]] command. In the coordinate system defined by its {{PropertyData|Placement}} property, the polygon lies on the XY plane with its center at the origin and one of its vertices on the X axis.

</translate>
[[Image:Part_RegularPolygon_Example.png|400px]]
<translate>


==Usage== <!--T:3-->
==Usage== <!--T:3-->


<!--T:6-->
<!--T:13-->
See [[Part_Primitives#Usage|Part Primitives]].
The RegularPolygon is available from the Create Primitives dialogue in the Part workbench.
# Switch to the [[Image:Workbench_Part.svg|24px]] [[Part Workbench]]
# The RegularPolygon command can be accessed several ways:
#* The Create Primitives dialogue via the [[Image:Part_CreatePrimitives.svg|24px]] [[Part_CreatePrimitives|CreatePrimitives]] icon located in the Part toolbar
#* Using the {{MenuCommand|Part → [[Part_CreatePrimitives|Create Primitives]] → Regular Polygon}}


== Example == <!--T:14-->


== Parameters == <!--T:4-->
<!--T:15-->
[[Image:Part_RegularPolygon_Scripting_Example.png|thumb|Part RegularPolygon from the scripting example]]
*Polygon - the number of sides of the polygon which describes the cross section of the Part Prism
*Circumradius - the circumradius is the distance from the centre of the polygon to a vertex.


<!--T:7-->
<!--T:16-->
A Part RegularPolygon object created with the [[#Scripting|scripting example]] below is shown here.
{{Part Tools navi}}


<!--T:8-->
== Properties == <!--T:17-->

{{Userdocnavi}}
<!--T:18-->
See also: [[Property_editor|Property editor]].

<!--T:19-->
A Part RegularPolygon object is derived from a [[Part_Feature|Part Feature]] object and inherits all its properties. It also has the following additional properties:

=== Data === <!--T:20-->

<!--T:21-->
{{TitleProperty|Attachment}}

<!--T:22-->
The object has the same attachment properties as a [[Part_Part2DObject#Data|Part Part2DObject]].

<!--T:23-->
{{TitleProperty|Regular Polygon}}

<!--T:24-->
* {{PropertyData|Polygon|IntegerConstraint}}: The number of sides of the polygon. The default is {{Value|6}}.
* {{PropertyData|Circumradius|Length}}: The radius of the circle that circumscribes the polygon, the distance from the center of the polygon to one of its vertices. The default is {{Value|2mm}}.

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

<!--T:26-->
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation], [[Part_scripting|Part scripting]] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].

<!--T:27-->
A Part RegularPolygon can be created with the {{Incode|addObject()}} method of the document:

</translate>
{{Code|code=
poly = FreeCAD.ActiveDocument.addObject("Part::RegularPolygon", "myPolygon")
}}
<translate>

<!--T:28-->
* Where {{Incode|"myPolygon"}} is the name for the object.
* The function returns the newly created object.

<!--T:29-->
Example:

</translate>
{{Code|code=
import FreeCAD as App

doc = App.activeDocument()

poly = doc.addObject("Part::RegularPolygon", "myPolygon")
poly.Polygon = 5
poly.Circumradius = 8
poly.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(60, 30, 15))

doc.recompute()
}}
<translate>


<!--T:12-->
{{Docnav
|[[Part_Line|Line]]
|[[Part_Builder|Builder]]
|[[Part_Workbench|Part]]
|IconL=Part_Line.svg
|IconR=Part_Builder.svg
|IconC=Workbench_Part.svg
}}


</translate>
</translate>
{{Part_Tools_navi{{#translation:}}}}
{{clear}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 12:16, 26 June 2023

Part RegularPolygon

Menu location
Part → Create primitives → Regular polygon
Workbenches
Part, OpenSCAD
Default shortcut
None
Introduced in version
0.14
See also
Part Primitives

Description

A Part RegularPolygon is a parametric shape that can be created with the Part Primitives command. In the coordinate system defined by its DataPlacement property, the polygon lies on the XY plane with its center at the origin and one of its vertices on the X axis.

Usage

See Part Primitives.

Example

Part RegularPolygon from the scripting example

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

Properties

See also: Property editor.

A Part RegularPolygon 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.

Regular Polygon

  • DataPolygon (IntegerConstraint): The number of sides of the polygon. The default is 6.
  • DataCircumradius (Length): The radius of the circle that circumscribes the polygon, the distance from the center of the polygon to one of its vertices. The default is 2mm.

Scripting

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

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

poly = FreeCAD.ActiveDocument.addObject("Part::RegularPolygon", "myPolygon")
  • Where "myPolygon" is the name for the object.
  • The function returns the newly created object.

Example:

import FreeCAD as App

doc = App.activeDocument()

poly = doc.addObject("Part::RegularPolygon", "myPolygon")
poly.Polygon = 5
poly.Circumradius = 8
poly.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(60, 30, 15))

doc.recompute()