circuitscript 0.0.29 → 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.
- package/dist/cjs/BaseVisitor.js +6 -1
- package/dist/cjs/antlr/CircuitScriptLexer.js +204 -200
- package/dist/cjs/antlr/CircuitScriptParser.js +1066 -1173
- package/dist/cjs/draw_symbols.js +330 -87
- package/dist/cjs/execute.js +39 -14
- package/dist/cjs/geometry.js +79 -18
- package/dist/cjs/globals.js +36 -6
- package/dist/cjs/helpers.js +40 -2
- package/dist/cjs/layout.js +72 -39
- package/dist/cjs/main.js +10 -4
- package/dist/cjs/objects/ClassComponent.js +2 -0
- package/dist/cjs/objects/ExecutionScope.js +1 -1
- package/dist/cjs/objects/Net.js +3 -2
- package/dist/cjs/objects/PinTypes.js +7 -1
- package/dist/cjs/objects/types.js +11 -1
- package/dist/cjs/regenerate-tests.js +64 -3
- package/dist/cjs/render.js +20 -14
- package/dist/cjs/sizing.js +4 -6
- package/dist/cjs/utils.js +29 -5
- package/dist/cjs/visitor.js +176 -10
- package/dist/esm/BaseVisitor.mjs +6 -1
- package/dist/esm/antlr/CircuitScriptLexer.mjs +204 -200
- package/dist/esm/antlr/CircuitScriptParser.mjs +1061 -1171
- package/dist/esm/antlr/CircuitScriptVisitor.mjs +3 -0
- package/dist/esm/draw_symbols.mjs +324 -85
- package/dist/esm/execute.mjs +40 -15
- package/dist/esm/geometry.mjs +79 -17
- package/dist/esm/globals.mjs +35 -5
- package/dist/esm/helpers.mjs +38 -1
- package/dist/esm/layout.mjs +75 -42
- package/dist/esm/main.mjs +11 -5
- package/dist/esm/objects/ClassComponent.mjs +6 -0
- package/dist/esm/objects/ExecutionScope.mjs +1 -1
- package/dist/esm/objects/Net.mjs +3 -2
- package/dist/esm/objects/PinTypes.mjs +6 -0
- package/dist/esm/objects/types.mjs +14 -0
- package/dist/esm/regenerate-tests.mjs +64 -3
- package/dist/esm/render.mjs +21 -15
- package/dist/esm/sizing.mjs +3 -4
- package/dist/esm/utils.mjs +26 -4
- package/dist/esm/visitor.mjs +179 -13
- package/dist/types/antlr/CircuitScriptLexer.d.ts +42 -41
- package/dist/types/antlr/CircuitScriptParser.d.ts +144 -133
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +6 -0
- package/dist/types/draw_symbols.d.ts +15 -2
- package/dist/types/execute.d.ts +5 -4
- package/dist/types/geometry.d.ts +4 -3
- package/dist/types/globals.d.ts +31 -3
- package/dist/types/helpers.d.ts +12 -0
- package/dist/types/layout.d.ts +2 -1
- package/dist/types/objects/ClassComponent.d.ts +8 -0
- package/dist/types/objects/PinTypes.d.ts +1 -0
- package/dist/types/objects/Wire.d.ts +4 -2
- package/dist/types/objects/types.d.ts +8 -0
- package/dist/types/sizing.d.ts +0 -4
- package/dist/types/utils.d.ts +3 -0
- package/dist/types/visitor.d.ts +8 -1
- package/fonts/Arial.ttf +0 -0
- package/libs/lib.cst +58 -41
- package/package.json +1 -1
package/dist/types/globals.d.ts
CHANGED
|
@@ -19,12 +19,40 @@ 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
|
|
25
|
-
export declare const
|
|
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 junctionSize
|
|
52
|
+
export declare const junctionSize: number;
|
|
53
|
+
export declare const PortArrowSize: number;
|
|
54
|
+
export declare const PortPaddingHorizontal: number;
|
|
55
|
+
export declare const PortPaddingVertical: number;
|
|
28
56
|
export declare const ColorScheme: {
|
|
29
57
|
BodyColor: string;
|
|
30
58
|
JunctionColor: string;
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -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;
|
package/dist/types/layout.d.ts
CHANGED
|
@@ -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:
|
|
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;
|
|
@@ -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 |
|
|
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;
|
package/dist/types/sizing.d.ts
CHANGED
|
@@ -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;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -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;
|
package/dist/types/visitor.d.ts
CHANGED
|
@@ -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[];
|
package/fonts/Arial.ttf
ADDED
|
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: -
|
|
10
|
-
vpin: 1, 0,
|
|
11
|
-
label: "net_name", 0, -
|
|
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: -
|
|
24
|
-
vpin: 1, 0,
|
|
25
|
-
label: "net_name", 0, -
|
|
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
|
|
@@ -35,7 +35,7 @@ def label(value, anchor="left"):
|
|
|
35
35
|
followWireOrientation: false
|
|
36
36
|
display: create graphic:
|
|
37
37
|
textColor: "#222"
|
|
38
|
-
label: "value", 0, -
|
|
38
|
+
label: "value", 0, -10, "?", fontSize=50, anchor=anchor
|
|
39
39
|
pin: 1, 0, 0, 0, 0, display_pin_id=false
|
|
40
40
|
type: "label"
|
|
41
41
|
params:
|
|
@@ -43,18 +43,32 @@ def label(value, anchor="left"):
|
|
|
43
43
|
value: value
|
|
44
44
|
priority: 5
|
|
45
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
|
+
|
|
46
60
|
def res(value):
|
|
47
|
-
width =
|
|
48
|
-
height =
|
|
61
|
+
width = 140
|
|
62
|
+
height = 60
|
|
49
63
|
|
|
50
64
|
return create component:
|
|
51
65
|
pins: 2
|
|
52
66
|
display: create graphic:
|
|
53
67
|
rect: 0, 0, width, height
|
|
54
|
-
hpin: 1, -width/2 -
|
|
55
|
-
hpin: 2, width/2 +
|
|
56
|
-
label:
|
|
57
|
-
label:
|
|
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"
|
|
58
72
|
type: "res"
|
|
59
73
|
params:
|
|
60
74
|
value: value
|
|
@@ -62,19 +76,20 @@ def res(value):
|
|
|
62
76
|
footprint: "Resistor_SMD:R_0402_1005Metric"
|
|
63
77
|
|
|
64
78
|
def cap(value):
|
|
65
|
-
width =
|
|
79
|
+
width = 120
|
|
66
80
|
height = 40
|
|
67
81
|
|
|
68
82
|
return create component:
|
|
69
83
|
pins: 2
|
|
70
84
|
angle: 90
|
|
71
85
|
display: create graphic:
|
|
72
|
-
|
|
73
|
-
hline: -width/2,
|
|
74
|
-
|
|
75
|
-
vpin:
|
|
76
|
-
|
|
77
|
-
label: "
|
|
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"
|
|
78
93
|
type: "cap"
|
|
79
94
|
params:
|
|
80
95
|
value: value
|
|
@@ -95,14 +110,14 @@ def ind(value):
|
|
|
95
110
|
arc: 15, 0, 5, 180, 360
|
|
96
111
|
hpin: 1, -width/2 - 20, 0, 20
|
|
97
112
|
hpin: 2, width/2 + 20, 0, -20
|
|
98
|
-
label: ("
|
|
99
|
-
label: ("
|
|
113
|
+
label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=50, anchor="left")
|
|
114
|
+
label: ("value", 0, 10, value, fontSize=50, anchor="middle", vanchor="middle")
|
|
100
115
|
params:
|
|
101
116
|
value: value
|
|
102
117
|
|
|
103
118
|
def diode():
|
|
104
|
-
width =
|
|
105
|
-
height =
|
|
119
|
+
width = 100
|
|
120
|
+
height = 100
|
|
106
121
|
|
|
107
122
|
# Diode is drawn horizontally
|
|
108
123
|
# -|>|-
|
|
@@ -112,13 +127,13 @@ def diode():
|
|
|
112
127
|
display: create graphic:
|
|
113
128
|
triangle: -width/2, 0, width/2, 0, height
|
|
114
129
|
vline: width/2, -height/2, height
|
|
115
|
-
hpin: 1, -width/2-
|
|
116
|
-
hpin: 2, width/2 +
|
|
117
|
-
label: "refdes",
|
|
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"
|
|
118
133
|
|
|
119
134
|
def led(color):
|
|
120
|
-
width =
|
|
121
|
-
height =
|
|
135
|
+
width = 100
|
|
136
|
+
height = 100
|
|
122
137
|
|
|
123
138
|
return create component:
|
|
124
139
|
pins:
|
|
@@ -128,12 +143,14 @@ def led(color):
|
|
|
128
143
|
display: create graphic:
|
|
129
144
|
triangle: -width/2, 0, width/2, 0, height
|
|
130
145
|
vline: width/2, -height/2, height
|
|
131
|
-
path: ("M",
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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"
|
|
137
154
|
params:
|
|
138
155
|
size: "0603"
|
|
139
156
|
footprint: "LED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolder"
|
|
@@ -150,15 +167,15 @@ def cgnd():
|
|
|
150
167
|
hline: -10, 5, 20
|
|
151
168
|
hline: -5, 10, 10
|
|
152
169
|
vpin: 1, 0, -10, 10, display_pin_id=false
|
|
153
|
-
label: "net_name", 0, 22, net_name, fontSize=
|
|
170
|
+
label: "net_name", 0, 22, net_name, fontSize=50, anchor="middle"
|
|
154
171
|
type: "net"
|
|
155
172
|
params:
|
|
156
173
|
net_name: net_name
|
|
157
174
|
priority: 100
|
|
158
175
|
|
|
159
176
|
def dgnd(net_name="GND"):
|
|
160
|
-
height =
|
|
161
|
-
width =
|
|
177
|
+
height = 50
|
|
178
|
+
width = 100
|
|
162
179
|
|
|
163
180
|
return create component:
|
|
164
181
|
pins: 1
|
|
@@ -166,14 +183,14 @@ def dgnd(net_name="GND"):
|
|
|
166
183
|
angle: 90
|
|
167
184
|
display: create graphic:
|
|
168
185
|
triangle: 0, 0, 0, height, width
|
|
169
|
-
vpin: 1, 0, -
|
|
170
|
-
label: "net_name", 0, height +
|
|
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"
|
|
171
188
|
type: "net"
|
|
172
189
|
params:
|
|
173
190
|
net_name: net_name
|
|
174
191
|
priority: 100
|
|
175
192
|
|
|
176
|
-
def text(value, offsetX = 0, offsetY = 0, fontSize =
|
|
193
|
+
def text(value, offsetX = 0, offsetY = 0, fontSize = 50):
|
|
177
194
|
return create component:
|
|
178
195
|
pins: 1
|
|
179
196
|
followWireOrientation: false
|