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