|
|
@ -95,7 +95,7 @@ class TechDrawExtensions: |
|
|
|
|
|
|
|
|
|
|
|
selected_balloons = [] |
|
|
|
selected_balloons = [] |
|
|
|
for obj in Gui.Selection.getSelection(): |
|
|
|
for obj in Gui.Selection.getSelection(): |
|
|
|
if obj.TypeId == 'TechDraw::DrawViewBalloon' and obj.SourceView == view and 'Assembly_handbook_PartName' in obj.PropertiesList: |
|
|
|
if obj.TypeId == 'TechDraw::DrawViewBalloon' and obj.SourceView == view and 'Assembly_handbook_Source' in obj.PropertiesList: |
|
|
|
selected_balloons.append(obj) |
|
|
|
selected_balloons.append(obj) |
|
|
|
|
|
|
|
|
|
|
|
is_first_part = True |
|
|
|
is_first_part = True |
|
|
@ -105,7 +105,7 @@ class TechDrawExtensions: |
|
|
|
# repaint parts that are highlighted by selection |
|
|
|
# repaint parts that are highlighted by selection |
|
|
|
if self.enable_selected_part_highlight: |
|
|
|
if self.enable_selected_part_highlight: |
|
|
|
for balloon in selected_balloons: |
|
|
|
for balloon in selected_balloons: |
|
|
|
part = doc.getObject(balloon.Assembly_handbook_PartName) |
|
|
|
part = self.getBalloonSourcePart(balloon) |
|
|
|
if part in view.XSource: |
|
|
|
if part in view.XSource: |
|
|
|
parts_to_paint.append(part) |
|
|
|
parts_to_paint.append(part) |
|
|
|
|
|
|
|
|
|
|
@ -139,7 +139,7 @@ class TechDrawExtensions: |
|
|
|
|
|
|
|
|
|
|
|
if self.enable_selected_part_highlight: |
|
|
|
if self.enable_selected_part_highlight: |
|
|
|
for balloon in selected_balloons: |
|
|
|
for balloon in selected_balloons: |
|
|
|
if part.Name == balloon.Assembly_handbook_PartName: |
|
|
|
if part == self.getBalloonSourcePart(balloon): |
|
|
|
color = (0.0, 0.85, 0.0) # selection highlighting |
|
|
|
color = (0.0, 0.85, 0.0) # selection highlighting |
|
|
|
|
|
|
|
|
|
|
|
# iterate edges of actual view and highlight matching edges |
|
|
|
# iterate edges of actual view and highlight matching edges |
|
|
@ -186,7 +186,7 @@ class TechDrawExtensions: |
|
|
|
def updateBalloonCursor(self, view): |
|
|
|
def updateBalloonCursor(self, view): |
|
|
|
selected_balloons = [] |
|
|
|
selected_balloons = [] |
|
|
|
for obj in Gui.Selection.getSelection(): |
|
|
|
for obj in Gui.Selection.getSelection(): |
|
|
|
if obj.TypeId == 'TechDraw::DrawViewBalloon' and obj.SourceView == view and 'Assembly_handbook_PartName' in obj.PropertiesList: |
|
|
|
if obj.TypeId == 'TechDraw::DrawViewBalloon' and obj.SourceView == view and 'Assembly_handbook_Source' in obj.PropertiesList: |
|
|
|
selected_balloons.append(obj) |
|
|
|
selected_balloons.append(obj) |
|
|
|
|
|
|
|
|
|
|
|
cursor = self.view_cursors.get(view, None) |
|
|
|
cursor = self.view_cursors.get(view, None) |
|
|
@ -223,8 +223,8 @@ class TechDrawExtensions: |
|
|
|
doc = view.Document |
|
|
|
doc = view.Document |
|
|
|
page = self.getViewPage(view) |
|
|
|
page = self.getViewPage(view) |
|
|
|
for balloon in page.Views: |
|
|
|
for balloon in page.Views: |
|
|
|
if balloon.TypeId == 'TechDraw::DrawViewBalloon' and "Assembly_handbook_PartName" in balloon.PropertiesList and balloon.SourceView == view: |
|
|
|
if balloon.TypeId == 'TechDraw::DrawViewBalloon' and "Assembly_handbook_Source" in balloon.PropertiesList and balloon.SourceView == view: |
|
|
|
obj = doc.getObject(balloon.Assembly_handbook_PartName) |
|
|
|
obj = self.getBalloonSourcePart(balloon) |
|
|
|
balloonColor = (0.0, 0.0, 0.0) |
|
|
|
balloonColor = (0.0, 0.0, 0.0) |
|
|
|
if obj is None or not obj in view.XSource: |
|
|
|
if obj is None or not obj in view.XSource: |
|
|
|
balloonColor = (1.0, 0.0, 0.0) |
|
|
|
balloonColor = (1.0, 0.0, 0.0) |
|
|
@ -289,13 +289,13 @@ class TechDrawExtensions: |
|
|
|
def onCursorMoved(self, view, new_pos): |
|
|
|
def onCursorMoved(self, view, new_pos): |
|
|
|
if len(Gui.Selection.getSelection()) == 0: return |
|
|
|
if len(Gui.Selection.getSelection()) == 0: return |
|
|
|
balloon = Gui.Selection.getSelection()[0] |
|
|
|
balloon = Gui.Selection.getSelection()[0] |
|
|
|
if balloon.TypeId != 'TechDraw::DrawViewBalloon' or not 'Assembly_handbook_PartName' in balloon.PropertiesList: return |
|
|
|
if balloon.TypeId != 'TechDraw::DrawViewBalloon' or not 'Assembly_handbook_Source' in balloon.PropertiesList: return |
|
|
|
if balloon.SourceView != view: return |
|
|
|
if balloon.SourceView != view: return |
|
|
|
|
|
|
|
|
|
|
|
balloon.OriginX = new_pos.x |
|
|
|
balloon.OriginX = new_pos.x |
|
|
|
balloon.OriginY = new_pos.y |
|
|
|
balloon.OriginY = new_pos.y |
|
|
|
|
|
|
|
|
|
|
|
obj = balloon.Document.getObject(balloon.Assembly_handbook_PartName) |
|
|
|
obj = self.getBalloonSourcePart(balloon) |
|
|
|
view = balloon.SourceView |
|
|
|
view = balloon.SourceView |
|
|
|
center = self.computePartCenter(view, obj) |
|
|
|
center = self.computePartCenter(view, obj) |
|
|
|
|
|
|
|
|
|
|
@ -304,7 +304,7 @@ class TechDrawExtensions: |
|
|
|
|
|
|
|
|
|
|
|
def onBalloonSelected(self, operation, balloon, sub, point): |
|
|
|
def onBalloonSelected(self, operation, balloon, sub, point): |
|
|
|
#print(operation, obj.Name, sub, point) |
|
|
|
#print(operation, obj.Name, sub, point) |
|
|
|
if "Assembly_handbook_PartName" in balloon.PropertiesList: |
|
|
|
if 'Assembly_handbook_Source' in balloon.PropertiesList: |
|
|
|
#print(operation + " " + balloon.Name) |
|
|
|
#print(operation + " " + balloon.Name) |
|
|
|
view = balloon.SourceView |
|
|
|
view = balloon.SourceView |
|
|
|
self.updateBalloonCursor(view) |
|
|
|
self.updateBalloonCursor(view) |
|
|
@ -317,7 +317,7 @@ class TechDrawExtensions: |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
#print('Balloon changed: ' + obj.Name + '.' + prop) |
|
|
|
#print('Balloon changed: ' + obj.Name + '.' + prop) |
|
|
|
if prop == 'Y' and "Assembly_handbook_PartName" in obj.PropertiesList: |
|
|
|
if prop == 'Y' and 'Assembly_handbook_Source' in obj.PropertiesList: |
|
|
|
self.updating_balloon = True |
|
|
|
self.updating_balloon = True |
|
|
|
self.updateBalloon(obj) |
|
|
|
self.updateBalloon(obj) |
|
|
|
self.updating_balloon = False |
|
|
|
self.updating_balloon = False |
|
|
@ -326,8 +326,7 @@ class TechDrawExtensions: |
|
|
|
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench |
|
|
|
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench |
|
|
|
|
|
|
|
|
|
|
|
view = balloon.SourceView |
|
|
|
view = balloon.SourceView |
|
|
|
doc = view.Document |
|
|
|
obj = self.getBalloonSourcePart(balloon) |
|
|
|
obj = doc.getObject(balloon.Assembly_handbook_PartName) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
partDisplayName = self.getPartDisplayName(obj) |
|
|
|
partDisplayName = self.getPartDisplayName(obj) |
|
|
|
|
|
|
|
|
|
|
@ -342,6 +341,12 @@ class TechDrawExtensions: |
|
|
|
balloon.BubbleShape = 'Inspection' |
|
|
|
balloon.BubbleShape = 'Inspection' |
|
|
|
balloon.EndTypeScale = 4 |
|
|
|
balloon.EndTypeScale = 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getBalloonSourcePart(self, balloon): |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
return balloon.Assembly_handbook_Source[0] |
|
|
|
|
|
|
|
except: |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
def isPartLink(self, obj): |
|
|
|
def isPartLink(self, obj): |
|
|
|
if obj.TypeId == 'App::Link': |
|
|
|
if obj.TypeId == 'App::Link': |
|
|
|
return True |
|
|
|
return True |
|
|
|