Part Sphere: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(→‎Scripting: and better explanation of the axis definition.)
Line 42: Line 42:
<!--T:32-->
<!--T:32-->
The properties of the object can be edited, either in the [[Property_editor|Property editor]] or by double-clicking the object in the [[Tree_view|Tree view]].
The properties of the object can be edited, either in the [[Property_editor|Property editor]] or by double-clicking the object in the [[Tree_view|Tree view]].

== Notes ==

It is difficult to understand the meaning of the three angles.

A full filled sphere is defined by:

* Angle 1 = -90°
* Angle 2 = 90°
* Angle 3 = 360°

If you increase or decrease these values, you will get a parted sphere.

Angle 1 is defined as the angle between the x and z axis. 0° is equal to the x axis. Negative values are equal to the -z direction.

Angle 2 is defined as the angle between the y and z axis. 0° is equal to the y axis. Positive values are equal to the z direction.

Angle 3 is defined as the angle between the x and y axis. 0° is equal to the x axis. The angle rotation is counterclockwise.


== Properties== <!--T:4-->
== Properties== <!--T:4-->
Line 52: Line 70:
<!--T:33-->
<!--T:33-->
* {{PropertyData|Radius:}} Radius of the sphere
* {{PropertyData|Radius:}} Radius of the sphere
* {{PropertyData|Angle 1:}} 1nd angle to cut / define the sphere
* {{PropertyData|Angle 1:}} 1st angle to cut / define the sphere (angle between xz axis)
* {{PropertyData|Angle 2:}} 2nd angle to cut / define the sphere
* {{PropertyData|Angle 2:}} 2nd angle to cut / define the sphere (angle between yz axis)
* {{PropertyData|Angle 3:}} 3rd angle to cut / define the sphere
* {{PropertyData|Angle 3:}} 3rd angle to cut / define the sphere (angle between xy axis)


<!--T:23-->
<!--T:23-->
Line 62: Line 80:
[[File:SphereCutThreeAngles.jpg|400px]]
[[File:SphereCutThreeAngles.jpg|400px]]
<translate>
<translate>

== Limitations ==

If the Angle 1 and Angle 2 values are 'critical' (e.g. both have a value of 45°), the sphere cutoffs are overlapping and the result is invisible.


== Scripting == <!--T:38-->
== Scripting == <!--T:38-->
Line 77: Line 99:
* Where {{Incode|"mySphere"}} is the name for the object.
* Where {{Incode|"mySphere"}} is the name for the object.
* The function returns the newly created object.
* The function returns the newly created object.

You can access and modify attributes of the {{Incode|sphere}} object.

The name of the object can be easily changed by

</translate>
{{Code|code=
sphere.Label = "new sphereName"
}}
<translate>

For example, you may wish to modify the radius or the three angles of the sphere.

</translate>
{{Code|code=
sphere.Radius = 5
sphere.Angle1 = 45°
sphere.Angle1 = 15°
sphere.Angle1 = 30°
}}
<translate>

The result will be a part of a sphere, that looks like a piece of cake.

You can change its placement and orientation with:

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





Revision as of 05:44, 10 February 2022

Part Sphere

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

Description

Creates a simple parametric sphere, with position, angle1, angle2, angle3 and radius parameters.

Usage

  1. Switch to the Part Workbench
  2. There are several ways to invoke the command:
    • Press the Sphere button in the toolbar.
    • Select the Part → Primitives → Sphere from the menu bar.

Result: The sphere will be positioned at origin (point 0,0,0) on creation. The angle parameters permit to make a portion of sphere instead of a full sphere (they are set to 360° by default).

The properties of the object can be edited, either in the Property editor or by double-clicking the object in the Tree view.

Notes

It is difficult to understand the meaning of the three angles.

A full filled sphere is defined by:

  • Angle 1 = -90°
  • Angle 2 = 90°
  • Angle 3 = 360°

If you increase or decrease these values, you will get a parted sphere.

Angle 1 is defined as the angle between the x and z axis. 0° is equal to the x axis. Negative values are equal to the -z direction.

Angle 2 is defined as the angle between the y and z axis. 0° is equal to the y axis. Positive values are equal to the z direction.

Angle 3 is defined as the angle between the x and y axis. 0° is equal to the x axis. The angle rotation is counterclockwise.

Properties

Data

Sphere

  • DataRadius: Radius of the sphere
  • DataAngle 1: 1st angle to cut / define the sphere (angle between xz axis)
  • DataAngle 2: 2nd angle to cut / define the sphere (angle between yz axis)
  • DataAngle 3: 3rd angle to cut / define the sphere (angle between xy axis)

Because it is quite difficult to explain the meaning of the parameters angle 1, angle 2, angle 3, the picture below gives an explanation about these parameters with following values: angle 1 = -45°, angle 2 = 45° and angle 3= 90°.

Limitations

If the Angle 1 and Angle 2 values are 'critical' (e.g. both have a value of 45°), the sphere cutoffs are overlapping and the result is invisible.

Scripting

A Part Sphere can be created using the following function:

sphere = FreeCAD.ActiveDocument.addObject("Part::Sphere", "mySphere")
  • Where "mySphere" is the name for the object.
  • The function returns the newly created object.

You can access and modify attributes of the sphere object.

The name of the object can be easily changed by

sphere.Label = "new sphereName"

For example, you may wish to modify the radius or the three angles of the sphere.

sphere.Radius = 5
sphere.Angle1 = 45°
sphere.Angle1 = 15°
sphere.Angle1 = 30°

The result will be a part of a sphere, that looks like a piece of cake.

You can change its placement and orientation with:

sphere.Placement = FreeCAD.Placement(FreeCAD.Vector(2, 4, 6), FreeCAD.Rotation(30, 45, 10))