forked from youen/assembly_handbook
Added code to highlight in red balloons that reference parts not drawn in the view
This commit is contained in:
parent
5f2bfc1f6f
commit
85fa12e301
@ -3,7 +3,7 @@ import FreeCAD as App
|
||||
|
||||
class AHB_View_Annotate:
|
||||
def GetResources(self):
|
||||
return {"MenuText": "View/Annotate",
|
||||
return {"MenuText": "Annotate view",
|
||||
"ToolTip": "Annotates a TechDraw view with object names",
|
||||
"Pixmap": ""
|
||||
}
|
||||
|
@ -150,6 +150,18 @@ class TechDrawExtensions:
|
||||
cursor.setViewPos(App.Vector(selected_balloons[0].OriginX, selected_balloons[0].OriginY))
|
||||
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):
|
||||
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
|
||||
|
||||
@ -272,8 +284,16 @@ class TechDrawExtensions:
|
||||
return 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:
|
||||
for view in page.Views:
|
||||
if view.TypeId != 'TechDraw::DrawViewPart':
|
||||
view.recompute()
|
||||
for view in page.Views:
|
||||
if view.TypeId == 'TechDraw::DrawViewPart':
|
||||
view.recompute()
|
||||
if callback is not None:
|
||||
callback()
|
||||
|
Loading…
Reference in New Issue
Block a user