circuitscript 0.0.28 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cjs/BaseVisitor.js +6 -1
  2. package/dist/cjs/antlr/CircuitScriptLexer.js +204 -200
  3. package/dist/cjs/antlr/CircuitScriptParser.js +1066 -1173
  4. package/dist/cjs/draw_symbols.js +383 -103
  5. package/dist/cjs/execute.js +39 -14
  6. package/dist/cjs/geometry.js +79 -18
  7. package/dist/cjs/globals.js +41 -7
  8. package/dist/cjs/helpers.js +40 -2
  9. package/dist/cjs/layout.js +72 -39
  10. package/dist/cjs/main.js +10 -4
  11. package/dist/cjs/objects/ClassComponent.js +2 -0
  12. package/dist/cjs/objects/ExecutionScope.js +1 -1
  13. package/dist/cjs/objects/Net.js +3 -2
  14. package/dist/cjs/objects/PinTypes.js +7 -1
  15. package/dist/cjs/objects/types.js +11 -1
  16. package/dist/cjs/regenerate-tests.js +84 -14
  17. package/dist/cjs/render.js +22 -15
  18. package/dist/cjs/sizing.js +4 -6
  19. package/dist/cjs/utils.js +29 -5
  20. package/dist/cjs/visitor.js +176 -10
  21. package/dist/esm/BaseVisitor.mjs +6 -1
  22. package/dist/esm/antlr/CircuitScriptLexer.mjs +204 -200
  23. package/dist/esm/antlr/CircuitScriptParser.mjs +1061 -1171
  24. package/dist/esm/antlr/CircuitScriptVisitor.mjs +3 -0
  25. package/dist/esm/draw_symbols.mjs +378 -102
  26. package/dist/esm/execute.mjs +40 -15
  27. package/dist/esm/geometry.mjs +79 -17
  28. package/dist/esm/globals.mjs +40 -6
  29. package/dist/esm/helpers.mjs +38 -1
  30. package/dist/esm/layout.mjs +75 -42
  31. package/dist/esm/main.mjs +11 -5
  32. package/dist/esm/objects/ClassComponent.mjs +6 -0
  33. package/dist/esm/objects/ExecutionScope.mjs +1 -1
  34. package/dist/esm/objects/Net.mjs +3 -2
  35. package/dist/esm/objects/PinTypes.mjs +6 -0
  36. package/dist/esm/objects/types.mjs +14 -0
  37. package/dist/esm/regenerate-tests.mjs +85 -15
  38. package/dist/esm/render.mjs +23 -16
  39. package/dist/esm/sizing.mjs +3 -4
  40. package/dist/esm/utils.mjs +26 -4
  41. package/dist/esm/visitor.mjs +179 -13
  42. package/dist/types/antlr/CircuitScriptLexer.d.ts +42 -41
  43. package/dist/types/antlr/CircuitScriptParser.d.ts +144 -133
  44. package/dist/types/antlr/CircuitScriptVisitor.d.ts +6 -0
  45. package/dist/types/draw_symbols.d.ts +24 -6
  46. package/dist/types/execute.d.ts +5 -4
  47. package/dist/types/geometry.d.ts +5 -3
  48. package/dist/types/globals.d.ts +38 -6
  49. package/dist/types/helpers.d.ts +12 -0
  50. package/dist/types/layout.d.ts +2 -1
  51. package/dist/types/objects/ClassComponent.d.ts +8 -0
  52. package/dist/types/objects/PinTypes.d.ts +1 -0
  53. package/dist/types/objects/Wire.d.ts +4 -2
  54. package/dist/types/objects/types.d.ts +8 -0
  55. package/dist/types/sizing.d.ts +0 -4
  56. package/dist/types/utils.d.ts +3 -0
  57. package/dist/types/visitor.d.ts +8 -1
  58. package/fonts/Arial.ttf +0 -0
  59. package/libs/lib.cst +78 -55
  60. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
  import Flatten from '@flatten-js/core';
2
2
  import { Box } from '@svgdotjs/svg.js';
3
+ import { PinTypes } from './objects/PinTypes.js';
3
4
  export type Segment = Flatten.Segment;
4
5
  export type Polygon = Flatten.Polygon;
5
6
  export type Multiline = Flatten.Multiline;
6
7
  export type Line = Flatten.Line;
