Macro Make Arc 3 Points/it: Difference between revisions
mNo edit summary |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<div class="mw-translate-fuzzy"> |
|||
{{Macro/it |
{{Macro/it |
||
|Name=Macro Make Arc 3 Points |
|Name=Macro Make Arc 3 Points |
||
Line 8: | Line 9: | ||
|Date=2016-07-14 |
|Date=2016-07-14 |
||
}} |
}} |
||
</div> |
|||
==Descrizione== |
==Descrizione== |
||
Line 29: | Line 31: | ||
__author__ = "Mario52" |
__author__ = "Mario52" |
||
__url__ = "http://www.freecadweb.org/index-fr.html" |
__url__ = "http://www.freecadweb.org/index-fr.html" |
||
__version__ = "00. |
__version__ = "00.02" |
||
__date__ = " |
__date__ = "29/07/2019" |
||
global selected; selected = [] |
global selected; selected = [] |
||
Line 36: | Line 38: | ||
class SelObserver: |
class SelObserver: |
||
print "Create Arc to 3 points ..." |
print( "Create Arc to 3 points ...") |
||
def addSelection(self,doc,obj,sub,pnt): # Selection |
def addSelection(self,doc,obj,sub,pnt): # Selection |
||
global selected |
global selected |
||
selected.append(pnt) |
selected.append(pnt) |
||
if len(selected) == 1: |
if len(selected) == 1: |
||
print "Point 1 : ",FreeCAD.Vector(selected[0]) |
print( "Point 1 : ",FreeCAD.Vector(selected[0])) |
||
elif len(selected) == 2: |
elif len(selected) == 2: |
||
print "Point 2 : ",FreeCAD.Vector(selected[1]) |
print( "Point 2 : ",FreeCAD.Vector(selected[1])) |
||
elif len(selected) == 3: |
elif len(selected) == 3: |
||
print "Point 3 : ",FreeCAD.Vector(selected[2]) |
print( "Point 3 : ",FreeCAD.Vector(selected[2])) |
||
try: |
try: |
||
C1 = Part.Arc(FreeCAD.Vector(selected[0]),FreeCAD.Vector(selected[1]),FreeCAD.Vector(selected[2])) |
C1 = Part.Arc(FreeCAD.Vector(selected[0]),FreeCAD.Vector(selected[1]),FreeCAD.Vector(selected[2])) |
||
Line 52: | Line 54: | ||
Part.show(W) |
Part.show(W) |
||
App.ActiveDocument.ActiveObject.Label = "Arc_3_Points" |
App.ActiveDocument.ActiveObject.Label = "Arc_3_Points" |
||
print "Length : ",W.Length |
print( "Length : ",W.Length) |
||
except Exception: |
except Exception: |
||
print "Three points are collinear or bad selection" |
print( "Three points are collinear or bad selection") |
||
del selected[:] |
del selected[:] |
||
FreeCADGui.Selection.removeObserver(s) |
FreeCADGui.Selection.removeObserver(s) |
||
print "End Make_Arc_3_Points" |
print( "End Make_Arc_3_Points") |
||
print "_____________________" |
print( "_____________________") |
||
s=SelObserver() |
s=SelObserver() |
||
FreeCADGui.Selection.addObserver(s) |
FreeCADGui.Selection.addObserver(s) |
||
}} |
}} |
Revision as of 17:28, 29 July 2019
Descrizione |
---|
Crea un arco da 3 punti selezionati. Versione macro: 01.00 Ultima modifica: 2016-07-14 Autore: Mario52 |
Autore |
Mario52 |
Download |
None |
Link |
Raccolta di macro Come installare le macro Personalizzare la toolbar |
Versione macro |
01.00 |
Data ultima modifica |
2016-07-14 |
Versioni di FreeCAD |
None |
Scorciatoia |
Nessuna |
Vedere anche |
Nessuno |
Descrizione
Questa macro crea un arco da 3 punti selezionati
Uso
Avviare la macro, poi selezionare 3 punti. Viene creato uno arco. Le coordinate e la lunghezza dell'arco sono visualizzati nella vista rapporto.
Nota:non è necessario tenere premuto il tasto Ctrl
Script
L'icona per la barra degli strumenti:
Macro_Make_Arc_3_Points.FCMacro
# -*- coding: utf-8 -*-
from FreeCAD import Base
__title__ = "Macro_Make_Arc_3_points"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.02"
__date__ = "29/07/2019"
global selected; selected = []
App = FreeCAD
class SelObserver:
print( "Create Arc to 3 points ...")
def addSelection(self,doc,obj,sub,pnt): # Selection
global selected
selected.append(pnt)
if len(selected) == 1:
print( "Point 1 : ",FreeCAD.Vector(selected[0]))
elif len(selected) == 2:
print( "Point 2 : ",FreeCAD.Vector(selected[1]))
elif len(selected) == 3:
print( "Point 3 : ",FreeCAD.Vector(selected[2]))
try:
C1 = Part.Arc(FreeCAD.Vector(selected[0]),FreeCAD.Vector(selected[1]),FreeCAD.Vector(selected[2]))
S1 = Part.Shape([C1])
W = Part.Wire(S1.Edges)
Part.show(W)
App.ActiveDocument.ActiveObject.Label = "Arc_3_Points"
print( "Length : ",W.Length)
except Exception:
print( "Three points are collinear or bad selection")
del selected[:]
FreeCADGui.Selection.removeObserver(s)
print( "End Make_Arc_3_Points")
print( "_____________________")
s=SelObserver()
FreeCADGui.Selection.addObserver(s)