Part Prism: Difference between revisions

From FreeCAD Documentation
No edit summary
(Removed references to V0.19.)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{UnfinishedDocu{{#translation:}}}}
<translate>
<translate>


Line 17: Line 16:
|Name=Part Prism
|Name=Part Prism
|MenuLocation=Part → [[Part_Primitives|Create primitives]] → Prism
|MenuLocation=Part → [[Part_Primitives|Create primitives]] → Prism
|Workbenches=[[Part_Workbench|Part]]
|Workbenches=[[Part_Workbench|Part]], [[OpenSCAD_Workbench|OpenSCAD]]
|Version=0.14
|Version=0.14
|SeeAlso=[[Part_Primitives|Part Primitives]], [[Part_Box|Part Box/Cube]]
|SeeAlso=[[Part_Primitives|Part Primitives]]
}}
}}


Line 25: Line 24:


<!--T:2-->
<!--T:2-->
A [[Image:Part_Prism.svg|24px]] '''Part Prism''' is a parametric solid that can be created with the [[Image:Part_Primitives.svg|24px]] [[Part_Primitives|Part Primitives]] command. It is the result of extruding a regular polygon along a straight path. In the coordinate system defined by its {{PropertyData|Placement}} property, the bottom face of the prism lies on the XY plane with its center at the origin and one of its vertices on the X axis.
A Part Prism is a solid defined by a regular polygon cross section and a height.


</translate>
==Usage== <!--T:8-->
[[Image:Part_Prism_Example.png|400px]]
<translate>


<!--T:3-->
== Usage == <!--T:8-->
# Open the {{Button|[[Image:Workbench_Part.svg|16px]] [[Part_Workbench|Part]]}} Workbench.
# Press the {{Button|[[Image:Part_Primitives.svg|24px]] [[Part_Primitives|Primitives]]}} button, or use the {{MenuCommand|Part → [[Part_Primitives|Create primitives]] → Prism}} from the top menu.
# Select '''Prism''' in the dialog and set the parameters.


<!--T:12-->
<!--T:14-->
See [[Part_Primitives#Usage|Part Primitives]].
The prism properties can later be edited, either in the [[Property_editor|Property editor]] or by double-clicking the prism in the [[Tree_view|Tree view]].


== Example == <!--T:15-->
==Notes==

<!--T:16-->
[[Image:Part_Prism_Scripting_Example.png|thumb|Part Prism from the scripting example]]

<!--T:17-->
A Part Prism object created with the [[#Scripting|scripting example]] below is shown here.


== Properties == <!--T:4-->
== Properties == <!--T:4-->


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

<!--T:19-->
A Part Prism 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|Prism}}
{{TitleProperty|Prism}}


<!--T:13-->
<!--T:13-->
* {{PropertyData|Polygon|}}: The number of edges for the polygon that forms the base and top plane of the prism.
* {{PropertyData|Polygon|IntegerConstraint}}: The number of sides of the polygon. The default is {{Value|6}}.
* {{PropertyData|Circumradius|Length}}: The distance from the center of the polygon to the prism edges.
* {{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}}.
* {{PropertyData|Height|Length}}: The height is the distance in the z-axis.
* {{PropertyData|Height|Length}}: The height of the prism. The default is {{Value|10mm}}.
* {{PropertyData|First Angle|Angle}}: Angle in first direction. {{Version|0.19}}
* {{PropertyData|First Angle|Angle}}: The angle between the extrusion direction of the prism and its positive Z axis, measured around its Y axis. The angle is positive towards its positive X axis. Valid range: {{Value|0° &lt;&#61; value &lt; 90°}}. The default is {{Value|0°}}.
* {{PropertyData|Second Angle|Angle}}: Angle in second direction. {{Version|0.19}}
* {{PropertyData|Second Angle|Angle}}: The angle between the extrusion direction of the prism and its positive Z axis, measured around its X axis. The angle is positive towards its positive Y axis. Valid range: {{Value|0° &lt;&#61; value &lt; 90°}}. The default is {{Value|0°}}.


== Scripting == <!--T:24-->
==Limitations==


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


<!--T:26-->
A Part Prism can be created with the following function:
A Part Prism can be created with the {{Incode|addObject()}} method of the document:


</translate>
</translate>
Line 62: Line 83:
<translate>
<translate>


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


<!--T:28-->
The name of the object can be easily changed by
Example:


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


doc = App.activeDocument()
You can access and modify attributes of the {{Incode|prism}} object. For example, you may wish to modify the number of sides of the base polygon, the circumferential radius or one of the two angles.


prism = doc.addObject("Part::Prism", "myPrism")
</translate>
{{Code|code=
prism.Polygon = 5
prism.Polygon = 5
prism.Circumradius = 10
prism.Circumradius = 10
Line 82: Line 102:
prism.FirstAngle = 22.5
prism.FirstAngle = 22.5
prism.SecondAngle = 45
prism.SecondAngle = 45
prism.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(60, 75, 30))
}}
<translate>


doc.recompute()
The result will be a new prism with the given attributes.

You can change its placement and orientation with:

</translate>
{{Code|code=
prism.Placement = FreeCAD.Placement(FreeCAD.Vector(2, 4, 6), FreeCAD.Rotation(30, 45, 10))
}}
}}
<translate>
<translate>


The Part Prism with the values of the scripting example looks like:

[[File:Part Prism Scripting Example.png|thumb|left|Part Prism with the values of the scripting example.]]


<!--T:11-->
<!--T:11-->
Line 110: Line 120:


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

Latest revision as of 15:41, 20 May 2023

Part Prism

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

Description

A Part Prism is a parametric solid that can be created with the Part Primitives command. It is the result of extruding a regular polygon along a straight path. In the coordinate system defined by its DataPlacement property, the bottom face of the prism 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 Prism from the scripting example

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

Properties

See also: Property editor.

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

Prism

  • 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.
  • DataHeight (Length): The height of the prism. The default is 10mm.
  • DataFirst Angle (Angle): The angle between the extrusion direction of the prism and its positive Z axis, measured around its Y axis. The angle is positive towards its positive X axis. Valid range: 0° <= value < 90°. The default is .
  • DataSecond Angle (Angle): The angle between the extrusion direction of the prism and its positive Z axis, measured around its X axis. The angle is positive towards its positive Y axis. Valid range: 0° <= value < 90°. The default is .

Scripting

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

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

prism = FreeCAD.ActiveDocument.addObject("Part::Prism", "myPrism")
  • Where "myPrism" is the name for the object.
  • The function returns the newly created object.

Example:

import FreeCAD as App

doc = App.activeDocument()

prism = doc.addObject("Part::Prism", "myPrism")
prism.Polygon = 5
prism.Circumradius = 10
prism.Height = 50
prism.FirstAngle = 22.5
prism.SecondAngle = 45
prism.Placement = App.Placement(App.Vector(1, 2, 3), App.Rotation(60, 75, 30))

doc.recompute()