Browse Source

anotation grouping : various fix

pull/2/head
Andréas Livet 2 years ago
parent
commit
90f3402437
  1. 18
      ahb_cmd_view_annotate.py
  2. 6
      ahb_techdraw_extensions.py

18
ahb_cmd_view_annotate.py

@ -12,7 +12,7 @@ class AHB_View_Annotate:
} }
def IsActive(self): def IsActive(self):
return ahb_utils.getCurrentView() is not None return True
def Activated(self): def Activated(self):
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
@ -70,13 +70,15 @@ class AHB_View_Annotate:
doc.removeObject(balloon.Name) doc.removeObject(balloon.Name)
for partLink in view.XSource: for partLink in view.XSource:
workbench.techDrawExtensions.add_or_update_balloon(view, partLink, '') balloonsCreated = workbench.techDrawExtensions.add_or_update_balloon(view, partLink, '')
if len(balloonsCreated) > 0:
regroupedBalloons = self.RegroupNearestSimilarBalloons(balloonsCreated)
self.PlaceBalloonsInCircle(regroupedBalloons)
#self.PlaceBalloonsInCircle(balloonsCreated)
workbench.techDrawExtensions.refreshOverlays(page) workbench.techDrawExtensions.refreshOverlays(page)
regroupedBalloons = self.RegroupNearestSimilarBalloons(balloonsCreated)
self.PlaceBalloonsInCircle(regroupedBalloons)
def CalculatePointsCenter(self, balloons): def CalculatePointsCenter(self, balloons):
totalX = 0 totalX = 0
totalY = 0 totalY = 0
@ -115,7 +117,9 @@ class AHB_View_Annotate:
nbBalloons = len(balloons) nbBalloons = len(balloons)
balloonPosStep = (math.pi * 2) / nbBalloons balloonPosStep = (math.pi * 2) / nbBalloons
for i in range(nbBalloons): for i in range(nbBalloons):
balloonPos = App.Base.Vector2d(center.x + 600 * math.cos(balloonPosStep * i), center.y + 600 * math.sin(balloonPosStep * i)) xPos = round(center.x + 600 * math.cos(balloonPosStep * i))
yPos = round(center.y + 600 * math.sin(balloonPosStep * i))
balloonPos = App.Base.Vector2d(xPos, yPos)
# Find nearest arrow to avoid arrow crossing each other # Find nearest arrow to avoid arrow crossing each other
smallestDistance = 0 smallestDistance = 0
balloonToUse = None balloonToUse = None

6
ahb_techdraw_extensions.py

@ -499,12 +499,14 @@ class TechDrawExtensions:
self.updateBalloon(balloon) self.updateBalloon(balloon)
balloonsCreated.append(balloon)
if not self.isNewPartInView(view, part): if not self.isNewPartInView(view, part):
balloon.ViewObject.Visibility = False balloon.ViewObject.Visibility = False
else:
balloonsCreated.append(balloon)
else: else:
self.updateBalloon(balloon) self.updateBalloon(balloon)
return balloonsCreated
def updateBalloon(self, balloon): def updateBalloon(self, balloon):
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench

Loading…
Cancel
Save