The Polygon module
PR 42193 Parametric developers can now specify a custom polygon line snap mode for Locator3D via Locator3D.SetCurrentSnapONPL(polylist). For example:
import Locator
from Point3D import Point3D
import Polygon
from sds2.iterators import all_mtsdef get_poly():
return Polygon.PolyList(next(all_mts()).poly)def acquire(locator, poly):
locator.SetCurrentSnapONPL(poly)
locator.SetAnchorGlobal(poly.snapshotSide(0, 0).location)
pt = Point3D()
with Polygon.Preview(poly):
return locator.AcquireShowPoint(pt), ptdef main():
l = Locator.Locator3D()
l.SetDefaults()
acquire(l, get_poly())if __name__ == '__main__':
main()
(v2017)
To get help on the Polygon module, you can use the built-in Python function help() :
SDS2 Python Prompt SDS2 Interactive Python Prompt
>>> import Polygon # import the module
>>> help(Polygon) # get help
Help on built-in module Polygon:NAME
PolygonFILE
(built-in)CLASSES
Boost.Python.instance(__builtin__.object)
PolyList
PolygonBuilder
PolygonFace
PolygonSide
Preview
class PolyList(Boost.Python.instance)
| Method resolution order:
| PolyList
| Boost.Python.instance
| __builtin__.object
|
| Methods defined here:
|
| __copy__(...)
| __copy__( (object)arg1) -> object
|
| __deepcopy__(...)
| __deepcopy__( (object)arg1, (dict)arg2) -> object
|
| __eq__(...)
| __eq__( (object)arg1, (object)arg2) -> bool
|
| __getinitargs__(...)
| __getinitargs__( (PolyList)arg1) -> tuple
|
| __hash__(...)
| __hash__( (object)arg1) -> None
|
| __init__(...)
| __init__( (object)arg1) -> None
|
| __init__( (object)arg1, (PolyList)arg2) -> None
|
| __init__( (object)arg1, (list)arg2) -> None
|
| __ne__(...)
| __ne__( (object)arg1, (object)arg2) -> bool
|
| __reduce__ = <unnamed Boost.Python function>(...)
|
| __repr__(...)
| __repr__( (PolyList)arg1) -> object
|
| __str__(...)
| __str__( (PolyList)arg1) -> object
|
| compute_polygon_area(...)
| compute_polygon_area( (PolyList)arg1, (int)arg2) -> float
|
| compute_surface_area(...)
| compute_surface_area( (PolyList)arg1) -> float
|
| compute_volume_and_center_of_mass(...)
| compute_volume_and_center_of_mass( (PolyList)arg1) -> tuple
|
| fit(...)
| fit( (PolyList)arg1, (PolyList)fit_poly [, (float)clear=0.0 [, (int)cut_op=6 [, (bool)grating=False [, (int)fit_type=0 [, (bool)check_closed_shape=True]]]]]) -> None
|
| fuse(...)
| fuse( (PolyList)arg1, (PolyList)cut_poly) -> None
|
| numSides(...)
| numSides( (PolyList)arg1, (int)face) -> int
|
| pointOnFace(...)
| pointOnFace( (PolyList)arg1, (Point3D)arg2, (int)point) -> bool
|
| set_rad_on_interior_edges(...)
| set_rad_on_interior_edges( (PolyList)arg1) -> None
|
| set_rad_on_interior_edges( (PolyList)arg1, (float)arg2) -> None
|
| snapshot(...)
| snapshot( (PolyList)arg1) -> list
|
| snapshotFace(...)
| snapshotFace( (PolyList)arg1, (int)face) -> PolygonFace
|
| snapshotSide(...)
| snapshotSide( (PolyList)arg1, (int)arg2, (int)face) -> PolygonSide
|
| transform(...)
| transform( (PolyList)arg1, (Transform3D)xform) -> None
|
| triangulated(...)
| triangulated( (PolyList)arg1) -> PolyList
|
| update_geometry(...)
| update_geometry( (PolyList)arg1) -> None # cut off to save space