7
8
  export type Arc = Flatten.Arc;
8
- export type Feature = Segment | Polygon | Label | Textbox | Arc | Multiline;
9
+ export type Feature = Segment | Polygon | Textbox | Arc | Multiline;
9
10
  export type LabelStyle = {
10
11
  font?: string;
11
12
  fontSize?: number;
@@ -13,6 +14,8 @@ export type LabelStyle = {
13
14
  angle?: number;
14
15
  anchor?: HorizontalAlign.Left | HorizontalAlign.Middle | HorizontalAlign.Right;
15
16
  vanchor?: VerticalAlign.Top | VerticalAlign.Middle | VerticalAlign.Bottom;
17
+ textColor?: string;
18
+ portType?: null | PinTypes;
16
19
  };
17
20
  export declare class Textbox extends Flatten.Polygon {
18
21
  id: string;
@@ -32,10 +35,9 @@ export declare class Textbox extends Flatten.Polygon {
32
35
  static fromPoint(id: string, x: number, y: number, text: string, style: LabelStyle, label: boolean): Textbox;
33
36
  rotate(angle: number, origin: Flatten.Point): Textbox;
34
37
  transform(matrix: Flatten.Matrix): Textbox;
38
+ private transformAnchorPoint;
35
39
  getLabelPosition(): [number, number];
36
40
  }
37
- export declare class Label extends Textbox {
38
- }
39
41
  export declare class GeometryProp {
40
42
  name: string;
41
43
  value: string | number;
@@ -19,15 +19,47 @@ export declare enum SymbolPinSide {
19
19
  Left = "left",
20
20
  Right = "right"
21
21
  }
22
+ export declare enum LengthUnit {
23
+ mm = "mm",
24
+ mils = "mils",
25
+ px = "px"
26
+ }
27
+ export declare enum WireAutoDirection {
28
+ Auto = "auto",
29
+ Auto_ = "auto_"
30
+ }
31
+ export declare const MilsToMM = 0.0254;
32
+ export declare const MMToPx = 3.779276;
33
+ export declare const PxToMM = 0.2645833;
22
34
  export declare const portWidth = 20;
23
35
  export declare const portHeight = 2;
24
- export declare const defaultFont = "Open Sans-Regular, Arial";
25
- export declare const defaultFontBold = "Open Sans-Bold, Arial-Bold, Arial";
36
+ export declare const defaultGridSizeUnits: number;
37
+ export declare const defaultZoomScale = 2.5;
38
+ export declare const fontDisplayScale = 0.032;
39
+ export declare const defaultSymbolLineWidth: number;
40
+ export declare const defaultWireLineWidth: number;
41
+ export declare const defaultPinNameTextSize = 40;
42
+ export declare const defaultPinIdTextSize = 30;
43
+ export declare const CustomSymbolPinTextSize = 40;
44
+ export declare const CustomSymbolPinIdSize = 30;
45
+ export declare const CustomSymbolRefDesSize = 50;
46
+ export declare const CustomSymbolParamTextSize = 40;
47
+ export declare const defaultFrameTitleTextSize = 60;
48
+ export declare const displayUnits = LengthUnit.mils;
49
+ export declare const defaultFont = "Arial";
50
+ export declare const defaultFontBold = "Arial";
26
51
  export declare const defaultFontSize = 10;
27
- export declare const bodyColor = "#FFFEAF";
28
- export declare const junctionSize = 5;
29
- export declare const junctionColor = "rgb(0, 132, 0)";
30
- export declare const wireColor = "rgb(0, 132, 0)";
52
+ export declare const junctionSize: number;
53
+ export declare const PortArrowSize: number;
54
+ export declare const PortPaddingHorizontal: number;
55
+ export declare const PortPaddingVertical: number;
56
+ export declare const ColorScheme: {
57
+ BodyColor: string;
58
+ JunctionColor: string;
59
+ WireColor: string;
60
+ PinLineColor: string;
61
+ PinNameColor: string;
62
+ };
31
63
  export declare enum ComponentTypes {
32
64
  gnd = "gnd",
33
65
  net = "net",
@@ -3,6 +3,7 @@ import { CommonTokenStream, DefaultErrorStrategy, Parser } from "antlr4ng";
3
3
  import { CircuitScriptParser } from "./antlr/CircuitScriptParser.js";
4
4
  import { CircuitScriptLexer } from "./antlr/CircuitScriptLexer.js";
5
5
  import { IParsedToken, SemanticTokensVisitor } from "./SemanticTokenVisitor.js";
6
+ import { LengthUnit } from "./globals.js";
6
7
  export declare enum JSModuleType {
7
8
  CommonJs = "cjs",
8
9
  ESM = "mjs"
@@ -38,3 +39,14 @@ export declare function getCurrentPath(): {
38
39
  export declare function getFontsPath(): string;
39
40
  export declare function getDefaultLibsPath(): string;
40
41
  export declare function getPackageVersion(): string;
42
+ export declare class UnitDimension {
43
+ type: LengthUnit;
44
+ value: number;
45
+ constructor(value: number, type?: LengthUnit);
46
+ getMM(): number;
47
+ static mm(value: number): UnitDimension;
48
+ static mils(value: number): UnitDimension;
49
+ static px(value: number): UnitDimension;
50
+ }
51
+ export declare function milsToMM(value: number): number;
52
+ export declare function pxToMM(value: number): number;
@@ -2,6 +2,7 @@ import { Graph, Edge } from '@dagrejs/graphlib';
2
2
  import { SymbolGraphic, SymbolText } from "./draw_symbols.js";
3
3
  import { ClassComponent } from "./objects/ClassComponent.js";
4
4
  import { SequenceItem } from "./objects/ExecutionScope.js";
5
+ import { WireAutoDirection } from './globals.js';
5
6
  import { WireSegment } from './objects/Wire.js';
6
7
  import { Net } from './objects/Net.js';
7
8
  import { Logger } from './logger.js';
@@ -79,7 +80,7 @@ export declare class RenderWire extends RenderObject {
79
80
  netName: string;
80
81
  constructor(x: number, y: number, segments: WireSegment[]);
81
82
  refreshPoints(): void;
82
- getAutoPoints(value: [x: number, y: number], direction: 'auto' | 'auto_'): [dx: number, dy: number][];
83
+ getAutoPoints(value: [x: number, y: number], direction: WireAutoDirection): [dx: number, dy: number][];
83
84
  getWireEnd(): {
84
85
  x: number;
85
86
  y: number;
@@ -1,7 +1,9 @@
1
+ import { Expressions_blockContext } from 'src/antlr/CircuitScriptParser.js';
1
2
  import { SymbolDrawingCommands } from '../draw_symbols.js';
2
3
  import { Net } from './Net.js';
3
4
  import { PinDefinition, PinId } from './PinDefinition.js';
4
5
  import { WireSegment } from './Wire.js';
6
+ import { ExecutionContext } from 'src/execute.js';
5
7
  export declare class ClassComponent {
6
8
  instanceName: string;
7
9
  numPins: number;
@@ -23,10 +25,16 @@ export declare class ClassComponent {
23
25
  followWireOrientationProp: boolean;
24
26
  wireOrientationAngle: number;
25
27
  useWireOrientationAngle: boolean;
28
+ didSetWireOrientationAngle: boolean;
26
29
  styles: {
27
30
  [key: string]: number | string;
28
31
  };
29
32
  assignedRefDes: string | null;
33
+ moduleContainsExpressions?: Expressions_blockContext;
34
+ moduleCounter: number;
35
+ moduleExecutionContext: ExecutionContext;
36
+ moduleExecutionContextName: string;
37
+ modulePinIdToPortMap: Map<number, ClassComponent>;
30
38
  constructor(instanceName: string, numPins: number, className: string);
31
39
  setupPins(): void;
32
40
  getDefaultPin(): number;
@@ -5,3 +5,4 @@ export declare enum PinTypes {
5
5
  IO = "io",
6
6
  Power = "power"
7
7
  }
8
+ export declare const AllPinTypes: PinTypes[];
@@ -1,12 +1,14 @@
1
+ import { UnitDimension } from "src/helpers.js";
1
2
  import { ClassComponent } from "./ClassComponent.js";
2
3
  import { Direction } from "./types.js";
4
+ import { WireAutoDirection } from "src/globals.js";
3
5
  export declare class Wire {
4
6
  path: WireSegment[];
5
7
  constructor(path: WireSegment[]);
6
8
  }
7
9
  export type WireSegment = {
8
- direction: Direction.Up | Direction.Down | Direction.Left | Direction.Right | 'auto' | 'auto_';
9
- value: number;
10
+ direction: Direction.Up | Direction.Down | Direction.Left | Direction.Right | WireAutoDirection;
11
+ value: number | UnitDimension;
10
12
  valueXY?: [x: number, y: number];
11
13
  until?: [instance: ClassComponent, pin: number];
12
14
  };
@@ -40,6 +40,14 @@ export declare class UndeclaredReference {
40
40
  reference: ReferenceType;
41
41
  constructor(reference: ReferenceType);
42
42
  }
43
+ export declare class DeclaredReference {
44
+ found: boolean;
45
+ name?: string;
46
+ trailers?: string[];
47
+ type?: string;
48
+ value?: any;
49
+ constructor(refType: ReferenceType);
50
+ }
43
51
  export type ReferenceType = {
44
52
  found: boolean;
45
53
  name?: string;
@@ -4,10 +4,6 @@ import { SVGWindow } from 'svgdom';
4
4
  export declare function prepareSVGEnvironment(fontsPath: string | null): Promise<void>;
5
5
  export declare function getCreateSVGWindow(): () => SVGWindow;
6
6
  export declare function applyFontsToSVG(canvas: SVGTypeMapping): void;
7
- export declare function measureTextSize(text: string, fontFamily: string, fontSize: number): Promise<{
8
- width: number;
9
- height: number;
10
- }>;
11
7
  export declare function measureTextSize2(text: string, fontFamily: string, fontSize: number, fontWeight?: string, anchor?: HorizontalAlign, vanchor?: VerticalAlign): {
12
8
  width: number;
13
9
  height: number;
@@ -1,3 +1,4 @@
1
+ import { ClassComponent } from "./objects/ClassComponent";
1
2
  export declare class SimpleStopwatch {
2
3
  startTime: Date;
3
4
  constructor();
@@ -17,3 +18,5 @@ export declare function getBoundsSize(bounds: BoundBox): {
17
18
  width: number;
18
19
  height: number;
19
20
  };
21
+ export declare function getPortType(component: ClassComponent): string | null;
22
+ export declare function roundValue(value: number): number;
@@ -1,4 +1,4 @@
1
- import { Add_component_exprContext, AdditionExprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, BinaryOperatorExprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_def_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, Single_line_propertyContext, To_component_exprContext, Wire_exprContext, UnaryOperatorExprContext, Wire_expr_direction_onlyContext, Wire_expr_direction_valueContext, Graphic_exprContext, If_exprContext, If_inner_exprContext, LogicalOperatorExprContext, Nested_properties_innerContext } from './antlr/CircuitScriptParser.js';
1
+ import { Add_component_exprContext, AdditionExprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, BinaryOperatorExprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_def_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, Single_line_propertyContext, To_component_exprContext, Wire_exprContext, UnaryOperatorExprContext, Wire_expr_direction_onlyContext, Wire_expr_direction_valueContext, Graphic_exprContext, If_exprContext, If_inner_exprContext, LogicalOperatorExprContext, Nested_properties_innerContext, Expressions_blockContext, Create_module_exprContext, Property_block_exprContext } from './antlr/CircuitScriptParser.js';
2
2
  import { ClassComponent } from './objects/ClassComponent.js';
3
3
  import { PinTypes } from './objects/PinTypes.js';
4
4
  import { ComponentPin, ComponentPinNet } from './objects/types.js';
@@ -16,12 +16,17 @@ export declare class ParserVisitor extends BaseVisitor {
16
16
  visitCreate_component_expr: (ctx: Create_component_exprContext) => void;
17
17
  visitCreate_graphic_expr: (ctx: Create_graphic_exprContext) => void;
18
18
  visitGraphic_expr: (ctx: Graphic_exprContext) => void;
19
+ visitCreate_module_expr: (ctx: Create_module_exprContext) => void;
20
+ visitProperty_block_expr: (ctx: Property_block_exprContext) => void;
19
21
  visitProperty_expr: (ctx: Property_exprContext) => void;
20
22
  visitSingle_line_property: (ctx: Single_line_propertyContext) => void;
21
23
  visitNested_properties_inner: (ctx: Nested_properties_innerContext) => void;
22
24
  visitNested_properties: (ctx: Nested_propertiesContext) => void;
23
25
  visitProperty_key_expr: (ctx: Property_key_exprContext) => void;
24
26
  visitData_expr_with_assignment: (ctx: Data_expr_with_assignmentContext) => void;
27
+ private expandModuleContains;
28
+ private linkModuleSymbolWithContains;
29
+ private placeModuleContains;
25
30
  visitUnaryOperatorExpr: (ctx: UnaryOperatorExprContext) => void;
26
31
  visitDataExpr: (ctx: DataExprContext) => void;
27
32
  visitBinaryOperatorExpr: (ctx: BinaryOperatorExprContext) => void;
@@ -40,12 +45,14 @@ export declare class ParserVisitor extends BaseVisitor {
40
45
  visitPoint_expr: (ctx: Point_exprContext) => ComponentPin;
41
46
  visitProperty_set_expr: (ctx: Property_set_exprContext) => void;
42
47
  visitDouble_dot_property_set_expr: (ctx: Double_dot_property_set_exprContext) => void;
48
+ visitExpressions_block: (ctx: Expressions_blockContext) => void;
43
49
  visitFrame_expr: (ctx: Frame_exprContext) => void;
44
50
  visitNet_namespace_expr: (ctx: Net_namespace_exprContext) => void;
45
51
  visitIf_expr: (ctx: If_exprContext) => void;
46
52
  visitIf_inner_expr: (ctx: If_inner_exprContext) => void;
47
53
  pinTypes: PinTypes[];
48
54
  private parseCreateComponentPins;
55
+ private parseCreateModulePorts;
49
56
  private parseCreateComponentParams;
50
57
  printNets(): void;
51
58
  dumpNets(): ComponentPinNet[];
Binary file
package/libs/lib.cst CHANGED
@@ -6,9 +6,9 @@ def net(net_name):
6
6
  copy: true
7
7
  angle: -90
8
8
  display: create graphic:
9
- hline: -15, 0, 30
10
- vpin: 1, 0, 10, -10, display_pin_id=0
11
- label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
9
+ hline: -50, 0, 100
10
+ vpin: 1, 0, 50, -50, display_pin_id=false
11
+ label: "net_name", 0, -15, net_name, fontSize=50, anchor="middle"
12
12
  type: "net"
13
13
  params:
14
14
  net_name: net_name
@@ -20,9 +20,9 @@ def supply(net_name):
20
20
  copy: true
21
21
  angle: -90
22
22
  display: create graphic:
23
- hline: -15, 0, 30
24
- vpin: 1, 0, 10, -10, display_pin_id=0
25
- label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
23
+ hline: -50, 0, 100
24
+ vpin: 1, 0, 50, -50, display_pin_id=false
25
+ label: "net_name", 0, -15, net_name, fontSize=50, anchor="middle"
26
26
  type: "net"
27
27
  params:
28
28
  net_name: net_name
@@ -34,26 +34,41 @@ def label(value, anchor="left"):
34
34
  copy: true
35
35
  followWireOrientation: false
36
36
  display: create graphic:
37
- label: "value", 0, -2, "?", fontSize=10, anchor=anchor
38
- pin: 1, 0, 0, 0, 0, display_pin_id=0
37
+ textColor: "#222"
38
+ label: "value", 0, -10, "?", fontSize=50, anchor=anchor
39
+ pin: 1, 0, 0, 0, 0, display_pin_id=false
39
40
  type: "label"
40
41
  params:
41
42
  net_name: value
42
43
  value: value
43
44
  priority: 5
44
45
 
46
+ def port(value, portType="input"):
47
+ return create component:
48
+ pins: 1
49
+ copy: true
50
+ display: create graphic:
51
+ textColor: "#222"
52
+ label: "value", 0, 0, "?", fontSize=40, anchor="left", vanchor="middle", portType=portType
53
+ pin: 1, 0, 0, 0, 0, display_pin_id=false
54
+ type: "port"
55
+ params:
56
+ net_name: value
57
+ value: value
58
+ priority: 5
59
+
45
60
  def res(value):
46
- width = 40
47
- height = 20
61
+ width = 140
62
+ height = 60
48
63
 
49
64
  return create component:
50
65
  pins: 2
51
66
  display: create graphic:
52
67
  rect: 0, 0, width, height
53
- hpin: 1, -width/2 - 20, 0, 20
54
- hpin: 2, width/2 + 20, 0, -20
55
- label: ("value", 0, 1, value, fontSize=10, anchor="middle", vanchor="middle")
56
- label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=10, anchor="left")
68
+ hpin: 1, -width/2 - 30, 0, 30
69
+ hpin: 2, width/2 + 30, 0, -30
70
+ label: "refdes", -width/2, -height/2 - 20 , "?", fontSize=50, anchor="left"
71
+ label: "value", 0, 4, value, fontSize=30, anchor="middle", vanchor="middle"
57
72
  type: "res"
58
73
  params:
59
74
  value: value
@@ -61,19 +76,20 @@ def res(value):
61
76
  footprint: "Resistor_SMD:R_0402_1005Metric"
62
77
 
63
78
  def cap(value):
64
- width = 20
79
+ width = 120
65
80
  height = 40
66
81
 
67
82
  return create component:
68
83
  pins: 2
69
84
  angle: 90
70
85
  display: create graphic:
71
- hline: -width/2, -3, width
72
- hline: -width/2, 3, width
73
- vpin: 1, 0, -height/2, 20-3
74
- vpin: 2, 0, height/2, -20+3
75
- label: "refdes", width/2+2, 0, "?", fontSize = 10, anchor="left"
76
- label: "value", width/2+2, 5, value, fontSize = 10, anchor = "left", vanchor="top"
86
+ lineWidth: 13
87
+ hline: -width/2, 20, width
88
+ hline: -width/2, -20, width
89
+ vpin: 1, 0, -100, 80
90
+ vpin: 2, 0, 100, -80
91
+ label: "refdes", 80, -30, "?", fontSize=50, anchor="left", vanchor="middle"
92
+ label: "value", 80, 30, value, fontSize=50, anchor = "left", vanchor="middle"
77
93
  type: "cap"
78
94
  params:
79
95
  value: value
@@ -94,14 +110,14 @@ def ind(value):
94
110
  arc: 15, 0, 5, 180, 360
95
111
  hpin: 1, -width/2 - 20, 0, 20
96
112
  hpin: 2, width/2 + 20, 0, -20
97
- label: ("value", 0, 10, value, fontSize=10, anchor="middle", vanchor="middle")
98
- label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=10, anchor="left")
113
+ label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=50, anchor="left")
114
+ label: ("value", 0, 10, value, fontSize=50, anchor="middle", vanchor="middle")
99
115
  params:
100
116
  value: value
101
117
 
102
118
  def diode():
103
- width = 20
104
- height = 20
119
+ width = 100
120
+ height = 100
105
121
 
106
122
  # Diode is drawn horizontally
107
123
  # -|>|-
@@ -111,13 +127,13 @@ def diode():
111
127
  display: create graphic:
112
128
  triangle: -width/2, 0, width/2, 0, height
113
129
  vline: width/2, -height/2, height
114
- hpin: 1, -width/2-20, 0, 20 # anode
115
- hpin: 2, width/2 + 20, 0, -20 # cathode
116
- label: "refdes", width/2 + 5, 5, "?", fontSize=10, anchor="left", vanchor="top"
130
+ hpin: 1, -width/2-100, 0, 100 # anode
131
+ hpin: 2, width/2 + 100, 0, -100 # cathode
132
+ label: "refdes", 0, -100, "?", fontSize=50, anchor="middle", vanchor="top"
117
133
 
118
134
  def led(color):
119
- width = 20
120
- height = 20
135
+ width = 100
136
+ height = 100
121
137
 
122
138
  return create component:
123
139
  pins:
@@ -127,12 +143,14 @@ def led(color):
127
143
  display: create graphic:
128
144
  triangle: -width/2, 0, width/2, 0, height
129
145
  vline: width/2, -height/2, height
130
- path: ("M", 0, 8, "L", 5, 18,
131
- "M", 3, 8, "L", 8, 18)
132
- hpin: 1, -width/2-20, 0, 20 # anode
133
- hpin: 2, width/2 + 20, 0, -20 # cathode
134
- label: "refdes", width/2 + 5, 5, "?", fontSize=10, anchor="left", vanchor="top"
135
- label: "color", width/2 + 5, 25, color
146
+ path: ("M", 70, 30, "L", 130, 90,
147
+ "M", 130, 60, "L", 130, 90, "L", 100, 90)
148
+ path: ("M", 120, 30, "L", 180, 90,
149
+ "M", 180, 60, "L", 180, 90, "L", 150, 90)
150
+ hpin: 1, -width/2-100, 0, 100 # anode
151
+ hpin: 2, width/2 + 100, 0, -100 # cathode
152
+ label: "refdes", 0, -100, "?", fontSize=50, anchor="middle", vanchor="top"
153
+ label: "color", 0, 100, color, fontSize=40, anchor="middle", vanchor="bottom"
136
154
  params:
137
155
  size: "0603"
138
156
  footprint: "LED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolder"
@@ -148,16 +166,16 @@ def cgnd():
148
166
  hline: -15, 0, 30
149
167
  hline: -10, 5, 20
150
168
  hline: -5, 10, 10
151
- vpin: 1, 0, -10, 10, display_pin_id=0
152
- label: "net_name", 0, 22, net_name, fontSize=10, anchor="middle"
169
+ vpin: 1, 0, -10, 10, display_pin_id=false
170
+ label: "net_name", 0, 22, net_name, fontSize=50, anchor="middle"
153
171
  type: "net"
154
172
  params:
155
173
  net_name: net_name
156
174
  priority: 100
157
175
 
158
176
  def dgnd(net_name="GND"):
159
- height = 10
160
- width = 20
177
+ height = 50
178
+ width = 100
161
179
 
162
180
  return create component:
163
181
  pins: 1
@@ -165,35 +183,40 @@ def dgnd(net_name="GND"):
165
183
  angle: 90
166
184
  display: create graphic:
167
185
  triangle: 0, 0, 0, height, width
168
- vpin: 1, 0, -10, 10, display_pin_id=0
169
- label: "net_name", 0, height + 10, net_name, fontSize=10, anchor="middle"
186
+ vpin: 1, 0, -50, 50, display_pin_id=false
187
+ label: "net_name", 0, height + 50, net_name, fontSize=50, anchor="middle", vanchor="middle"
170
188
  type: "net"
171
189
  params:
172
190
  net_name: net_name
173
191
  priority: 100
174
192
 
175
- def marker_point():
193
+ def text(value, offsetX = 0, offsetY = 0, fontSize = 50):
176
194
  return create component:
177
195
  pins: 1
196
+ followWireOrientation: false
178
197
  display: create graphic:
179
- hline: -5, 0, 10
180
- vline: 0, -5, 10
181
- pin: 1, 0, 0, 0, 0, display_pin_id=0
198
+ pin: 1, 0, 0, 0, 0, display_pin_id=false
199
+ text:
200
+ content: value
201
+ offset: offsetX, offsetY
202
+ fontSize: fontSize
182
203
 
183
- def arrow_point():
204
+ # Drawing markers
205
+
206
+ def marker_point():
184
207
  return create component:
185
208
  pins: 1
186
209
  display: create graphic:
187
- path: ("M", 15, -5, "L", 20, 0, "L", 15, 5)
188
- hpin: 1, 0, 0, 20
210
+ hline: -5, 0, 10
211
+ vline: 0, -5, 10
212
+ pin: 1, 0, 0, 0, 0, display_pin_id=false
189
213
 
190
- def text(value, offsetX = 0, offsetY = 0, fontSize = 12):
214
+ def arrow_point():
191
215
  return create component:
192
216
  pins: 1
193
217
  followWireOrientation: false
194
218
  display: create graphic:
195
- pin: 1, 0, 0, 0, 0, display_pin_id=0
196
- text:
197
- content: value
198
- offset: offsetX, offsetY
199
- fontSize: fontSize
219
+ lineWidth: 2
220
+ path: ("M", -10, -5, "L", -5, 0, "L", -10, 5)
221
+ path: ("M", -5, 0, "L", -20, 0)
222
+ hpin: 1, 0, 0, 0, display_pin_id=false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "circuitscript",
3
- "version": "0.0.28",
3
+ "version": "0.0.31",
4
4
  "description": "Interpreter for the circuitscript language",
5
5
  "homepage": "https://circuitscript.net",
6
6
  "engines": {