main.add_node(x=0.0, y=0.0, name="A", ll="bottom") main.add_node(x=1.0, y=0.0, name="B", ll="right") main.add_node(x=1.0, y=1.0, name="C", ll="top") main.add_node(x=0.0, y=1.0, name="D", ll="left") main.connect("A", "B", name="1", ll="top", la=45.0, lp=1.0) main.connect("B", "C", name="2", ll="top", la=45.0, lp=1.0) main.connect("C", "D", name="3", ll="top", la=45.0, lp=1.0) main.connect("D", "A", name="4", ll="top", la=45.0, lp=1.0) main.anchor_graph() print("Nodes are anchored:", main.anchored) print(main.general_info(), "\n") print(main) graphs = [] graphs.append(main) graphs.append(main.copy(-1.0, 0.0)) graphs[-1].reflect("y") graphs.append(main.copy(0.0, -1.0)) graphs[-1].reflect("x") CAN = Canvas(border_thickness=0.05, grid=True) for graph in graphs: CAN.add_graph(graph) CAN.draw(save_file="test.pdf", display=True, print_information=False)
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple pipe reflected.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = True) print(Component.stats) CAN.add_component( Pipe(5, 1.0, Point(0.0, 0.0) , label_location = 'center', label_pad = 1.0, name = 'Not reflected', angle = 0.0, label_angle = 0.0) ) CAN.add_component( Pipe(5, 1.0, Point(0.0, 0.0) , label_location = 'bottom', label_pad = 1.0, name = 'Bottom label \n relfect_x', angle = 0.0, label_angle = 0.0, reflect = 'x') ) CAN.add_component( Pipe(5, 1.0, Point(0.0, -2.0) , label_location = 'center', label_pad = 1.0, name = 'Not reflected', angle = 0.0, label_angle = 0.0) ) CAN.add_component( Pipe(5, 1.0, Point(0.0, -2.0) , label_location = 'top', label_pad = 1.0, name = 'Top label \n relfect_x', angle = 0.0, label_angle = 0.0, reflect = 'x') ) print(Component.stats) CAN.draw(save_file = 'test.pdf', display = True, print_information = False)
y = HXA.center_of_rotation.y - hx_length - 0.4 tmi.add_node(x, y, name = 'Branch6-A:1') tmi.add_node(-1.0 * x, y, name = 'Branch6-B:1') x = Pipe2CLA.center_of_rotation.x + 0.4 tmi.add_node(x, y, name = 'Branch6-A:2') tmi.add_node(-1.0 * x, y, name = 'Branch6-B:2') y = Pipe2CLA.center_of_rotation.y tmi.add_node(x, y, name = 'Branch6-A:3') tmi.add_node(-1.0 * x, y, name = 'Branch6-B:3') tmi.connect( 'HX-A(primary):outlet', 'Branch6-A:1', 'Branch6-A:2', 'Branch6-A:3', 'pipe2-CL-A:inlet', name = 'Branch6-A', label_edge_number = 1, label_location = 'bottom', label_pad = 1.0, label_angle = 0.0, label_shift = 1.0 ) tmi.connect( 'HX-B(primary):outlet', 'Branch6-B:1', 'Branch6-B:2', 'Branch6-B:3', 'pipe2-CL-B:inlet', name = 'Branch6-B', label_edge_number = 1, label_location = 'top', label_pad = 1.0, label_angle = 0.0, label_shift = 1.0 ) # draw CAN = Canvas(border_thickness = 0.0, grid = False) CAN.add_system(tmi) CAN.draw(save_file = 'tmi.pdf', display = True)
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple core channel.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import CoreChannel from schematics import Component CAN = Canvas(border_thickness=0.05, grid=False) print(Component.stats) CAN.add_component( CoreChannel(1.0, 3.0, Point(-3.0, 0.0), label_location='left', name='left \nreflect_y', label_pad=0.25, angle=0.0, reflect='y', face_color=(0.6875, .1953, 0.1875, 1.0))) CAN.add_component( CoreChannel(1.0, 3.0, Point(0.0, 0.0), label_location='center', name='center', label_pad=0.25,
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Display color palettes.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness=0.05, grid=False) print(Component.stats) # Reds CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 3.0), face_color=(0.597659, 0.0, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 3.0), face_color=(0.67578, 0.19531, 0.19531))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 3.0), face_color=(0.71484, 0.2968, 0.2968))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 3.0), face_color=(0.7539, 0.3984, 0.3984))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 3.0), face_color=(0.796875, 0.49609, 0.49609))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 3.0), face_color=(0.8359, 0.5976, 0.5976))) # Oranges CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 1.5), face_color=(0.82, 0.36, 0.01))) CAN.add_component(
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Display color palettes.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = False) print(Component.stats) # RAINBOW CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 4.5), label_location = 'left', label_string = 'Rainbow', face_color = (0.6875, .1953, 0.1875))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 4.5), face_color = (0.8825, 0.4170, 0.1445))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 4.5), face_color = (0.9961, 0.8320, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 4.5), face_color = (0.125, 0.4101, 0.1445))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 4.5), face_color = (0.1758, 0.203, 0.7461))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 4.5), face_color = (0.5, 0.2266, 0.5703))) # Fantastic Mr. Fox CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 3.0), label_location = 'left', label_string = 'Fantastic\n Mr. Fox', face_color = (0.8633, 0.5508, 0.1602))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 3.0), face_color = (0.8828, 0.8203, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 3.0), face_color = (0.27343, 0.67187, 0.78125))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 3.0), face_color = (0.894531, 0.5234, 0.00391))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 3.0), face_color = (0.7031, 0.05859, 0.125))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 3.0), face_color = (0.9531, 0.9179, 0.8008))) # Beachy Time CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 0.0), label_location = 'left', label_string = 'Beachy\nTime', face_color = (0.59, 0.81, 0.71)))
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple Pipe.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = True) print(Component.stats) CAN.add_component( Pipe(0.75, 0.3, Point(1.0, 1.0), name = 'Component', a = 0.0, ll = 'bottom', lp = 1.0, la = 0.0, fs = 10 ) ) # CAN.add_component( Pipe(0.75, 0.3, Point(-1.0, -1.0), name = '-90 degrees', a = -90.0, # ll = 'top', lp = 1.0, la = 0.0 # ) # ) # # CAN.add_component( Pipe(0.75, 0.3, Point(0.0, -1.0), name = '-45 degrees', a = -45.0, # ll = 'top', lp = 1.0, la = 0.0 # ) # ) # # CAN.add_component( Pipe(0.75, 0.3, Point(1.0, -1.0), name = '0 degrees', a = 0.0,
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple Pipe.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = True) print Component.stats CAN.add_component( Pipe(0.75, 0.3, Point(1.0, 1.0), name = 'Component', a = 0.0, ll = 'bottom', lp = 1.0, la = 0.0, fs = 10 ) ) CAN.add_component( Pipe(0.75, 0.3, Point(-1.0, -1.0), name = '-90 degrees', a = -90.0, ll = 'top', lp = 1.0, la = 0.0 ) ) CAN.add_component( Pipe(0.75, 0.3, Point(0.0, -1.0), name = '-45 degrees', a = -45.0, ll = 'top', lp = 1.0, la = 0.0 ) ) CAN.add_component( Pipe(0.75, 0.3, Point(1.0, -1.0), name = '0 degrees', a = 0.0, ll = 'top', lp = 1.0, la = 0.0
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger("Simple steam dome reflected.") command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import SteamDome from schematics import Component CAN = Canvas(border_thickness=0.05, grid=True) print(Component.stats) CAN.add_component( SteamDome(1.0, Point(1.0, 0.0), label_location="center", name="not reflected", label_pad=0.5, angle=0.0) ) CAN.add_component( SteamDome( 1.0, Point(1.0, 0.5), label_location="right", name="relfect_y \nright label", label_pad=0.5, angle=0.0, reflect="y", ) ) CAN.add_component( SteamDome(
ref=deepcopy(self.reflect, memo), fc=deepcopy(self.face_color, memo), ec=deepcopy(self.edge_color, memo), lw=deepcopy(self.line_width, memo)) # debugging routine if __name__ == '__main__': from schematics import component_debug_switch debugging = component_debug_switch('The component Pipe') from schematics import Canvas component = Pipe(1.0, 0.5, Point(0.0, 0.0), name='Pipe', a=0.0, ll='top', lp=1.0, ls='Component', la=0.0, fs=12) CAN = Canvas(border_thickness=0.05, grid=False) CAN.add_component(component) CAN.add_graph(component.graph) CAN.draw(display=True)
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Display color palettes.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = False) print Component.stats # Reds CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 3.0), face_color = (0.597659, 0.0, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 3.0), face_color = (0.67578, 0.19531, 0.19531))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 3.0), face_color = (0.71484, 0.2968, 0.2968))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 3.0), face_color = (0.7539, 0.3984, 0.3984))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 3.0), face_color = (0.796875, 0.49609, 0.49609))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 3.0), face_color = (0.8359, 0.5976, 0.5976))) # Oranges CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 1.5), face_color = (0.82, 0.36, 0.01))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 1.5), face_color = (0.83, 0.43, 0.11))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 1.5), face_color = (0.85, 0.49, 0.20))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 1.5), face_color = (0.87, 0.55, 0.30))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 1.5), face_color = (0.89, 0.62, 0.40))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 1.5), face_color = (0.91, 0.68, 0.50))) # Yellows CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 0.0), face_color = (0.98, 0.79, 0.00))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 0.0), face_color = (0.98, 0.81, 0.10)))
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple core channel.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import CoreChannel from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = False) print Component.stats CAN.add_component( CoreChannel(1.0, 3.0, Point(-3.0, 0.0), label_location='left', name='left \nreflect_y', label_pad = 0.25, angle=0.0, reflect = 'y', face_color = (0.6875, .1953, 0.1875, 1.0))) CAN.add_component( CoreChannel(1.0, 3.0, Point(0.0, 0.0), label_location='center', name='center', label_pad = 0.25, angle=0.0, face_color = (0.5, 0.2266, 0.5703, 1.0))) CAN.add_component( CoreChannel(1.0, 3.0, Point(3.0, 0.0), label_location='right', name='right \nreflect_y', label_pad = 0.25, angle=0.0, reflect = 'y', face_color = (0.9961, 0.8320, 0.0, 1.0))) print Component.stats CAN.draw(save_file = None, display = True, print_information = False)
# ------------- circuit1 circuit1 = Graph(name = 'circuit1', graphs = [long_pipe1, long_pipe2]) circuit1.connect('long_pipe1:pipe2:outlet', 'long_pipe2:pipe1:inlet', name = "junction1") circuit1.connect('long_pipe2:pipe2:outlet', 'long_pipe1:pipe1:inlet', name = "junction2") # ------------- circuit2 circuit2 = circuit1.copy(name = 'circuit2') circuit2.move(x=3.0, y=3.0) circuit2.rotate(angle = 45.0) # ------------- super graph super_graph = Graph(name = 'super', graphs = [circuit1, circuit2]) # print super_graph, '\n' * 2 # print super_graph.general_info() # ------------- PLOTTING CAN = Canvas(border_thickness = 0.05, grid = True) CAN.add_graph(super_graph) CAN.draw(save_file = 'test.pdf', display = True, print_information = False)
command_line_parser = ExampleDebugger("A simple system.") command_line_parser.parse() from schematics import Canvas from schematics import System from schematics import Pipe from schematics import Pump from schematics import CoreChannel from schematics import Point tmi = System("tmi") radius = 1.0 px = 0.0 py = 0.0 y = (0.5 * radius) + py x = (3.0 * radius) + px tmi.add_node(x, y, name="outlet") PumpA = Pump(radius, Point(px, py), name="Pump", ref=None, angle=90.0, label_angle=0.0) tmi.add_component(PumpA) tmi.connect("Pump:outlet", "outlet") CAN = Canvas(border_thickness=0.05, grid=True) CAN.add_system(tmi) CAN.draw(save_file="tmi.pdf", display=True)
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple Pipe.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness=0.05, grid=True) print(Component.stats) CAN.add_component( Pipe(0.75, 0.3, Point(1.0, 1.0), name='Component', a=0.0, ll='bottom', lp=1.0, la=0.0, fs=10)) # CAN.add_component( Pipe(0.75, 0.3, Point(-1.0, -1.0), name = '-90 degrees', a = -90.0, # ll = 'top', lp = 1.0, la = 0.0 # ) # ) # # CAN.add_component( Pipe(0.75, 0.3, Point(0.0, -1.0), name = '-45 degrees', a = -45.0,
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple pump reflected.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pump from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = True) print(Component.stats) CAN.add_component( Pump(0.3, Point(0.0, 0.0), label_location = 'center', name = 'not reflected', label_pad = 0.5, angle = 0)) CAN.add_component( Pump(0.3, Point(1.0, 0.0), label_location = 'right', name = 'relfect_y \nright label', label_pad = 0.5, angle = 0.0, reflect = 'y')) CAN.add_component( Pump(0.3, Point(2.0, 0.0), label_location = 'left', name = 'relfect_y \nleft label', label_pad = 0.5, angle = 0.0, reflect = 'y')) CAN.add_component( Pump(0.3, Point(0.0, -1.0), label_location = 'center', name = 'not reflected', label_pad = 0.5, angle = 0.0)) print(Component.stats) CAN.draw(save_file = 'test.pdf', display = True, print_information = False)
n = deepcopy(self.name, memo), ll = deepcopy(self.label_location, memo), ls = deepcopy(self.label_string, memo), la = deepcopy(self.label_angle, memo), lp = deepcopy(self.label_pad, memo), fs = deepcopy(self.font_size, memo), a = deepcopy(self.angle, memo), ref = deepcopy(self.reflect, memo), fc = deepcopy(self.face_color, memo), ec = deepcopy(self.edge_color, memo), lw = deepcopy(self.line_width, memo) ) # debugging routine if __name__ == '__main__': from schematics import component_debug_switch debugging = component_debug_switch('The component Pipe') from schematics import Canvas component = Pipe( 1.0, 0.5, Point(0.0, 0.0), name = 'Pipe', a = 0.0, ll = 'top', lp = 1.0, ls = 'Component', la = 0.0, fs = 12 ) CAN = Canvas(border_thickness = 0.05, grid = False) CAN.add_component(component) CAN.add_graph(component.graph) CAN.draw(display = True)
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Detailed node label.') command_line_parser.parse() from schematics import Graph from schematics import Canvas import matplotlib.pyplot as plt main = Graph(name = 'main') main.add_node(x=0.0, y=0.0, name = 'test0', ll = 'bottom', lp = 0.0) main.add_node(x=0.0, y=0.0, name = 'test1', ll = 'top', lp = 0.0) main.add_node(x=0.0, y=0.0, name = 'test2', ll = 'left', lp = 0.0) main.add_node(x=0.0, y=0.0, name = 'test3', ll = 'right', lp = 0.0) bounding = Graph(name = 'bounding') disp = 0.1 bounding.add_node(x=disp, y=0.0, name = 'top', dl = False) bounding.add_node(x=-disp, y=0.0, name = 'bottom', dl = False) bounding.add_node(x=0.0, y=-disp, name = 'left', dl = False) bounding.add_node(x=0.0, y=disp, name = 'right', dl = False) GRAPH = Graph(name = 'graph', graphs = [main, bounding]) CAN = Canvas(border_thickness = 0.0, grid = True) CAN.add_graph(GRAPH) CAN.draw(save_file = 'test.pdf', display = True, print_information = False)
from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Display color palettes.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pipe from schematics import Component CAN = Canvas(border_thickness = 0.05, grid = False) print Component.stats # RAINBOW CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 4.5), label_location = 'left', label_string = 'Rainbow', face_color = (0.6875, .1953, 0.1875))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 4.5), face_color = (0.8825, 0.4170, 0.1445))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 4.5), face_color = (0.9961, 0.8320, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 4.5), face_color = (0.125, 0.4101, 0.1445))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 4.5), face_color = (0.1758, 0.203, 0.7461))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 4.5), face_color = (0.5, 0.2266, 0.5703))) # Fantastic Mr. Fox CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 3.0), label_location = 'left', label_string = 'Fantastic\n Mr. Fox', face_color = (0.8633, 0.5508, 0.1602))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 3.0), face_color = (0.8828, 0.8203, 0.0))) CAN.add_component( Pipe(1.0, 1.0, Point(0.0, 3.0), face_color = (0.27343, 0.67187, 0.78125))) CAN.add_component( Pipe(1.0, 1.0, Point(1.5, 3.0), face_color = (0.894531, 0.5234, 0.00391))) CAN.add_component( Pipe(1.0, 1.0, Point(3.0, 3.0), face_color = (0.7031, 0.05859, 0.125))) CAN.add_component( Pipe(1.0, 1.0, Point(4.5, 3.0), face_color = (0.9531, 0.9179, 0.8008))) # Beachy Time CAN.add_component( Pipe(1.0, 1.0, Point(-3.0, 0.0), label_location = 'left', label_string = 'Beachy\nTime', face_color = (0.59, 0.81, 0.71))) CAN.add_component( Pipe(1.0, 1.0, Point(-1.5, 0.0), face_color = (1.00, 0.93, 0.68)))
simple.add_component( Pipe( 1.0, 0.5, Point(4.0, 0.0), name = 'Pipe 3', angle = 0.0, label_location = 'center', label_pad = 0.0, label_angle = 0.0 ) ) simple.add_node(1.5, 0.0, name = 'Node 1') simple.add_node(1.5, 1.0, name = 'Node 2') simple.add_node(3.5, 1.0, name = 'Node 3') simple.add_node(3.5, 0.0, name = 'Node 4') simple.connect( 'Pipe 1:outlet', 'Node 1', 'Node 2', 'Pipe 2:inlet', name = 'Junction 1', label_edge_number = 0, label_location = 'top', label_pad = 1.0, label_angle = 0.0, label_shift = 1.0 ) simple.connect( 'Pipe 2:outlet', 'Node 3', 'Node 4', 'Pipe 3:inlet', name = 'Junction 2', label_edge_number = 2, label_location = 'top', label_pad = 1.0, label_angle = 0.0, label_shift = -1.0 ) CAN = Canvas(border_thickness = 0.05, grid = True) CAN.add_system(simple) CAN.draw(save_file = 'test.pdf', display = True, print_information = False)
from __future__ import print_function from schematics import ExampleDebugger command_line_parser = ExampleDebugger('Simple pump reflected.') command_line_parser.parse() from schematics import Point from schematics import Canvas from schematics import Pump from schematics import Component CAN = Canvas(border_thickness=0.05, grid=True) print(Component.stats) CAN.add_component( Pump(0.3, Point(0.0, 0.0), label_location='center', name='not reflected', label_pad=0.5, angle=0)) CAN.add_component( Pump(0.3, Point(1.0, 0.0), label_location='right', name='relfect_y \nright label', label_pad=0.5, angle=0.0, reflect='y')) CAN.add_component( Pump(0.3,