Macro Ellipse-Center%2B2Points/it


Text-x-python.png Ellisse da centro e 2 punti

Descrizione
Crea un'ellisse selezionando tre punti, in questo ordine: centro, raggio maggiore e raggio minore
Autore
Eriossoltero
Link
Esempi di macro
Come installare le Macro
Personalizzare la barra degli strumenti
Versione
1.0
Data ultima modifica
2016-12-25


Crea un'ellisse selezionando tre punti, in questo ordine: centro, raggio maggiore e raggio minore.


EllipseCenter2Point.png

# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base

# get the selected objects, with first selection for the trajectory and second for the section
# Adapted from:
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
s = FreeCADGui.Selection.getSelection()
try:
sel1=s[0].Shape
sel2=s[1].Shape
sel3=s[2].Shape
except:
print "Wrong selection"

pt_center = sel1.Point
pt_radmay = sel2.Point
pt_radmen = sel3.Point

# create Part object in the current document
myObject=App.ActiveDocument.addObject("Part::Feature","Ellipse")

# create a shape and assign it to the current document
ellipse = Part.Ellipse(pt_radmay, pt_radmen, pt_center)
myObject.Shape = ellipse.toShape()
# Macro End: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++ 
Online version: "http://www.freecadweb.org/wiki/index.php?title=Macro_Ellipse-Center%2B2Points/it&oldid=240398"

Navigation menu