aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-02-25 16:31:41 -0500
committerTucker Evans <tuckerevans24@gmail.com>2019-02-25 16:31:41 -0500
commit89a646859e132cc21c6597b31cb39dd628434dfc (patch)
treea56d10b2248e31063eff49aad9f89961375cb488
parentb38b441035190e477078c65d3b6e07bf2df1b243 (diff)
Adds wire, current and point elements
Also fixes file so it can be loaded with `copy`
-rw-r--r--circuit.pic57
1 files changed, 37 insertions, 20 deletions
diff --git a/circuit.pic b/circuit.pic
index b495de3..48ceb4c 100644
--- a/circuit.pic
+++ b/circuit.pic
@@ -1,21 +1,38 @@
-.\" Circuits components
-.PS
-lineht = 0.25
-linewid = 0.25
-define batt {move down .1; line up .2; move down .1
- move right .05 down .03333;
- line up .066666; move down 0.03333;
- move left .025 down .2; "$1"
- move up .2 right 0.025;}
-define cap {move down .05; line up .1; move down .05
- move right .05 down .05;
- line up .1; move down .05; move left .025 down .15; "$1";
- move up .15 right 0.025;}
-define point {circle radius .0175 fill 1 at last line .end
- "$1" above at last circle .n
- " $2" ljust at last circle .w
- "$3" below at last circle .s
- "$4 " rjust at last circle .e
- move to last circle}
+#This file contains macros to draw circuits with pic
+#it should be included at the start of a file with:
+# .PS
+# copy "circuit.pic"
+# .PE
+#
+# Copyright (c) 2019 Tucker Evans
-.PE
+text_up = 0.175
+text_down = 0.2
+wire_wid = .25
+
+define wire {line $1 wire_wid}
+
+define current {
+arrowht = arrowht/2
+#LEFT
+ arrow wire_wid/2 + arrowwid/2
+#TEXT
+ move -arrowwid/2
+ "$1" at Here + (0, text_up); move to Here - (0,text_up)
+ " $2" ljust
+ "$3" at Here- (0, text_down); move to Here + (0,text_down)
+ "$4 " rjust
+ move arrowwid/2
+#RIGHT
+ line wire_wid/2 - arrowwid/2
+reset arrowht
+}
+
+define point {
+ circle radius .0175 fill 1 at last line .end
+ "$1" above at last circle .n
+ " $2" ljust at last circle .w
+ "$3" below at last circle .s
+ "$4 " rjust at last circle .e
+ move to last circle
+}