Skip to content

Commit

Permalink
Draft: WorkingPlane, Pythonic style, improved the docstring; setup() …
Browse files Browse the repository at this point in the history
…only works when 'FreeCAD.GuiUp' is True, otherwise it fails silently. This should be change to print a message to the console.
  • Loading branch information
vocx-fc authored and yorikvanhavre committed Aug 9, 2019
1 parent 17f39fc commit 5a4ca2a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Mod/Draft/WorkingPlane.py
Expand Up @@ -633,7 +633,36 @@ class is available, that is, when the graphical interface is loaded.
return False

def setup(self, direction=None, point=None, upvec=None):
'''If working plane is undefined, define it!'''
"""Setup the working plane if it exists but is undefined.
If `direction` and `point` are present,
it calls `alignToPointAndAxis(point, direction, 0, upvec)`.
Otherwise, it gets the camera orientation to define
a working plane that is perpendicular to the current view,
centered at the origin, and with `v` pointing up on the screen.
This method only works when the `weak` attribute is `True`.
This method also sets `weak` to `True`.
This method only works when `FreeCAD.GuiUp` is `True`,
that is, when the graphical interface is loaded.
Otherwise it fails silently.
Parameters
----------
direction : Base::Vector3, optional
It defaults to `None`. It is the new `axis` of the plane.
point : Base::Vector3, optional
It defaults to `None`. It is the new `position` of the plane.
upvec : Base::Vector3, optional
It defaults to `None`. It is the new `v` orientation of the plane.
To do
-----
It should fail loudly, with a message at least
`FreeCAD.Console.PrintError()`.
"""
if self.weak:
if direction and point:
self.alignToPointAndAxis(point, direction, 0, upvec)
Expand Down

0 comments on commit 5a4ca2a

Please sign in to comment.