# Macro Rectellipse

This page is a translated version of the page Macro Rectellipse and the translation is 100% complete.
Other languages:
Descrizione Rectellipse Crea un rettangolo parametrico con i vertici arrotondatiVersione macro: 1.0Ultima modifica: 2013-12-24Versione FreeCAD: Tutte versioneDownload: Icona per la ToolBarAutore: fcaponi78 fcaponi78 Icona per la ToolBar Raccolta di macroCome installare le macroPersonalizzare la toolbar 1.0 2013-12-24 Tutte versione Nessuna Nessuno

## Descrizione

Crea una rectellipse parametrica

## Script

ToolBar Icon

Macro_Rectellipse.FCMacro

```from __future__ import division # allows floating point division from integers

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: