# Macro Rectellipse

This page is a translated version of the page Macro Rectellipse and the translation is 100% complete.
Other languages:
Description Macro Rectellipse Crée un Rectellipse paramétriqueVersion macro : 1.0Date dernière modification : 2013-12-24Version FreeCAD : Toutes versionsTéléchargement : Icône pour votre barre d'outilsAuteur: fcaponi78 fcaponi78 Icône pour votre barre d'outils Page des macrosComment installer une macroComment créer une barre d'outils 1.0 2013-12-24 Toutes versions None None

## Description

Crée un rectellipse paramétrique

## Script

ToolBar Icon

Macro_Rectellipse.FCMacro

```from __future__ import division # allows floating point division from integers
import FreeCAD, Part, math
from FreeCAD import Base

class RectEllipseShape:
def __init__(self, obj):
''' Add the properties: Radius, Eccentricity, Height, Segments (see Property View) '''
obj.addProperty("App::PropertyBool","createFace","Rectellipse","Wheter to create a face or not").createFace=True
obj.Proxy = self

def onChanged(self, fp, prop):
if prop == "a" or prop == "b" or prop == "n" or prop == "segments" or prop == "height" or prop == "createFace":
#if one of these is changed
self.execute(fp)

def execute(self, fp):
r1=fp.a
r2=fp.b
s=fp.n
z=0.0
p=1.0
####w=2**0.5/2.0 #Ellipse
w=2**0.5/2.0/(1-s**p)
curve=Part.BSplineCurve()
curve.setPeriodic()
curve.insertKnots([i*1.0/(4) for i in (1,2,3)],[2]*(3)) #5Knots 8 Poles
if fp.createFace == True:
fp.Shape = Part.Face(Part.Wire(curve.toShape()))
else:
fp.Shape = curve.toShape()

def makeRectellipseBlock():
if doc == None: