# 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:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎čeština

Rectellipse Macro

Popis
Vytváří parametrickou obdélníkovou elipsu

Version macro : 1.0
Date last modification : 2013-12-24
Autor: fcaponi78
Autor
fcaponi78
None
Odkazy
Verze
1.0
Datum poslední úpravy
2013-12-24
None
Výchozí zástupce
None
Viz též
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: