Compare commits
	
		
			5 Commits
		
	
	
		
			64d6635d5f
			...
			v0.1.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9a1fda087c | |||
| c5a0cf7ecc | |||
| 9a6973fb89 | |||
| d8094384ad | |||
| 86ca91920f | 
							
								
								
									
										63
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,3 +1,64 @@ | ||||
| # circuiteria | ||||
|  | ||||
| Drawing block circuits with Typst made easy, using CeTZ | ||||
| Circuiteria is a [Typst](https://typst.app) package for drawing block circuit diagrams using the [CeTZ](https://typst.app/universe/package/cetz) package. | ||||
|  | ||||
| <p align="center"> | ||||
|   <img src="./gallery/platypus.png" alt="Perry the platypus"> | ||||
| </p> | ||||
|  | ||||
| ## Examples | ||||
| <table> | ||||
|   <tr> | ||||
|     <td colspan="2"> | ||||
|       <a href="./gallery/test.typ"> | ||||
|         <img src="./gallery/test.png" width="500px"> | ||||
|       </a> | ||||
|     </td> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td colspan="2">A bit of eveything</td> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td colspan="2"> | ||||
|       <a href="./gallery/test5.typ"> | ||||
|         <img src="./gallery/test5.png" width="500px"> | ||||
|       </a> | ||||
|     </td> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td colspan="2">Wires everywhere</td> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td> | ||||
|       <a href="./gallery/test4.typ"> | ||||
|         <img src="./gallery/test4.png" width="250px"> | ||||
|       </a> | ||||
|     </td> | ||||
|     <td> | ||||
|       <a href="./gallery/test6.typ"> | ||||
|         <img src="./gallery/test6.png" width="250px"> | ||||
|       </a> | ||||
|     </td> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td>Groups</td> | ||||
|     <td>Rotated</td> | ||||
|   </tr> | ||||
| </table> | ||||
|  | ||||
| > **Note**\ | ||||
| > These circuit layouts were copied from a digital design course given by prof. S. Zahno and recreated using this package | ||||
|  | ||||
| *Click on the example image to jump to the code.* | ||||
|  | ||||
| ## Usage | ||||
| For more information, see the [manual](manual.pdf) | ||||
|  | ||||
| To use this package, simply import [circuiteria](https://typst.app/universe/package/circuiteria) and call the `circuit` function: | ||||
| ```typ | ||||
| #import "@preview/circuiteria:0.1.0" | ||||
| #circuiteria.circuit({ | ||||
|   import circuiteria: * | ||||
|   ... | ||||
| }) | ||||
| ``` | ||||
							
								
								
									
										
											BIN
										
									
								
								gallery/platypus.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gallery/platypus.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								gallery/platypus.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gallery/platypus.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 45 KiB | 
							
								
								
									
										77
									
								
								gallery/platypus.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								gallery/platypus.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | ||||
| #import "../src/lib.typ": * | ||||
|  | ||||
| #set page(width: auto, height: auto, margin: .5cm) | ||||
|  | ||||
| #let teal = rgb(37, 155, 166) | ||||
| #let orange = rgb(254, 160, 93) | ||||
| #let brown = rgb(97, 54, 60) | ||||
|  | ||||
| #circuit({ | ||||
|   element.group(id: "platypus", name: "A platypus", { | ||||
|     element.block( | ||||
|       x: 0, y: 0, w: 2, h: 3, id: "body", | ||||
|       fill: teal, | ||||
|       ports: ( | ||||
|         east: ( | ||||
|           (id: "out"), | ||||
|         ) | ||||
|       ), | ||||
|       ports-margins: ( | ||||
|         east: (50%, 10%) | ||||
|       ) | ||||
|     ) | ||||
|  | ||||
|     element.block( | ||||
|       x: 2.5, y: 1.5, w: 1.5, h: 1, id: "beak", | ||||
|       fill: orange, | ||||
|       ports: ( | ||||
|         south: ( | ||||
|           (id: "in"), | ||||
|         ) | ||||
|       ) | ||||
|     ) | ||||
|  | ||||
|     wire.wire("w1", ("body-port-out", "beak-port-in"), style: "zigzag", zigzag-ratio: 100%) | ||||
|   }) | ||||
|  | ||||
|   let O = (rel: (2, 0), to: "platypus.south-east") | ||||
|    | ||||
|   element.group(id: "perry", name: "Perry the platypus", { | ||||
|     element.block( | ||||
|       x: (rel: 0, to: O), y: 0, w: 2, h: 3, id: "body", | ||||
|       fill: teal, | ||||
|       ports: ( | ||||
|         east: ( | ||||
|           (id: "out"), | ||||
|         ) | ||||
|       ), | ||||
|       ports-margins: ( | ||||
|         east: (50%, 10%) | ||||
|       ) | ||||
|     ) | ||||
|  | ||||
|     element.block( | ||||
|       x: (rel: 2.5, to: O), y: 1.5, w: 1.5, h: 1, id: "beak", | ||||
|       fill: orange, | ||||
|       ports: ( | ||||
|         south: ( | ||||
|           (id: "in"), | ||||
|         ) | ||||
|       ) | ||||
|     ) | ||||
|  | ||||
|     element.block( | ||||
|       x: (rel: 0.25, to: O), y: 3.2, w: 1.5, h: 0.5, id: "hat", | ||||
|       fill: brown | ||||
|     ) | ||||
|  | ||||
|     wire.wire("w2", ("body-port-out", "beak-port-in"), style: "zigzag", zigzag-ratio: 100%) | ||||
|   }) | ||||
|  | ||||
|   wire.wire( | ||||
|     "w3", | ||||
|     ("platypus.east", (horizontal: "perry.west", vertical: ())), | ||||
|     directed: true, | ||||
|     bus: true | ||||
|   ) | ||||
| }) | ||||
										
											Binary file not shown.
										
									
								
							| @@ -18,7 +18,7 @@ | ||||
|         name: "Datapath", | ||||
|         ports: ( | ||||
|           north: ( | ||||
|             (id: "clk", clock: true), | ||||
|             (id: "clk", clock: true, small: true), | ||||
|             (id: "Zero"), | ||||
|             (id: "Regsrc"), | ||||
|             (id: "PCSrc"), | ||||
| @@ -104,7 +104,7 @@ | ||||
|       name: "Data\n Memory", | ||||
|       ports: ( | ||||
|         north: ( | ||||
|           (id: "clk", clock: true), | ||||
|           (id: "clk", clock: true, small: true), | ||||
|           (id: "WE", name: "WE") | ||||
|         ), | ||||
|         west: ( | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -52,13 +52,13 @@ | ||||
|   h: none, | ||||
|   name: none, | ||||
|   name-anchor: "center", | ||||
|   ports: (), | ||||
|   ports-margins: (), | ||||
|   ports: (:), | ||||
|   ports-margins: (:), | ||||
|   fill: none, | ||||
|   stroke: black + 1pt, | ||||
|   id: "", | ||||
|   auto-ports: true, | ||||
|   ports-y: (), | ||||
|   ports-y: (:), | ||||
|   debug: ( | ||||
|     ports: false | ||||
|   ) | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #let version = version((0,0,3)) | ||||
| #let version = version(0, 1, 0) | ||||
|  | ||||
| #import "circuit.typ": circuit | ||||
| #import "element.typ" | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| [package] | ||||
| name = "circuiteria" | ||||
| version = "0.0.3" | ||||
| version = "0.1.0" | ||||
| compiler = "0.11.0" | ||||
| repository = "https://git.kb28.ch/HEL/circuiteria" | ||||
| entrypoint = "src/lib.typ" | ||||
| @@ -11,4 +11,4 @@ categories = [ "visualization" ] | ||||
| license = "Apache-2.0" | ||||
| description = "Drawing block circuits with Typst made easy, using CeTZ" | ||||
| keywords = [ "circuit", "block", "draw" ] | ||||
| exclude = [ "/gallery/*" ] | ||||
| exclude = [ "gallery", "gallery.bash", "doc" ] | ||||
		Reference in New Issue
	
	Block a user