# Makro Rectellipse

This page is a translated version of the page Macro Rectellipse and the translation is 83% complete.
Outdated translations are marked like this.
Other languages:
Popis Rectellipse Macro Vytváří parametrickou obdélníkovou elipsuVersion macro : 1.0Date last modification : 2013-12-24Autor: fcaponi78 fcaponi78 None Makro recepty|Jak nainstalovat makraJak přizpůsobit panely nástrojů 1.0 2013-12-24 None None None

## Popis

Vytvoří parametrickou rectellipovu

## Skript

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: