forked from youen/assembly_handbook
anotation grouping : various fix
This commit is contained in:
parent
1652f32504
commit
90f3402437
@ -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
|
||||
|
@ -499,12 +499,14 @@ class TechDrawExtensions:
|
||||
|
||||
self.updateBalloon(balloon)
|
||||
|
||||
balloonsCreated.append(balloon)
|
||||
|
||||
if not self.isNewPartInView(view, part):
|
||||
balloon.ViewObject.Visibility = False
|
||||
else:
|
||||
balloonsCreated.append(balloon)
|
||||
else:
|
||||
self.updateBalloon(balloon)
|
||||
|
||||
return balloonsCreated
|
||||
|
||||
def updateBalloon(self, balloon):
|
||||
workbench = Gui.getWorkbench("AssemblyHandbookWorkbench") #: :type workbench: AssemblyHandbookWorkbench
|
||||
|
Loading…
Reference in New Issue
Block a user