Macro Make Arc 3 Points/it: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
{{Macro/it|Icon=Macro_Make_Arc_3_Points|Name=Macro Make Arc 3 Points|Name/it=Macro Arco da 3 punti|Description=Crea un arco da 3 punti selezionati.|Author=Mario52}}
{{Macro/it
|Name=Macro Make Arc 3 Points
|Icon=Macro_Make_Arc_3_Points.png
|Translate=Arco da 3 punti
|Description=Crea un arco da 3 punti selezionati.
|Author=Mario52
|Version=01.00
|Date=2016-07-14
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/images/9/92/Macro_Make_Arc_3_Points.png ToolBar Icon]
}}

==Descrizione==
==Descrizione==
Questa macro crea un arco da 3 punti selezionati
Questa macro crea un arco da 3 punti selezionati

==Uso==
==Utilizzo==
Avviare la macro, poi selezionare 3 punti. Viene creato uno arco. Le coordinate e la lunghezza dell'arco sono visualizzati nella vista rapporto.
Avviare la macro, poi selezionare 3 punti. Viene creato uno arco. Le coordinate e la lunghezza dell'arco sono visualizzati nella vista rapporto.


Line 10: Line 23:
L'icona per la barra degli strumenti: [[File:Macro Make Arc 3 Points.png|36px]]
L'icona per la barra degli strumenti: [[File:Macro Make Arc 3 Points.png|36px]]


Macro_Make_Arc_3_Points.FCMacro
'''Macro_Make_Arc_3_Points.FCMacro'''


{{Code|code=
{{MacroCode|code=
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from FreeCAD import Base
from FreeCAD import Base
Line 19: Line 32:
__author__ = "Mario52"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__url__ = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.01"
__version__ = "00.02"
__date__ = "14/07/2016"
__date__ = "29/07/2019"


global selected; selected = []
global selected; selected = []
Line 26: Line 39:


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 42: Line 55:
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)



}}
}}
<languages/>

Latest revision as of 22:53, 16 September 2022

Other languages:

Arco da 3 punti

Descrizione
Crea un arco da 3 punti selezionati.

Versione macro: 01.00
Ultima modifica: 2016-07-14
Versione FreeCAD: All
Download: ToolBar Icon
Autore: Mario52
Autore
Mario52
Download
ToolBar Icon
Link
Versione macro
01.00
Data ultima modifica
2016-07-14
Versioni di FreeCAD
All
Scorciatoia
Nessuna
Vedere anche
Nessuno

Descrizione

Questa macro crea un arco da 3 punti selezionati

Utilizzo

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)