|
|
|
@ -12,7 +12,7 @@ class AHB_View_Annotate:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def IsActive(self): |
|
|
|
|
return ahb_utils.getCurrentView() is not None |
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
def Activated(self): |
|
|
|
|
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench |
|
|
|
@ -70,13 +70,15 @@ class AHB_View_Annotate:
|
|
|
|
|
doc.removeObject(balloon.Name) |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|
regroupedBalloons = self.RegroupNearestSimilarBalloons(balloonsCreated) |
|
|
|
|
self.PlaceBalloonsInCircle(regroupedBalloons) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def CalculatePointsCenter(self, balloons): |
|
|
|
|
totalX = 0 |
|
|
|
|
totalY = 0 |
|
|
|
@ -115,7 +117,9 @@ class AHB_View_Annotate:
|
|
|
|
|
nbBalloons = len(balloons) |
|
|
|
|
balloonPosStep = (math.pi * 2) / 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 |
|
|
|
|
smallestDistance = 0 |
|
|
|
|
balloonToUse = None |
|
|
|
|