The Locator module
PR 27254 Locator3D.SetAnchor() again takes a point in show coordinates rather than global coordinates. New functions are available to make the coordinate system explicit: SetAnchorShow(), SetAnchorGlobal(), GetAnchorShow(), GetAnchorGlobal(). Material chamfer point location now shows rubberband lines from the correct location. (v7.3)
PR 41768 Added ability for the Python API to provide custom annotations during point location via overloading OnBestAnnotatePoint3D and OnBestUnAnnotatePoint3D on derived classes of Locator.Locator3DBase. (v2017)
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)Here's an example of a script that you can Run .
# Defines and calls a function called main() for locating two points
from Locator import Locator3D from Point3D import Point3D from Transform3D import ShowTransform
def main(): # defines the function |
To get help on the Locator module , you can use the built-in Python functions dir() and help() :
SDS2 Python Prompt >>> import Locator # import the module
>>>
>>> dir(Locator) # do a dir() on the module name
['Button', 'Locator3D', '__doc__', '__name__', '__package__']
>>>
>>> help(Locator.Locator3D) # get help on class Locator3D
Help on class Locator3D in module Locator:class Locator3D(Boost.Python.instance)
| Method resolution order:
| Locator3D
| Boost.Python.instance
| __builtin__.object
|
| Methods defined here:
|
| AcquireGlobalPoint(...) # help on AcquireGlobalPoint
| C++ signature:
| AcquireGlobalPoint(Locator3D {lvalue}, Point3D {lvalue}) -> bool
|
| AcquireShowPoint(...) # help on AcquireShowPoint
| C++ signature:
| AcquireShowPoint(Locator3D {lvalue}, Point3D {lvalue}) -> bool
|
| AddStandardModes(...) # help on AddStandardModes
| C++ signature:
| AddStandardModes(Locator3D {lvalue}) -> void*
|
| ClearAnchor(...) # help on ClearAnchor
| C++ signature:
| ClearAnchor(Locator3D {lvalue}) -> void*
|
| ClearBindings(...) # help on ClearBindings
| C++ signature:
| ClearBindings(Locator3D {lvalue}) -> void*
|
| GetAnchor(...) # help on GetAnchor
| C++ signature:
| GetAnchor(Locator3D {lvalue}) -> Point3D
|
| GetAnchorGlobal(...) # help on GetAnchorGlobal
| C++ signature:
| GetAnchorGlobal(Locator3D {lvalue}) -> Point3D
|
| GetAnchorShow(...) # help on GetAnchorShow
| C++ signature:
| GetAnchorShow(Locator3D {lvalue}) -> Point3D
|
| GetButton(...) # help on GetButton
| C++ signature:
| GetButton(Locator3D {lvalue}) -> SDS2::Gui::Button::Type
|
| GetCurrentSnap(...) # help on GetCurrentSnap
| C++ signature:
| GetCurrentSnap(Locator3D {lvalue}) -> std::string
|
| GetCursor(...) # help on GetCursor
| C++ signature:
| GetCursor(Locator3D {lvalue}) -> int
|
| GetPrompt(...) # help on GetPrompt
| C++ signature:
| GetPrompt(Locator3D {lvalue}) -> std::string
|
| ReadPreferences(...) # help on ReadPreferences
| C++ signature:
| ReadPreferences(Locator3D {lvalue}, std::string) -> void*
|
| SetAnchor(...) # help on SetAnchor
| C++ signature:
| SetAnchor(Locator3D {lvalue}, Point3D) -> void*
|
| SetAnchorGlobal(...) # help on SetAnchorGlobal
| C++ signature:
| SetAnchorGlobal(Locator3D {lvalue}, Point3D) -> void*
|
| SetAnchorShow(...) # help on SetAnchorShow
| C++ signature:
| SetAnchorShow(Locator3D {lvalue}, Point3D) -> void*
|
| SetCurrentSnap(...) # help on SetCurrentSnap
| C++ signature:
| SetCurrentSnap(Locator3D {lvalue}, std::string) -> void*
|
| SetCursor(...) # help on SetCursor
| C++ signature:
| SetCursor(Locator3D {lvalue}, int) -> void*
|
| SetDefaults(...) # help on SetDefaults
| C++ signature:
| SetDefaults(Locator3D {lvalue}) -> void*
|
| SetPrompt(...) # help on SetPrompt
| C++ signature:
| SetPrompt(Locator3D {lvalue}, std::string) -> void*
|
| SetRepeatDefaults(...) # help on SetRepeatDefaults
| C++ signature:
| SetRepeatDefaults(Locator3D {lvalue}) -> void*