|
|
@ -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 |
|
|
|