| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | """Provides the object code for the Fillet object.""" |
| | |
| | |
| | |
| |
|
| | |
| | |
| | from PySide.QtCore import QT_TRANSLATE_NOOP |
| |
|
| | import FreeCAD as App |
| | from draftobjects.base import DraftObject |
| | from draftutils import gui_utils |
| |
|
| |
|
| | class Fillet(DraftObject): |
| | """Proxy class for the Fillet object.""" |
| |
|
| | def __init__(self, obj): |
| | super().__init__(obj, "Fillet") |
| | self._set_properties(obj) |
| |
|
| | def onDocumentRestored(self, obj): |
| | super().onDocumentRestored(obj) |
| | gui_utils.restore_view_object(obj, vp_module="view_fillet", vp_class="ViewProviderFillet") |
| |
|
| | def _set_properties(self, obj): |
| | """Set the properties of objects if they don't exist.""" |
| | if not hasattr(obj, "Start"): |
| | _tip = QT_TRANSLATE_NOOP("App::Property", "The start point of this line.") |
| | obj.addProperty("App::PropertyVectorDistance", "Start", "Draft", _tip, locked=True) |
| | obj.Start = App.Vector(0, 0, 0) |
| |
|
| | if not hasattr(obj, "End"): |
| | _tip = QT_TRANSLATE_NOOP("App::Property", "The end point of this line.") |
| | obj.addProperty("App::PropertyVectorDistance", "End", "Draft", _tip, locked=True) |
| | obj.End = App.Vector(0, 0, 0) |
| |
|
| | if not hasattr(obj, "Length"): |
| | _tip = QT_TRANSLATE_NOOP("App::Property", "The length of this line.") |
| | obj.addProperty("App::PropertyLength", "Length", "Draft", _tip, locked=True) |
| | obj.Length = 0 |
| |
|
| | if not hasattr(obj, "FilletRadius"): |
| | _tip = QT_TRANSLATE_NOOP("App::Property", "Radius to use to fillet the corner.") |
| | obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip, locked=True) |
| | obj.FilletRadius = 0 |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | obj.setEditorMode("Start", 1) |
| | obj.setEditorMode("End", 1) |
| | obj.setEditorMode("Length", 1) |
| | obj.setEditorMode("FilletRadius", 1) |
| | |
| | |
| |
|
| | def execute(self, obj): |
| | """Run when the object is created or recomputed.""" |
| | if hasattr(obj, "Length"): |
| | obj.Length = obj.Shape.Length |
| | if hasattr(obj, "Start"): |
| | obj.Start = obj.Shape.Vertexes[0].Point |
| | if hasattr(obj, "End"): |
| | obj.End = obj.Shape.Vertexes[-1].Point |
| |
|
| | def _update_radius(self, obj, radius): |
| | |
| | |
| | |
| | pass |
| |
|
| | def onChanged(self, obj, prop): |
| | """Change the radius of fillet. NOT IMPLEMENTED. |
| | |
| | This should automatically recalculate the new fillet |
| | based on the new value of `FilletRadius`. |
| | """ |
| | if prop in "FilletRadius": |
| | self._update_radius(obj, obj.FilletRadius) |
| |
|
| |
|
| | |
| |
|