| 1 |
from DocumentObject import DocumentObject |
| 2 |
from Base import Placement |
| 3 |
from typing import Any, Final, Optional |
| 4 |
|
| 5 |
|
| 6 |
class GeoFeature(DocumentObject): |
| 7 |
""" |
| 8 |
App.GeoFeature class. |
| 9 |
|
| 10 |
Base class of all geometric document objects. |
| 11 |
This class does the whole placement and position handling. |
| 12 |
With the method `getPropertyOfGeometry` is possible to obtain |
| 13 |
the main geometric property in general form, without reference |
| 14 |
to any particular property name. |
| 15 |
""" |
| 16 |
|
| 17 |
ElementMapVersion: Final[str] = "" |
| 18 |
"""Element map version""" |
| 19 |
|
| 20 |
def getPaths(self) -> Any: |
| 21 |
""" |
| 22 |
getPaths() |
| 23 |
|
| 24 |
Returns all possible paths to the root of the document. |
| 25 |
Note: Not implemented. |
| 26 |
""" |
| 27 |
... |
| 28 |
|
| 29 |
def getGlobalPlacement(self) -> Placement: |
| 30 |
""" |
| 31 |
getGlobalPlacement() -> Base.Placement |
| 32 |
Deprecated: This function does not handle Links correctly. Use getGlobalPlacementOf instead. |
| 33 |
|
| 34 |
Returns the placement of the object in the global coordinate space, respecting all stacked |
| 35 |
relationships. |
| 36 |
Note: This function is not available during recompute, as there the placements of parents |
| 37 |
can change after the execution of this object, rendering the result wrong. |
| 38 |
""" |
| 39 |
... |
| 40 |
|
| 41 |
@staticmethod |
| 42 |
def getGlobalPlacementOf(targetObj: Any, rootObj: Any, subname: str) -> Placement: |
| 43 |
""" |
| 44 |
getGlobalPlacementOf(targetObj, rootObj, subname) -> Base.Placement |
| 45 |
Selection example: obj = "part1" sub = "linkToPart2.LinkToBody.Pad.face1" |
| 46 |
|
| 47 |
Global placement of Pad in this context : |
| 48 |
getGlobalPlacementOf(pad, part1, "linkToPart2.LinkToBody.Pad.face1") |
| 49 |
|
| 50 |
Global placement of linkToPart2 in this context : |
| 51 |
getGlobalPlacementOf(linkToPart2, part1, "linkToPart2.LinkToBody.Pad.face1") |
| 52 |
|
| 53 |
Returns the placement of the object in the global coordinate space, respecting all stacked |
| 54 |
relationships. |
| 55 |
""" |
| 56 |
... |
| 57 |
|
| 58 |
def getPropertyNameOfGeometry(self) -> Optional[str]: |
| 59 |
""" |
| 60 |
getPropertyNameOfGeometry() -> str or None |
| 61 |
|
| 62 |
Returns the property name of the actual geometry. |
| 63 |
For example for a Part feature it returns the value 'Shape', for a mesh feature the value |
| 64 |
'Mesh' and so on. |
| 65 |
If an object has no such property then None is returned. |
| 66 |
""" |
| 67 |
... |
| 68 |
|
| 69 |
def getPropertyOfGeometry(self) -> Optional[Any]: |
| 70 |
""" |
| 71 |
getPropertyOfGeometry() -> object or None |
| 72 |
|
| 73 |
Returns the property of the actual geometry. |
| 74 |
For example for a Part feature it returns its Shape property, for a Mesh feature its |
| 75 |
Mesh property and so on. |
| 76 |
If an object has no such property then None is returned. |
| 77 |
Unlike to getPropertyNameOfGeometry this function returns the geometry, not its name. |
| 78 |
""" |
| 79 |
... |