Browse Source

Added code to highlight in red balloons that reference parts not drawn in the view

master
Youen 2 years ago
parent
commit
85fa12e301
  1. 2
      ahb_cmd_view_annotate.py
  2. 20
      ahb_techdraw_extensions.py

2
ahb_cmd_view_annotate.py

@ -3,7 +3,7 @@ import FreeCAD as App
class AHB_View_Annotate: class AHB_View_Annotate:
def GetResources(self): def GetResources(self):
return {"MenuText": "View/Annotate", return {"MenuText": "Annotate view",
"ToolTip": "Annotates a TechDraw view with object names", "ToolTip": "Annotates a TechDraw view with object names",
"Pixmap": "" "Pixmap": ""
} }

20
ahb_techdraw_extensions.py

@ -150,6 +150,18 @@ class TechDrawExtensions:
cursor.setViewPos(App.Vector(selected_balloons[0].OriginX, selected_balloons[0].OriginY)) cursor.setViewPos(App.Vector(selected_balloons[0].OriginX, selected_balloons[0].OriginY))
cursor.setVisible(True) cursor.setVisible(True)
def refreshView(self, view):
doc = view.Document
page = self.getViewPage(view)
for balloon in page.Views:
if balloon.TypeId == 'TechDraw::DrawViewBalloon' and "Assembly_handbook_PartName" in balloon.PropertiesList and balloon.SourceView == view:
obj = doc.getObject(balloon.Assembly_handbook_PartName)
balloonColor = (0.0, 0.0, 0.0)
if obj is None or not obj in view.XSource:
balloonColor = (1.0, 0.0, 0.0)
balloon.ViewObject.Color = balloonColor
def toggleEditViewSourceParts(self, view): def toggleEditViewSourceParts(self, view):
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
@ -272,8 +284,16 @@ class TechDrawExtensions:
return None return None
def forceRedrawPage(self, page, callback = None): def forceRedrawPage(self, page, callback = None):
for view in page.Views:
if view.TypeId == 'TechDraw::DrawViewPart' and 'Assembly_handbook_PreviousStepView' in view.PropertiesList:
self.refreshView(view)
if page.KeepUpdated: if page.KeepUpdated:
for view in page.Views: for view in page.Views:
if view.TypeId != 'TechDraw::DrawViewPart':
view.recompute()
for view in page.Views:
if view.TypeId == 'TechDraw::DrawViewPart':
view.recompute() view.recompute()
if callback is not None: if callback is not None:
callback() callback()

Loading…
Cancel
Save