|
|
@ -1,5 +1,20 @@ |
|
|
|
|
|
|
|
import FreeCADGui as Gui |
|
|
|
|
|
|
|
import FreeCAD as App |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AHB_View_Annotate: |
|
|
|
|
|
|
|
def GetResources(self): |
|
|
|
|
|
|
|
return {"MenuText": "View/Annotate", |
|
|
|
|
|
|
|
"ToolTip": "Annotates a TechDraw view with object names", |
|
|
|
|
|
|
|
"Pixmap": "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def IsActive(self): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Activated(self): |
|
|
|
doc = App.activeDocument() |
|
|
|
doc = App.activeDocument() |
|
|
|
view = doc.getObject('View') |
|
|
|
page = doc.getObject('Page') |
|
|
|
|
|
|
|
view = page.Views[0] |
|
|
|
|
|
|
|
|
|
|
|
if len(Gui.Selection.getSelection()) != 1: |
|
|
|
if len(Gui.Selection.getSelection()) != 1: |
|
|
|
raise Exception("Veuillez sélectionner exactement un objet") |
|
|
|
raise Exception("Veuillez sélectionner exactement un objet") |
|
|
@ -14,4 +29,14 @@ objectCenterView = vert.Point |
|
|
|
view.removeCosmeticVertex(vertId) |
|
|
|
view.removeCosmeticVertex(vertId) |
|
|
|
|
|
|
|
|
|
|
|
# Create Balloon |
|
|
|
# Create Balloon |
|
|
|
|
|
|
|
balloon = App.ActiveDocument.addObject("TechDraw::DrawViewBalloon", "Balloon") |
|
|
|
|
|
|
|
balloon.SourceView = view |
|
|
|
|
|
|
|
balloon.OriginX = objectCenterView.x |
|
|
|
|
|
|
|
balloon.OriginY = objectCenterView.y |
|
|
|
|
|
|
|
balloon.Text = "1" |
|
|
|
|
|
|
|
balloon.Y = objectCenterView.x + 20 |
|
|
|
|
|
|
|
balloon.X = objectCenterView.y + 20 |
|
|
|
|
|
|
|
page.addView(balloon) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ahb_command import AHB_CommandWrapper |
|
|
|
|
|
|
|
AHB_CommandWrapper.addGuiCommand('AHB_view_annotate', AHB_View_Annotate()) |
|
|
|