Macro Arco da 3 punti

From FreeCAD Documentation
Revision as of 19:53, 29 June 2016 by Renatorivo (talk | contribs) (Created page with "Macro Crea Arco da 3 punti")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

File:Macro Make Arc 3 Points Macro Make Arc 3 Points

Description
Creates a arc from 3 selected points.

Author: Mario52
Author
Mario52
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

This macro creates a arc on 3 selected points.

Use

Select 3 points, or 3 points subObject and run the macro.

Script

The icon for the toolBar

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.00"
__date__    = "28/06/2019"


selectedObject = FreeCADGui.Selection.getSelection()    # select one element
selectedEdge = FreeCADGui.Selection.getSelectionEx()    # select one subElement

try:
    try:
        point0 = selectedObject[0].Shape.Point          # element
        point1 = selectedObject[1].Shape.Point
        point2 = selectedObject[2].Shape.Point
    except:
        point0 = selectedEdge[0].SubObjects[0].Point    # subElement
        point1 = selectedEdge[0].SubObjects[1].Point
        point2 = selectedEdge[0].SubObjects[2].Point

    FreeCAD.Console.PrintMessage(str(point0)+" "+str(point1)+" "+str(point2))

    C1 = Part.Arc(point0,point1,point2)
    S1 = Part.Shape([C1])
    W = Part.Wire(S1.Edges)
    Part.show(W)
except:
    FreeCAD.Console.PrintError("Select tree points or tree subObjects points"+"\n")
Other languages: