circuitscript 0.5.3 → 0.5.5
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 +11 -10
- package/dist/cjs/annotate/ComponentAnnotater.js +3 -2
- package/dist/cjs/builtinMethods.js +6 -5
- package/dist/cjs/environment/environment.js +2 -2
- package/dist/cjs/errors.js +140 -0
- package/dist/cjs/execute.js +12 -5
- package/dist/cjs/globals.js +10 -6
- package/dist/cjs/main.js +3 -2
- package/dist/cjs/objects/ClassComponent.js +4 -4
- package/dist/cjs/objects/ExecutionScope.js +2 -2
- package/dist/cjs/objects/Frame.js +7 -0
- package/dist/cjs/objects/NumericValue.js +15 -0
- package/dist/cjs/objects/PinDefinition.js +2 -2
- package/dist/cjs/objects/types.js +2 -2
- package/dist/cjs/parser.js +3 -2
- package/dist/cjs/pipeline.js +25 -15
- package/dist/cjs/regenerate-tests.js +6 -6
- package/dist/cjs/render/draw_symbols.js +40 -25
- package/dist/cjs/render/geometry.js +6 -6
- package/dist/cjs/render/graph.js +4 -0
- package/dist/cjs/render/layout.js +325 -253
- package/dist/cjs/render/render.js +38 -24
- package/dist/cjs/semantic-tokens/getSemanticTokens.js +2 -2
- package/dist/cjs/sizing.js +2 -2
- package/dist/cjs/styles.js +19 -0
- package/dist/cjs/utils.js +13 -110
- package/dist/cjs/validate/validateScript.js +2 -2
- package/dist/cjs/visitor.js +14 -12
- package/dist/esm/BaseVisitor.js +2 -1
- package/dist/esm/annotate/ComponentAnnotater.js +3 -2
- package/dist/esm/builtinMethods.js +6 -5
- package/dist/esm/environment/environment.js +1 -1
- package/dist/esm/errors.js +119 -0
- package/dist/esm/execute.js +10 -3
- package/dist/esm/globals.js +8 -4
- package/dist/esm/main.js +3 -2
- package/dist/esm/objects/ClassComponent.js +1 -1
- package/dist/esm/objects/ExecutionScope.js +1 -1
- package/dist/esm/objects/Frame.js +7 -0
- package/dist/esm/objects/NumericValue.js +15 -0
- package/dist/esm/objects/PinDefinition.js +1 -1
- package/dist/esm/objects/types.js +1 -1
- package/dist/esm/parser.js +2 -1
- package/dist/esm/pipeline.js +14 -4
- package/dist/esm/regenerate-tests.js +6 -6
- package/dist/esm/render/draw_symbols.js +41 -24
- package/dist/esm/render/geometry.js +6 -6
- package/dist/esm/render/graph.js +5 -0
- package/dist/esm/render/layout.js +325 -253
- package/dist/esm/render/render.js +38 -24
- package/dist/esm/semantic-tokens/getSemanticTokens.js +1 -1
- package/dist/esm/sizing.js +2 -2
- package/dist/esm/styles.js +20 -0
- package/dist/esm/utils.js +10 -95
- package/dist/esm/validate/validateScript.js +1 -1
- package/dist/esm/visitor.js +4 -2
- package/dist/libs/std.cst +37 -37
- package/dist/types/BaseVisitor.d.ts +3 -1
- package/dist/types/errors.d.ts +37 -0
- package/dist/types/execute.d.ts +1 -1
- package/dist/types/globals.d.ts +8 -4
- package/dist/types/helpers.d.ts +1 -1
- package/dist/types/objects/Frame.d.ts +7 -0
- package/dist/types/objects/NumericValue.d.ts +5 -1
- package/dist/types/render/draw_symbols.d.ts +8 -3
- package/dist/types/render/geometry.d.ts +4 -4
- package/dist/types/render/graph.d.ts +3 -0
- package/dist/types/render/layout.d.ts +7 -1
- package/dist/types/render/render.d.ts +2 -1
- package/dist/types/styles.d.ts +11 -0
- package/dist/types/utils.d.ts +2 -27
- package/dist/types/visitor.d.ts +1 -1
- package/libs/std.cst +37 -37
- package/package.json +1 -1
package/dist/types/globals.d.ts
CHANGED
|
@@ -46,8 +46,11 @@ export declare const portHeight = 2;
|
|
|
46
46
|
export declare const defaultGridSizeUnits: number;
|
|
47
47
|
export declare const defaultZoomScale = 2.5;
|
|
48
48
|
export declare const fontDisplayScale = 0.032;
|
|
49
|
+
export declare const Defaults: {
|
|
50
|
+
WireLineWidth: import("./objects/NumericValue.js").NumericValue;
|
|
51
|
+
LineWidth: import("./objects/NumericValue.js").NumericValue;
|
|
52
|
+
};
|
|
49
53
|
export declare const defaultSymbolLineWidth: number;
|
|
50
|
-
export declare const defaultWireLineWidth: number;
|
|
51
54
|
export declare const defaultPinNameTextSize = 40;
|
|
52
55
|
export declare const defaultPinIdTextSize = 30;
|
|
53
56
|
export declare const defaultPageMarginMM = 10;
|
|
@@ -90,10 +93,10 @@ export declare enum ReferenceTypes {
|
|
|
90
93
|
}
|
|
91
94
|
export declare enum NetGraphicsParams {
|
|
92
95
|
Color = "color",
|
|
93
|
-
LineWidth = "
|
|
96
|
+
LineWidth = "line_width",
|
|
94
97
|
Highlight = "highlight",
|
|
95
|
-
HighlightWidth = "
|
|
96
|
-
HighlightOpacity = "
|
|
98
|
+
HighlightWidth = "highlight_width",
|
|
99
|
+
HighlightOpacity = "highlight_opacity"
|
|
97
100
|
}
|
|
98
101
|
export declare enum FrameType {
|
|
99
102
|
Frame = 1,
|
|
@@ -101,6 +104,7 @@ export declare enum FrameType {
|
|
|
101
104
|
}
|
|
102
105
|
export declare const ModuleContainsKeyword = "contains";
|
|
103
106
|
export declare const GlobalDocumentName = "document";
|
|
107
|
+
export declare const KeywordRefdesPrefix = "refdes_prefix";
|
|
104
108
|
export declare const RenderFlags: {
|
|
105
109
|
ShowElementFrames: boolean;
|
|
106
110
|
ShowOrigin: boolean;
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserRuleContext } from "antlr4ng";
|
|
2
|
-
import { BaseError } from
|
|
2
|
+
import { BaseError } from './errors.js';
|
|
3
3
|
import { ATNSimulator, BaseErrorListener, CommonTokenStream, DefaultErrorStrategy, Parser, RecognitionException, Recognizer, Token } from "antlr4ng";
|
|
4
4
|
import { CircuitScriptParser, ScriptContext } from "./antlr/CircuitScriptParser.js";
|
|
5
5
|
import { CircuitScriptLexer } from "./antlr/CircuitScriptLexer.js";
|
|
@@ -20,6 +20,13 @@ export declare enum FrameParamKeys {
|
|
|
20
20
|
SheetType = "sheet_type",
|
|
21
21
|
GridStyle = "grid_style",
|
|
22
22
|
GridColor = "grid_color",
|
|
23
|
+
BackgroundColor = "background_color",
|
|
24
|
+
LineColor = "line_color",
|
|
25
|
+
LineWidth = "line_width",
|
|
26
|
+
FillColor = "fill_color",
|
|
27
|
+
TextColor = "text_color",
|
|
28
|
+
WireColor = "wire_color",
|
|
29
|
+
WireWidth = "wire_width",
|
|
23
30
|
TitleAlign = "title_align",
|
|
24
31
|
HorizontalAlign = "align",
|
|
25
32
|
VerticalAlign = "valign",
|
|
@@ -7,6 +7,7 @@ export declare class NumericValue {
|
|
|
7
7
|
prefixPart: number;
|
|
8
8
|
constructor(value: string | number | Big, prefix?: number);
|
|
9
9
|
toString(): string;
|
|
10
|
+
copy(): NumericValue;
|
|
10
11
|
toDisplayString(): string;
|
|
11
12
|
toNumber(): number;
|
|
12
13
|
toBigNumber(): Big;
|
|
@@ -18,6 +19,9 @@ export declare class NumericValue {
|
|
|
18
19
|
mod(value: NumericValue | number): NumericValue;
|
|
19
20
|
neg(): NumericValue;
|
|
20
21
|
eq(value: NumericValue): boolean;
|
|
22
|
+
floor(): NumericValue;
|
|
23
|
+
ceil(): NumericValue;
|
|
24
|
+
roundDp(): NumericValue;
|
|
21
25
|
}
|
|
22
26
|
export type NumberOperatorType = NumericValue | PercentageValue | WrappedNumber;
|
|
23
27
|
export declare class NumberOperator {
|
|
@@ -32,4 +36,4 @@ export declare function numeric(value: number | string): NumericValue;
|
|
|
32
36
|
export declare function getNumberExponentialText(value: number): string;
|
|
33
37
|
export declare function getNumberExponential(value: string): number;
|
|
34
38
|
export declare function resolveToNumericValue(value: Big): NumericValue;
|
|
35
|
-
export declare function roundValue(value: NumericValue): NumericValue;
|
|
39
|
+
export declare function roundValue(value: NumericValue | number): NumericValue;
|
|
@@ -5,6 +5,7 @@ import { PinTypes } from "../objects/PinTypes.js";
|
|
|
5
5
|
import { ParserRuleContext } from "antlr4ng";
|
|
6
6
|
import { NumericValue } from "../objects/NumericValue.js";
|
|
7
7
|
import { PinId } from "../objects/PinDefinition.js";
|
|
8
|
+
import { Styles } from "src/styles.js";
|
|
8
9
|
export declare abstract class SymbolGraphic {
|
|
9
10
|
drawPortsName: boolean;
|
|
10
11
|
displayBounds: boolean;
|
|
@@ -15,6 +16,7 @@ export declare abstract class SymbolGraphic {
|
|
|
15
16
|
width: NumericValue;
|
|
16
17
|
height: NumericValue;
|
|
17
18
|
labelTexts: Map<string, string>;
|
|
19
|
+
styles?: Styles;
|
|
18
20
|
constructor();
|
|
19
21
|
get angle(): number;
|
|
20
22
|
set angle(value: number);
|
|
@@ -29,6 +31,7 @@ export declare abstract class SymbolGraphic {
|
|
|
29
31
|
width: NumericValue;
|
|
30
32
|
height: NumericValue;
|
|
31
33
|
};
|
|
34
|
+
setStyles(styles: Styles): void;
|
|
32
35
|
abstract generateDrawing(): void;
|
|
33
36
|
size(): {
|
|
34
37
|
width: number;
|
|
@@ -58,6 +61,7 @@ export declare class SymbolText extends SymbolGraphic {
|
|
|
58
61
|
generateDrawing(): void;
|
|
59
62
|
}
|
|
60
63
|
export declare class SymbolPlaceholder extends SymbolGraphic {
|
|
64
|
+
styles: Styles;
|
|
61
65
|
generateDrawing(): void;
|
|
62
66
|
private resolveReference;
|
|
63
67
|
parseLabelStyle(keywordParams: Map<string, any>): {
|
|
@@ -65,6 +69,7 @@ export declare class SymbolPlaceholder extends SymbolGraphic {
|
|
|
65
69
|
};
|
|
66
70
|
drawPinParams(drawing: SymbolDrawingCommands, commandName: string, keywordParams: Map<string, any>, positionParams: any[], lineColor: string, pinNameColor: string): void;
|
|
67
71
|
constructor(drawing: SymbolDrawing);
|
|
72
|
+
setStyles(styles: Styles): void;
|
|
68
73
|
}
|
|
69
74
|
export declare enum PlaceHolderCommands {
|
|
70
75
|
arc = "arc",
|
|
@@ -80,10 +85,10 @@ export declare enum PlaceHolderCommands {
|
|
|
80
85
|
line = "line",
|
|
81
86
|
label = "label",
|
|
82
87
|
path = "path",
|
|
83
|
-
lineWidth = "
|
|
88
|
+
lineWidth = "line_width",
|
|
84
89
|
fill = "fill",
|
|
85
|
-
lineColor = "
|
|
86
|
-
textColor = "
|
|
90
|
+
lineColor = "line_color",
|
|
91
|
+
textColor = "text_color",
|
|
87
92
|
text = "text",
|
|
88
93
|
units = "units",
|
|
89
94
|
for = "for"
|
|
@@ -14,8 +14,8 @@ export type LabelStyle = {
|
|
|
14
14
|
fontSize?: NumericValue;
|
|
15
15
|
fontWeight?: string;
|
|
16
16
|
angle?: NumericValue;
|
|
17
|
-
anchor?: HorizontalAlign.Left | HorizontalAlign.
|
|
18
|
-
vanchor?: VerticalAlign.Top | VerticalAlign.
|
|
17
|
+
anchor?: HorizontalAlign.Left | HorizontalAlign.Center | HorizontalAlign.Right;
|
|
18
|
+
vanchor?: VerticalAlign.Top | VerticalAlign.Center | VerticalAlign.Bottom;
|
|
19
19
|
textColor?: string;
|
|
20
20
|
portType?: null | PinTypes;
|
|
21
21
|
};
|
|
@@ -84,12 +84,12 @@ export declare class Geometry {
|
|
|
84
84
|
type WirePointCount = [x: number, y: number, count: number];
|
|
85
85
|
export declare enum HorizontalAlign {
|
|
86
86
|
Left = "left",
|
|
87
|
-
|
|
87
|
+
Center = "center",
|
|
88
88
|
Right = "right"
|
|
89
89
|
}
|
|
90
90
|
export declare enum VerticalAlign {
|
|
91
91
|
Top = "top",
|
|
92
|
-
|
|
92
|
+
Center = "center",
|
|
93
93
|
Bottom = "bottom"
|
|
94
94
|
}
|
|
95
95
|
export declare enum HorizontalAlignProp {
|
|
@@ -7,9 +7,12 @@ import { Net } from "../objects/Net.js";
|
|
|
7
7
|
import { Logger } from "../logger.js";
|
|
8
8
|
import { ComponentPinNetPair } from "../objects/types.js";
|
|
9
9
|
import { PinId } from "../objects/PinDefinition.js";
|
|
10
|
+
import { Styles } from "src/styles.js";
|
|
10
11
|
export declare class NetGraph {
|
|
11
12
|
logger: Logger;
|
|
13
|
+
styles: Styles;
|
|
12
14
|
constructor(logger: Logger);
|
|
15
|
+
setStyles(styles: Styles): void;
|
|
13
16
|
generateLayoutGraph(sequence: SequenceItem[], nets: [ClassComponent, pin: PinId, net: Net][]): {
|
|
14
17
|
graph: Graph;
|
|
15
18
|
containerFrames: RenderFrame[];
|
|
@@ -118,15 +118,21 @@ export declare class RenderFrame extends RenderObject {
|
|
|
118
118
|
padding: NumericValue;
|
|
119
119
|
gap: NumericValue;
|
|
120
120
|
borderWidth: NumericValue;
|
|
121
|
+
borderColor: string;
|
|
121
122
|
direction: FramePlotDirection;
|
|
122
123
|
width: NumericValue | null;
|
|
123
124
|
height: NumericValue | null;
|
|
124
125
|
subgraphId: string;
|
|
125
126
|
renderType: RenderFrameType;
|
|
126
127
|
containsTitle: boolean;
|
|
128
|
+
overwriteAlignParamsForTitleLayout: boolean;
|
|
129
|
+
virtual: boolean;
|
|
130
|
+
didResize: boolean;
|
|
131
|
+
lineIndex: number;
|
|
127
132
|
frameId: number;
|
|
128
|
-
constructor(frame: Frame, type?: RenderFrameType);
|
|
133
|
+
constructor(frame: Frame, type?: RenderFrameType, virtual?: boolean);
|
|
129
134
|
toString(): string;
|
|
135
|
+
static createContainer(gap: NumericValue): RenderFrame;
|
|
130
136
|
}
|
|
131
137
|
export declare enum RenderFrameType {
|
|
132
138
|
Container = 1,
|
|
@@ -3,6 +3,7 @@ import { Svg } from '@svgdotjs/svg.js';
|
|
|
3
3
|
import { SheetFrame } from "./layout.js";
|
|
4
4
|
import { Logger } from '../logger.js';
|
|
5
5
|
import { DocumentVariable } from 'src/objects/types.js';
|
|
6
|
-
|
|
6
|
+
import { Styles } from 'src/styles.js';
|
|
7
|
+
export declare function renderSheetsToSVG(sheetFrames: SheetFrame[], logger: Logger, documentVariable: DocumentVariable, styles: Styles): Svg;
|
|
7
8
|
export declare function generateSvgOutput(canvas: Svg, zoomScale?: number): string;
|
|
8
9
|
export declare function generatePdfOutput(doc: PDFKit.PDFDocument, canvas: Svg, sheetSize: string, sheetSizeDefined: boolean, zoomScale?: number): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NumericValue } from "./objects/NumericValue.js";
|
|
2
|
+
import { DocumentVariable } from "./objects/types.js";
|
|
3
|
+
export declare class Styles {
|
|
4
|
+
lineColor?: string;
|
|
5
|
+
lineWidth?: NumericValue;
|
|
6
|
+
fillColor?: string;
|
|
7
|
+
textColor?: string;
|
|
8
|
+
wireColor?: string;
|
|
9
|
+
wireWidth?: NumericValue;
|
|
10
|
+
}
|
|
11
|
+
export declare function getStylesFromDocument(document: DocumentVariable): Styles;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParserRuleContext
|
|
1
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
2
2
|
import { ClassComponent } from "./objects/ClassComponent.js";
|
|
3
3
|
import { SequenceAction, SequenceItem } from './objects/ExecutionScope.js';
|
|
4
4
|
import { BlockTypes } from "./objects/BlockTypes.js";
|
|
@@ -24,43 +24,18 @@ export declare function resizeBounds(bounds: BoundBox, value: number): BoundBox;
|
|
|
24
24
|
export declare function printBounds(bounds: BoundBox): string;
|
|
25
25
|
export declare function resizeToNearestGrid(bounds: BoundBox, gridSize?: number): BoundBox;
|
|
26
26
|
export declare function toNearestGrid(value: number, gridSize: number): number;
|
|
27
|
+
export declare function toNearestGrid2(value: number, gridSize: number): number;
|
|
27
28
|
export declare function getBoundsSize(bounds: BoundBox): {
|
|
28
29
|
width: number;
|
|
29
30
|
height: number;
|
|
30
31
|
};
|
|
31
32
|
export declare function getPortType(component: ClassComponent): string | null;
|
|
32
|
-
export declare function throwWithContext(context: ParserRuleContext, messageOrError: string | BaseError): void;
|
|
33
|
-
export declare function throwWithToken(message: string, token: Token): void;
|
|
34
|
-
export declare function throwWithTokenRange(message: string, startToken: Token, endToken?: Token): void;
|
|
35
33
|
export declare function combineMaps(map1: Map<string, any>, map2: Map<string, any>): Map<string, any>;
|
|
36
34
|
export declare function isPointWithinArea(point: [x: number, y: number], bounds: BoundBox2): boolean;
|
|
37
35
|
export declare function areasOverlap(area1: BoundBox2, area2: BoundBox2): boolean;
|
|
38
36
|
export declare function sequenceActionString(sequenceAction: SequenceAction): string;
|
|
39
37
|
export declare function generateDebugSequenceAction(sequence: SequenceItem[]): string[];
|
|
40
38
|
export declare function getBlockTypeString(type: BlockTypes): string;
|
|
41
|
-
export declare class BaseError extends Error {
|
|
42
|
-
name: string;
|
|
43
|
-
message: string;
|
|
44
|
-
startToken?: Token;
|
|
45
|
-
endToken?: Token;
|
|
46
|
-
filePath?: string;
|
|
47
|
-
constructor(message: string, startTokenOrCtx?: Token | ParserRuleContext, endToken?: Token, filePath?: string);
|
|
48
|
-
toString(): string;
|
|
49
|
-
}
|
|
50
|
-
export declare function getLinePositionAsString(ctx: ParserRuleContext): string | null;
|
|
51
|
-
export declare class ParseSyntaxError extends BaseError {
|
|
52
|
-
name: string;
|
|
53
|
-
}
|
|
54
|
-
export declare class ParseError extends ParseSyntaxError {
|
|
55
|
-
name: string;
|
|
56
|
-
}
|
|
57
|
-
export declare class RuntimeExecutionError extends BaseError {
|
|
58
|
-
name: string;
|
|
59
|
-
}
|
|
60
|
-
export declare class RenderError extends Error {
|
|
61
|
-
stage?: string;
|
|
62
|
-
constructor(message: string, stage?: string);
|
|
63
|
-
}
|
|
64
39
|
export type ExecutionWarning = {
|
|
65
40
|
message: string;
|
|
66
41
|
fileName?: string;
|
package/dist/types/visitor.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { NodeScriptEnvironment } from './environment/environment.js';
|
|
|
11
11
|
export declare class ParserVisitor extends BaseVisitor {
|
|
12
12
|
constructor(silent: boolean | undefined, onErrorHandler: OnErrorHandler | null | undefined, environment: NodeScriptEnvironment);
|
|
13
13
|
componentCreationIndex: number;
|
|
14
|
-
creationCtx: Map<
|
|
14
|
+
creationCtx: Map<ClassComponent | Wire, ParserRuleContext>;
|
|
15
15
|
visitPin_select_expr: (ctx: Pin_select_exprContext) => void;
|
|
16
16
|
trackNewComponentCreated: (callback: () => void) => boolean;
|
|
17
17
|
visitAdd_component_expr: (ctx: Add_component_exprContext) => void;
|
package/libs/std.cst
CHANGED
|
@@ -7,7 +7,7 @@ def net(net_name, net_type = "any"):
|
|
|
7
7
|
display: create graphic (params):
|
|
8
8
|
hline: -50, 0, 100
|
|
9
9
|
vpin: 1, 0, 50, -50, display_id=false
|
|
10
|
-
label: params.net_name, 0, -15, fontSize=50, anchor="
|
|
10
|
+
label: params.net_name, 0, -15, fontSize=50, anchor="center"
|
|
11
11
|
type: "net"
|
|
12
12
|
params:
|
|
13
13
|
net_name: net_name
|
|
@@ -24,7 +24,7 @@ def label(value, anchor="left"):
|
|
|
24
24
|
copy: true
|
|
25
25
|
followWireOrientation: false
|
|
26
26
|
display: create graphic (params):
|
|
27
|
-
|
|
27
|
+
text_color: "#222"
|
|
28
28
|
label: params.value, 0, -10, fontSize=50, anchor=anchor
|
|
29
29
|
pin: 1, 0, 0, 0, 0, display_id=false
|
|
30
30
|
type: "net"
|
|
@@ -38,8 +38,8 @@ def port(value, portType="input"):
|
|
|
38
38
|
pins: 1
|
|
39
39
|
copy: true
|
|
40
40
|
display: create graphic (params):
|
|
41
|
-
|
|
42
|
-
label: params.value, 0, 0, fontSize=40, anchor="left", vanchor="
|
|
41
|
+
text_color: "#222"
|
|
42
|
+
label: params.value, 0, 0, fontSize=40, anchor="left", vanchor="center", portType=portType
|
|
43
43
|
pin: 1, 0, 0, 0, 0, display_id=false
|
|
44
44
|
type: "port"
|
|
45
45
|
params:
|
|
@@ -58,7 +58,7 @@ def res(value):
|
|
|
58
58
|
hpin: 1, -width/2 - 30, 0, 30, display_id=false
|
|
59
59
|
hpin: 2, width/2 + 30, 0, -30, display_id=false
|
|
60
60
|
label: params.refdes, -width/2, -height/2 - 20, fontSize=50, anchor="left"
|
|
61
|
-
label: params.value, 0, 0, fontSize=30, anchor="
|
|
61
|
+
label: params.value, 0, 0, fontSize=30, anchor="center", vanchor="center"
|
|
62
62
|
type: "res"
|
|
63
63
|
params:
|
|
64
64
|
value: value
|
|
@@ -73,13 +73,13 @@ def cap(value):
|
|
|
73
73
|
return create component:
|
|
74
74
|
pins: 2
|
|
75
75
|
display: create graphic (params):
|
|
76
|
-
|
|
76
|
+
line_width: 13
|
|
77
77
|
hline: -width/2, 20, width
|
|
78
78
|
hline: -width/2, -20, width
|
|
79
79
|
vpin: 1, 0, -100, 80, display_id=false
|
|
80
80
|
vpin: 2, 0, 100, -80, display_id=false
|
|
81
|
-
label: params.refdes, 80, -30, fontSize=50, anchor="left", vanchor="
|
|
82
|
-
label: params.value, 80, 30, fontSize=50, anchor = "left", vanchor="
|
|
81
|
+
label: params.refdes, 80, -30, fontSize=50, anchor="left", vanchor="center"
|
|
82
|
+
label: params.value, 80, 30, fontSize=50, anchor = "left", vanchor="center"
|
|
83
83
|
type: "cap"
|
|
84
84
|
params:
|
|
85
85
|
value: value
|
|
@@ -101,7 +101,7 @@ def ind(value):
|
|
|
101
101
|
hpin: 1, -width/2 - 100, 0, 100, display_id=false
|
|
102
102
|
hpin: 2, width/2 + 100, 0, -100, display_id=false
|
|
103
103
|
label: (params.refdes, -width/2, -height/2 - 25 , fontSize=50, anchor="left")
|
|
104
|
-
label: (params.value, 0, 50, fontSize=50, anchor="
|
|
104
|
+
label: (params.value, 0, 50, fontSize=50, anchor="center", vanchor="center")
|
|
105
105
|
params:
|
|
106
106
|
value: value
|
|
107
107
|
|
|
@@ -119,7 +119,7 @@ def diode():
|
|
|
119
119
|
vline: width/2, -height/2, height
|
|
120
120
|
hpin: 1, -width/2-100, 0, 100 # cathode
|
|
121
121
|
hpin: 2, width/2 + 100, 0, -100 # anode
|
|
122
|
-
label: params.refdes, 0, -100, fontSize=50, anchor="
|
|
122
|
+
label: params.refdes, 0, -100, fontSize=50, anchor="center", vanchor="top"
|
|
123
123
|
|
|
124
124
|
def led(color):
|
|
125
125
|
width = 100
|
|
@@ -140,8 +140,8 @@ def led(color):
|
|
|
140
140
|
"M", 180, 60, "L", 180, 90, "L", 150, 90)
|
|
141
141
|
hpin: 1, width/2 + 100, 0, -100 # cathode
|
|
142
142
|
hpin: 2, -width/2-100, 0, 100 # anode
|
|
143
|
-
label: params.refdes, 0, -100, fontSize=50, anchor="
|
|
144
|
-
label: params.color, 0, 100, fontSize=40, anchor="
|
|
143
|
+
label: params.refdes, 0, -100, fontSize=50, anchor="center", vanchor="top"
|
|
144
|
+
label: params.color, 0, 100, fontSize=40, anchor="center", vanchor="bottom"
|
|
145
145
|
params:
|
|
146
146
|
size: "0603"
|
|
147
147
|
color: color
|
|
@@ -159,7 +159,7 @@ def cgnd():
|
|
|
159
159
|
hline: -10, 5, 20
|
|
160
160
|
hline: -5, 10, 10
|
|
161
161
|
vpin: 1, 0, -10, 10, display_id=false
|
|
162
|
-
label: params.net_name, 0, 22, fontSize=50, anchor="
|
|
162
|
+
label: params.net_name, 0, 22, fontSize=50, anchor="center"
|
|
163
163
|
type: "net"
|
|
164
164
|
params:
|
|
165
165
|
net_name: net_name
|
|
@@ -175,7 +175,7 @@ def dgnd(net_name="GND"):
|
|
|
175
175
|
display: create graphic (params):
|
|
176
176
|
triangle: 0, 0, 0, height, width
|
|
177
177
|
vpin: 1, 0, -50, 50, display_id=false
|
|
178
|
-
label: params.net_name, 0, height + 50, fontSize=50, anchor="
|
|
178
|
+
label: params.net_name, 0, height + 50, fontSize=50, anchor="center", vanchor="center"
|
|
179
179
|
type: "net"
|
|
180
180
|
params:
|
|
181
181
|
net_name: net_name
|
|
@@ -208,7 +208,7 @@ def arrow_point():
|
|
|
208
208
|
pins: 1
|
|
209
209
|
followWireOrientation: false
|
|
210
210
|
display: create graphic:
|
|
211
|
-
|
|
211
|
+
line_width: 2
|
|
212
212
|
path: ("M", -10, -5, "L", -5, 0, "L", -10, 5)
|
|
213
213
|
path: ("M", -5, 0, "L", -20, 0)
|
|
214
214
|
hpin: 1, 0, 0, 0, display_id=false
|
|
@@ -269,12 +269,12 @@ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin
|
|
|
269
269
|
fill: "none"
|
|
270
270
|
|
|
271
271
|
# outer rect
|
|
272
|
-
|
|
272
|
+
line_color: "#cccccc"
|
|
273
273
|
crect: (paper_width/2, paper_height/2,
|
|
274
274
|
paper_width, paper_height, class="paper-area")
|
|
275
275
|
|
|
276
276
|
# inner rect
|
|
277
|
-
|
|
277
|
+
line_color: "#111111"
|
|
278
278
|
crect: (paper_width/2, paper_height/2,
|
|
279
279
|
inner_width, inner_height, class="plot-area")
|
|
280
280
|
|
|
@@ -296,30 +296,30 @@ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin
|
|
|
296
296
|
content: i
|
|
297
297
|
offset: tmp_x + tmp_width * ratio_x * (0.5 + (i-1)), tmp_y + inner_frame_margin * 0.5 + 2
|
|
298
298
|
fontSize: fontSize
|
|
299
|
-
anchor: "
|
|
300
|
-
vanchor: "
|
|
299
|
+
anchor: "center"
|
|
300
|
+
vanchor: "center"
|
|
301
301
|
|
|
302
302
|
text:
|
|
303
303
|
content: i
|
|
304
304
|
offset: tmp_x + tmp_width * ratio_x * (0.5 + (i-1)), tmp_y + tmp_height - inner_frame_margin * 0.5 + 2
|
|
305
305
|
fontSize: fontSize
|
|
306
|
-
anchor: "
|
|
307
|
-
vanchor: "
|
|
306
|
+
anchor: "center"
|
|
307
|
+
vanchor: "center"
|
|
308
308
|
|
|
309
309
|
for index, val in enumerate(row_display_value):
|
|
310
310
|
text:
|
|
311
311
|
content: val
|
|
312
312
|
offset: tmp_x + inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * (0.5 + index)
|
|
313
313
|
fontSize: fontSize
|
|
314
|
-
anchor: "
|
|
315
|
-
vanchor: "
|
|
314
|
+
anchor: "center"
|
|
315
|
+
vanchor: "center"
|
|
316
316
|
|
|
317
317
|
text:
|
|
318
318
|
content: val
|
|
319
319
|
offset: tmp_x + tmp_width - inner_frame_margin * 0.5, tmp_y + tmp_height * ratio_y * (0.5 + index)
|
|
320
320
|
fontSize: fontSize
|
|
321
|
-
anchor: "
|
|
322
|
-
vanchor: "
|
|
321
|
+
anchor: "center"
|
|
322
|
+
vanchor: "center"
|
|
323
323
|
|
|
324
324
|
# Draw title frame
|
|
325
325
|
text:
|
|
@@ -375,47 +375,47 @@ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin
|
|
|
375
375
|
grid_height: paper_height - 2 * margin_y
|
|
376
376
|
|
|
377
377
|
def sheet_A1():
|
|
378
|
-
paper_width =
|
|
379
|
-
paper_height =
|
|
378
|
+
paper_width = to_mils(841)
|
|
379
|
+
paper_height = to_mils(594)
|
|
380
380
|
margin = 400
|
|
381
381
|
|
|
382
382
|
return sheet_generator("A1", paper_width, paper_height, margin, margin,
|
|
383
383
|
range(1, 17), ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"])
|
|
384
384
|
|
|
385
385
|
def sheet_A2():
|
|
386
|
-
paper_width =
|
|
387
|
-
paper_height =
|
|
386
|
+
paper_width = to_mils(594)
|
|
387
|
+
paper_height = to_mils(420)
|
|
388
388
|
margin = 400
|
|
389
389
|
|
|
390
390
|
return sheet_generator("A2", paper_width, paper_height, margin, margin,
|
|
391
391
|
range(1, 13), ["A", "B", "C", "D", "E", "F", "G", "H"])
|
|
392
392
|
|
|
393
393
|
def sheet_A3():
|
|
394
|
-
paper_width =
|
|
395
|
-
paper_height =
|
|
394
|
+
paper_width = to_mils(420)
|
|
395
|
+
paper_height = to_mils(297)
|
|
396
396
|
margin = 400
|
|
397
397
|
|
|
398
398
|
return sheet_generator("A3", paper_width, paper_height, margin, margin,
|
|
399
399
|
range(1, 9), ["A", "B", "C", "D", "E", "F"])
|
|
400
400
|
|
|
401
401
|
def sheet_A4():
|
|
402
|
-
paper_width =
|
|
403
|
-
paper_height =
|
|
402
|
+
paper_width = to_mils(297)
|
|
403
|
+
paper_height = to_mils(210)
|
|
404
404
|
margin = 400
|
|
405
405
|
|
|
406
406
|
return sheet_generator("A4", paper_width, paper_height, margin, margin,
|
|
407
407
|
range(1, 7), ["A", "B", "C", "D"])
|
|
408
408
|
|
|
409
409
|
def sheet_A5():
|
|
410
|
-
paper_width =
|
|
411
|
-
paper_height =
|
|
410
|
+
paper_width = to_mils(210)
|
|
411
|
+
paper_height = to_mils(148)
|
|
412
412
|
margin = 400
|
|
413
413
|
|
|
414
414
|
return sheet_generator("A5", paper_width, paper_height, margin, margin, range(1, 5), ["A", "B", "C"])
|
|
415
415
|
|
|
416
416
|
def sheet_A6(revision="V1"):
|
|
417
|
-
paper_width =
|
|
418
|
-
paper_height =
|
|
417
|
+
paper_width = to_mils(148)
|
|
418
|
+
paper_height = to_mils(105)
|
|
419
419
|
margin = 400
|
|
420
420
|
|
|
421
421
|
tmp_sheet = sheet_generator("A6", paper_width, paper_height, margin, margin, range(1, 4), ["A", "B"])
|