Commit 1ac71a96 by mehtank

Hydrofoils

1 parent 32d363ca
......@@ -25,5 +25,7 @@ c.addConnection(("cabin", "staredge"), ("star", "portedge"))
c.inheritInterface("foreedge", ("cabin", "foreedge"))
c.inheritInterface("rearedge", ("cabin", "rearedge"))
c.inheritInterface("portedge", ("port", "portedge"))
c.inheritInterface("staredge", ("star", "staredge"))
c.toYaml("library/Catamaran.yaml")
from svggen.api.component import Component
c = Component()
# BOX
c.addSubcomponent("boat","Catamaran", inherit=True, prefix=None)
c.addSubcomponent("port","Foil", invert=True, inherit=True, prefix=None)
c.addSubcomponent("star","Foil", invert=True, inherit=True, prefix=None)
c.addConstraint(("port","width"), ("length", "depth", "width"), "(x[0]+x[1])/10. + x[2]")
c.addConstraint(("port","height"), ("length", "depth"), "sum(x)/3.")
c.addConstraint(("star","width"), ("length", "depth", "width"), "(x[0]+x[1])/10. + x[2]")
c.addConstraint(("star","height"), ("length", "depth"), "sum(x)/3.")
c.addConstConstraint(("star","flip"), True)
c.addConnection(("boat", "portedge"), ("port", "mount"), angle=-180)
c.addConnection(("boat", "staredge"), ("star", "mount"), angle=-180)
c.addConnection(("star", "join"), ("port", "join"), tabWidth=10)
c.toYaml("library/CatFoil.yaml")
from svggen.api.component import Component
c = Component()
c.addParameter("height")
c.addParameter("length")
c.addParameter("depth")
c.addParameter("dl", 0.1)
c.addParameter("width")
c.addParameter("flip")
c.addSubcomponent("stick", "Rectangle")
c.addSubcomponent("foil","Wing")
c.addSubcomponent("split","SplitEdge")
c.addConstraint(("split","botlength"), ("length", "depth"), "[sum(x)]")
c.addConstraint(("split","toplength"), ("length", "depth"), "[x[0]/2., x[1], x[0]/2.]")
c.addConstraint(("stick","l"), "height")
c.addConstraint(("stick","w"), "depth")
c.addConstraint(("foil","bodylength"), "depth")
c.addConstraint(("foil","wingtip"), "depth")
c.addConstraint(("foil","thickness"), ("dl", "depth"), "x[0] * x[1]")
c.addConstraint(("foil","wingspan"), "width")
c.addConstraint(("foil","flip"), "flip")
c.addConnection(("split", "topedge1"), ("stick", "l"))
c.addConnection(("stick", "r"), ("foil", "tip"), angle=90)
c.inheritInterface("mount", ("split", "botedge0"))
c.inheritInterface("join", ("foil", "base"))
c.toYaml("library/Foil.yaml")
connections:
connection0:
- [boat, portedge]
- [port, mount]
- {angle: -180}
connection1:
- [boat, staredge]
- [star, mount]
- {angle: -180}
connection2:
- [star, join]
- [port, join]
- {tabWidth: 10}
interfaces: {}
metadata:
depth: {default: 50}
dl: {default: 0.1}
flip: {default: null}
height: {default: 30}
length: {default: 200}
width: {default: 60}
parameters: {depth: 50, dl: 0.1, flip: null, height: 30, length: 200, width: 60}
subcomponents:
boat:
classname: Catamaran
kwargs: {}
parameters:
depth: {parameter: depth}
height: {parameter: height}
length: {parameter: length}
width: {parameter: width}
port:
classname: Foil
kwargs: {invert: true}
parameters:
depth: {parameter: depth}
dl: {parameter: dl}
flip: {parameter: flip}
height:
function: sum(x)/3.
parameter: [length, depth]
length: {parameter: length}
width:
function: (x[0]+x[1])/10. + x[2]
parameter: [length, depth, width]
star:
classname: Foil
kwargs: {invert: true}
parameters:
depth: {parameter: depth}
dl: {parameter: dl}
flip: true
height:
function: sum(x)/3.
parameter: [length, depth]
length: {parameter: length}
width:
function: (x[0]+x[1])/10. + x[2]
parameter: [length, depth, width]
......@@ -9,7 +9,9 @@ connections:
- {}
interfaces:
foreedge: {interface: foreedge, subcomponent: cabin}
portedge: {interface: portedge, subcomponent: port}
rearedge: {interface: rearedge, subcomponent: cabin}
staredge: {interface: staredge, subcomponent: star}
metadata:
depth: {default: 50}
height: {default: 30}
......
connections:
connection0:
- [split, topedge1]
- [stick, l]
- {}
connection1:
- [stick, r]
- [foil, tip]
- {angle: 90}
interfaces:
join: {interface: base, subcomponent: foil}
mount: {interface: botedge0, subcomponent: split}
metadata:
depth: {default: null}
dl: {default: 0.1}
flip: {default: null}
height: {default: null}
length: {default: null}
width: {default: null}
parameters: {depth: null, dl: 0.1, flip: null, height: null, length: null, width: null}
subcomponents:
foil:
classname: Wing
kwargs: {}
parameters:
bodylength: {parameter: depth}
flip: {parameter: flip}
thickness:
function: x[0] * x[1]
parameter: [dl, depth]
wingspan: {parameter: width}
wingtip: {parameter: depth}
split:
classname: SplitEdge
kwargs: {}
parameters:
botlength:
function: '[sum(x)]'
parameter: [length, depth]
toplength:
function: '[x[0]/2., x[1], x[0]/2.]'
parameter: [length, depth]
stick:
classname: Rectangle
kwargs: {}
parameters:
l: {parameter: height}
w: {parameter: depth}
from svggen.library import getComponent
def test_make(display=False):
f = getComponent("CatFoil")
f.makeOutput("output/catfoil", tree=True, display=display)
if __name__ == '__main__':
test_make(display=False)
from svggen.library import getComponent
def test_make_seg(display=False):
f = getComponent("Foil", depth=80, length=20, width=50, flip=True)
f.makeOutput("output/foil", tree=True, display=display)
if __name__ == '__main__':
test_make_seg(display=True)
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!