circuitscript 0.1.2 → 0.1.3
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/draw_symbols.js +34 -35
- package/dist/cjs/execute.js +1 -1
- package/dist/cjs/globals.js +5 -4
- package/dist/cjs/helpers.js +1 -1
- package/dist/cjs/layout.js +396 -281
- package/dist/cjs/objects/Frame.js +9 -1
- package/dist/cjs/objects/ParamDefinition.js +3 -0
- package/dist/cjs/render.js +45 -37
- package/dist/cjs/utils.js +19 -1
- package/dist/cjs/visitor.js +10 -1
- package/dist/esm/draw_symbols.mjs +34 -35
- package/dist/esm/execute.mjs +1 -1
- package/dist/esm/globals.mjs +5 -4
- package/dist/esm/helpers.mjs +1 -1
- package/dist/esm/layout.mjs +400 -285
- package/dist/esm/objects/Frame.mjs +8 -0
- package/dist/esm/objects/ParamDefinition.mjs +3 -0
- package/dist/esm/render.mjs +46 -38
- package/dist/esm/utils.mjs +16 -0
- package/dist/esm/visitor.mjs +10 -1
- package/dist/types/draw_symbols.d.ts +3 -2
- package/dist/types/globals.d.ts +1 -1
- package/dist/types/layout.d.ts +14 -33
- package/dist/types/objects/ExecutionScope.d.ts +1 -1
- package/dist/types/objects/Frame.d.ts +7 -0
- package/dist/types/objects/ParamDefinition.d.ts +1 -0
- package/dist/types/utils.d.ts +8 -0
- package/libs/lib.cst +10 -5
- package/package.json +1 -1
|
@@ -8,6 +8,11 @@ export class Frame {
|
|
|
8
8
|
this.frameType = frameType;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
export var FixedFrameIds;
|
|
12
|
+
(function (FixedFrameIds) {
|
|
13
|
+
FixedFrameIds[FixedFrameIds["BaseFrame"] = -1] = "BaseFrame";
|
|
14
|
+
FixedFrameIds[FixedFrameIds["FrameIdNotUsed"] = -2] = "FrameIdNotUsed";
|
|
15
|
+
})(FixedFrameIds || (FixedFrameIds = {}));
|
|
11
16
|
export var FrameParamKeys;
|
|
12
17
|
(function (FrameParamKeys) {
|
|
13
18
|
FrameParamKeys["Title"] = "title";
|
|
@@ -18,6 +23,9 @@ export var FrameParamKeys;
|
|
|
18
23
|
FrameParamKeys["Height"] = "height";
|
|
19
24
|
FrameParamKeys["PaperSize"] = "paper_size";
|
|
20
25
|
FrameParamKeys["SheetType"] = "sheet_type";
|
|
26
|
+
FrameParamKeys["TitleAlign"] = "title_align";
|
|
27
|
+
FrameParamKeys["HorizontalAlign"] = "align";
|
|
28
|
+
FrameParamKeys["VerticalAlign"] = "valign";
|
|
21
29
|
FrameParamKeys["SheetNumber"] = "sheet_number";
|
|
22
30
|
FrameParamKeys["SheetTotal"] = "sheet_total";
|
|
23
31
|
})(FrameParamKeys || (FrameParamKeys = {}));
|
package/dist/esm/render.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { SVG, registerWindow } from '@svgdotjs/svg.js';
|
|
|
2
2
|
import { ExtractDrawingRects, RenderFrameType, getBounds } from "./layout.mjs";
|
|
3
3
|
import { applyFontsToSVG, getCreateSVGWindow } from './sizing.mjs';
|
|
4
4
|
import { ColorScheme, ComponentTypes, FrameType, MMToPt, MMToPx, ParamKeys, RenderFlags, defaultGridSizeUnits, defaultPageSpacingMM, defaultWireLineWidth, fontDisplayScale, junctionSize } from './globals.mjs';
|
|
5
|
-
import { NumericValue } from './objects/ParamDefinition.mjs';
|
|
5
|
+
import { numeric, NumericValue } from './objects/ParamDefinition.mjs';
|
|
6
6
|
import { combineMaps, getBoundsSize } from './utils.mjs';
|
|
7
7
|
import { getPaperSize, milsToMM } from './helpers.mjs';
|
|
8
8
|
import SVGtoPDF from 'svg-to-pdfkit';
|
|
@@ -28,7 +28,7 @@ export function renderSheetsToSVG(sheetFrames, logger) {
|
|
|
28
28
|
let extendGrid = true;
|
|
29
29
|
let xOffset = 0;
|
|
30
30
|
let yOffset = 0;
|
|
31
|
-
let sheetYOffset = 0;
|
|
31
|
+
let sheetYOffset = numeric(0);
|
|
32
32
|
if (sheet.frame.frame) {
|
|
33
33
|
logger.add('drawing frame');
|
|
34
34
|
const frameComponent = sheet.frame.frame.parameters
|
|
@@ -38,29 +38,33 @@ export function renderSheetsToSVG(sheetFrames, logger) {
|
|
|
38
38
|
throw 'Invalid graphic object for sheet frame';
|
|
39
39
|
}
|
|
40
40
|
const frameRects = ExtractDrawingRects(frameComponent.displayProp) ?? [];
|
|
41
|
-
let originalWidthMM = 0;
|
|
42
|
-
let originalHeightMM = 0;
|
|
43
|
-
let widthMM = 0;
|
|
44
|
-
let heightMM = 0;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
let originalWidthMM = numeric(0);
|
|
42
|
+
let originalHeightMM = numeric(0);
|
|
43
|
+
let widthMM = numeric(0);
|
|
44
|
+
let heightMM = numeric(0);
|
|
45
|
+
const paperRect = frameRects.find(item => item.className === 'paper-area');
|
|
46
|
+
const plotRect = frameRects.find(item => item.className === 'plot-area');
|
|
47
|
+
if (paperRect) {
|
|
48
|
+
originalWidthMM = milsToMM(paperRect.width);
|
|
49
|
+
originalHeightMM = milsToMM(paperRect.height);
|
|
50
|
+
logger.add('first frame size: ' + originalWidthMM.toNumber()
|
|
51
|
+
+ ' ' + originalHeightMM.toNumber());
|
|
49
52
|
}
|
|
50
|
-
if (
|
|
51
|
-
widthMM = milsToMM(
|
|
52
|
-
heightMM = milsToMM(
|
|
53
|
-
logger.add('second frame size: ' + widthMM
|
|
53
|
+
if (plotRect) {
|
|
54
|
+
widthMM = milsToMM(plotRect.width);
|
|
55
|
+
heightMM = milsToMM(plotRect.height);
|
|
56
|
+
logger.add('second frame size: ' + widthMM.toNumber()
|
|
57
|
+
+ ' ' + heightMM.toNumber());
|
|
54
58
|
}
|
|
55
|
-
xOffset = (originalWidthMM
|
|
56
|
-
yOffset = (originalHeightMM
|
|
59
|
+
xOffset = (originalWidthMM.sub(widthMM)).half().toNumber();
|
|
60
|
+
yOffset = (originalHeightMM.sub(heightMM)).half().toNumber();
|
|
57
61
|
logger.add('offset', xOffset, yOffset);
|
|
58
|
-
sheetYOffset =
|
|
62
|
+
sheetYOffset = originalHeightMM.add(defaultPageSpacingMM).mul(index);
|
|
59
63
|
gridBounds = {
|
|
60
64
|
xmin: 0,
|
|
61
65
|
ymin: 0,
|
|
62
|
-
xmax: widthMM,
|
|
63
|
-
ymax: heightMM
|
|
66
|
+
xmax: widthMM.toNumber(),
|
|
67
|
+
ymax: heightMM.toNumber()
|
|
64
68
|
};
|
|
65
69
|
extendGrid = false;
|
|
66
70
|
}
|
|
@@ -70,7 +74,7 @@ export function renderSheetsToSVG(sheetFrames, logger) {
|
|
|
70
74
|
const sheetElements = sheetGroup.group().addClass('sheet-elements');
|
|
71
75
|
generateSVGChild(sheetElements, components, wires, junctions, mergedWires, allFrames, textObjects, gridBounds, extendGrid, logger);
|
|
72
76
|
sheetElements.translate(xOffset, yOffset);
|
|
73
|
-
sheetGroup.translate(0, sheetYOffset);
|
|
77
|
+
sheetGroup.translate(0, sheetYOffset.toNumber());
|
|
74
78
|
});
|
|
75
79
|
return canvas;
|
|
76
80
|
}
|
|
@@ -177,10 +181,13 @@ function generateSVGChild(canvas, components, wires, junctions, mergedWires, fra
|
|
|
177
181
|
})
|
|
178
182
|
.fill('none');
|
|
179
183
|
});
|
|
184
|
+
const halfJunctionSize = junctionSize.half();
|
|
180
185
|
intersectPoints.forEach(point => {
|
|
181
|
-
const [x, y,
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const [x, y,] = point;
|
|
187
|
+
const translateX = numeric(x).sub(halfJunctionSize);
|
|
188
|
+
const translateY = numeric(y).sub(halfJunctionSize);
|
|
189
|
+
mergedWireGroup.circle(junctionSize.toNumber())
|
|
190
|
+
.translate(translateX.toNumber(), translateY.toNumber())
|
|
184
191
|
.fill(ColorScheme.JunctionColor)
|
|
185
192
|
.stroke('none');
|
|
186
193
|
});
|
|
@@ -195,10 +202,10 @@ function generateSVGChild(canvas, components, wires, junctions, mergedWires, fra
|
|
|
195
202
|
}
|
|
196
203
|
else {
|
|
197
204
|
if (borderWidth.toNumber() > 0) {
|
|
198
|
-
if (item.
|
|
205
|
+
if (item.renderType === RenderFrameType.Container) {
|
|
199
206
|
strokeColor = '#111';
|
|
200
207
|
}
|
|
201
|
-
else if (item.
|
|
208
|
+
else if (item.renderType === RenderFrameType.Elements) {
|
|
202
209
|
strokeColor = '#aaa';
|
|
203
210
|
if (!RenderFlags.ShowElementFrames) {
|
|
204
211
|
return;
|
|
@@ -230,33 +237,34 @@ function drawGrid(group, canvasSize, extendGrid, logger) {
|
|
|
230
237
|
const gridSize = defaultGridSizeUnits;
|
|
231
238
|
const { xmin, ymin, xmax, ymax } = canvasSize;
|
|
232
239
|
const extraValue = extendGrid ? 1 : 0;
|
|
233
|
-
const gridStartX = (Math.floor(xmin / gridSize)
|
|
234
|
-
const gridStartY = (Math.floor(ymin / gridSize)
|
|
240
|
+
const gridStartX = (numeric(Math.floor(xmin / gridSize)).sub(extraValue)).mul(gridSize);
|
|
241
|
+
const gridStartY = (numeric(Math.floor(ymin / gridSize)).sub(extraValue)).mul(gridSize);
|
|
235
242
|
const gridEndX = extendGrid
|
|
236
|
-
? (Math.ceil(xmax / gridSize)
|
|
237
|
-
: (xmax
|
|
243
|
+
? (numeric(Math.ceil(xmax / gridSize)).add(extraValue)).mul(gridSize)
|
|
244
|
+
: (numeric(xmax).sub(xmin));
|
|
238
245
|
const gridEndY = extendGrid
|
|
239
|
-
? (Math.ceil(ymax / gridSize)
|
|
240
|
-
: (ymax
|
|
241
|
-
const numCols = Math.floor((
|
|
246
|
+
? (numeric(Math.ceil(ymax / gridSize)).add(extraValue)).mul(gridSize)
|
|
247
|
+
: (numeric(ymax).sub(ymin));
|
|
248
|
+
const numCols = Math.floor(gridEndX.sub(gridStartX).div(gridSize).toNumber())
|
|
242
249
|
+ (extendGrid ? 1 : 0);
|
|
243
250
|
const originSize = milsToMM(10).toNumber();
|
|
244
251
|
RenderFlags.ShowGridOrigin && group.circle(originSize)
|
|
245
252
|
.translate(-originSize / 2, -originSize / 2)
|
|
246
253
|
.stroke('none').fill('blue');
|
|
247
254
|
const lines = [];
|
|
248
|
-
const smallOffset = milsToMM(3)
|
|
249
|
-
const startY = gridStartY
|
|
250
|
-
const endY = gridEndY
|
|
255
|
+
const smallOffset = milsToMM(3);
|
|
256
|
+
const startY = gridStartY.sub(smallOffset.half());
|
|
257
|
+
const endY = gridEndY.add(smallOffset);
|
|
258
|
+
const numericGridSize = numeric(gridSize);
|
|
251
259
|
for (let i = 0; i < numCols; i++) {
|
|
252
|
-
const startX = gridStartX
|
|
253
|
-
lines.push(`M ${startX} ${startY} L ${startX} ${endY}`);
|
|
260
|
+
const startX = gridStartX.add(numericGridSize.mul(i)).toNumber();
|
|
261
|
+
lines.push(`M ${startX} ${startY.toNumber()} L ${startX} ${endY.toNumber()}`);
|
|
254
262
|
}
|
|
255
263
|
const strokeSize = milsToMM(3);
|
|
256
264
|
group.addClass('grid')
|
|
257
265
|
.path(lines.join(" "))
|
|
258
266
|
.attr({
|
|
259
|
-
'stroke-dasharray': `${strokeSize.toNumber()},${
|
|
267
|
+
'stroke-dasharray': `${strokeSize.toNumber()},${numericGridSize.sub(strokeSize).toNumber()}`,
|
|
260
268
|
})
|
|
261
269
|
.stroke({
|
|
262
270
|
width: strokeSize.toNumber(),
|
package/dist/esm/utils.mjs
CHANGED
|
@@ -151,3 +151,19 @@ export function resolveToNumericValue(value) {
|
|
|
151
151
|
}
|
|
152
152
|
return new NumericValue(useValue, prefixPart * 3);
|
|
153
153
|
}
|
|
154
|
+
export function isPointWithinArea(point, bounds) {
|
|
155
|
+
const [xPt, yPt] = point;
|
|
156
|
+
const [xmin, ymin, xmax, ymax] = bounds;
|
|
157
|
+
return (xPt > xmin && xPt < xmax && yPt > ymin && yPt < ymax);
|
|
158
|
+
}
|
|
159
|
+
export function areasOverlap(area1, area2) {
|
|
160
|
+
const [xmin, ymin, xmax, ymax] = area1;
|
|
161
|
+
const pt1 = [xmin, ymin];
|
|
162
|
+
const pt2 = [xmin, ymax];
|
|
163
|
+
const pt3 = [xmax, ymin];
|
|
164
|
+
const pt4 = [xmax, ymax];
|
|
165
|
+
return isPointWithinArea(pt1, area2)
|
|
166
|
+
|| isPointWithinArea(pt2, area2)
|
|
167
|
+
|| isPointWithinArea(pt3, area2)
|
|
168
|
+
|| isPointWithinArea(pt4, area2);
|
|
169
|
+
}
|
package/dist/esm/visitor.mjs
CHANGED
|
@@ -189,7 +189,16 @@ export class ParserVisitor extends BaseVisitor {
|
|
|
189
189
|
}
|
|
190
190
|
return accum;
|
|
191
191
|
}, []);
|
|
192
|
-
|
|
192
|
+
let useCommandName = commandName;
|
|
193
|
+
let usePositionParams = positionParams;
|
|
194
|
+
if (commandName === PlaceHolderCommands.crect) {
|
|
195
|
+
useCommandName = PlaceHolderCommands.rect;
|
|
196
|
+
const [centerX, centerY, width, height] = positionParams;
|
|
197
|
+
const newX = centerX.sub(width.half());
|
|
198
|
+
const newY = centerY.sub(height.half());
|
|
199
|
+
usePositionParams = [newX, newY, width, height];
|
|
200
|
+
}
|
|
201
|
+
accum.push([useCommandName, usePositionParams, keywordParams, item]);
|
|
193
202
|
}
|
|
194
203
|
return accum;
|
|
195
204
|
}, []);
|
|
@@ -69,6 +69,7 @@ export declare enum PlaceHolderCommands {
|
|
|
69
69
|
arc = "arc",
|
|
70
70
|
circle = "circle",
|
|
71
71
|
rect = "rect",
|
|
72
|
+
crect = "crect",
|
|
72
73
|
triangle = "triangle",
|
|
73
74
|
pin = "pin",
|
|
74
75
|
hpin = "hpin",
|
|
@@ -148,8 +149,8 @@ export declare class SymbolDrawing {
|
|
|
148
149
|
addPinMM(pinId: NumericValue, startXMM: NumericValue, startYMM: NumericValue, endXMM: NumericValue, endYMM: NumericValue, lineColor: string): SymbolDrawing;
|
|
149
150
|
addVLine(startX: NumericValue, startY: NumericValue, value: NumericValue): SymbolDrawing;
|
|
150
151
|
addHLine(startX: NumericValue, startY: NumericValue, value: NumericValue): SymbolDrawing;
|
|
151
|
-
addRect(
|
|
152
|
-
addRectMM(
|
|
152
|
+
addRect(x: NumericValue, y: NumericValue, width: NumericValue, height: NumericValue): SymbolDrawing;
|
|
153
|
+
addRectMM(x: NumericValue, y: NumericValue, width: NumericValue, height: NumericValue): SymbolDrawing;
|
|
153
154
|
addTriangle(startX: NumericValue, startY: NumericValue, endX: NumericValue, endY: NumericValue, width: NumericValue): SymbolDrawing;
|
|
154
155
|
addLabel(x: NumericValue, y: NumericValue, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
155
156
|
addLabelMils(x: NumericValue, y: NumericValue, textValue: string, style: LabelStyle): SymbolDrawing;
|
package/dist/types/globals.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare const displayUnits = LengthUnit.mils;
|
|
|
54
54
|
export declare const defaultFont = "Arial";
|
|
55
55
|
export declare const defaultFontBold = "Arial";
|
|
56
56
|
export declare const defaultFontSize = 10;
|
|
57
|
-
export declare const junctionSize:
|
|
57
|
+
export declare const junctionSize: import("./objects/ParamDefinition").NumericValue;
|
|
58
58
|
export declare const PortArrowSize: number;
|
|
59
59
|
export declare const PortPaddingHorizontal: number;
|
|
60
60
|
export declare const PortPaddingVertical: number;
|
package/dist/types/layout.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { BoundBox } from './utils.js';
|
|
|
11
11
|
import { NumericValue } from './objects/ParamDefinition.js';
|
|
12
12
|
export declare class LayoutEngine {
|
|
13
13
|
logger: Logger;
|
|
14
|
-
placeSubgraphVersion: number;
|
|
15
14
|
layoutWarnings: string[];
|
|
16
15
|
showBaseFrame: boolean;
|
|
17
16
|
constructor(options?: {
|
|
@@ -22,44 +21,28 @@ export declare class LayoutEngine {
|
|
|
22
21
|
protected padLevel(value: number): string;
|
|
23
22
|
runLayout(sequence: SequenceItem[], nets: [ClassComponent, pin: number, net: Net][]): SheetFrame[];
|
|
24
23
|
private flattenFrameItems;
|
|
25
|
-
findJunctions
|
|
26
|
-
|
|
27
|
-
mergedWires: MergedWire[];
|
|
28
|
-
};
|
|
29
|
-
placeFrames(graph: Graph, subgraphInfo: SubGraphInfo[], frameObjects: RenderFrame[]): {
|
|
30
|
-
elementFrames: RenderFrame[];
|
|
31
|
-
textObjects: RenderText[];
|
|
32
|
-
};
|
|
24
|
+
private findJunctions;
|
|
25
|
+
private placeFrames;
|
|
33
26
|
collectElementFrames(frame: RenderFrame, level?: number): RenderFrame[];
|
|
34
27
|
applyFrameOffset(frame: RenderFrame, level?: number): void;
|
|
35
|
-
placeAndSizeFrame
|
|
28
|
+
private placeAndSizeFrame;
|
|
36
29
|
dumpFrame(frame: RenderFrame, level?: number): void;
|
|
37
|
-
prepareFrames
|
|
38
|
-
|
|
39
|
-
textObjects: RenderText[];
|
|
40
|
-
};
|
|
30
|
+
private prepareFrames;
|
|
31
|
+
private checkAddFrameTitle;
|
|
41
32
|
generateLayoutGraph(sequence: SequenceItem[], nets: [ClassComponent, pin: number, net: Net][]): {
|
|
42
33
|
graph: Graph;
|
|
43
34
|
containerFrames: RenderFrame[];
|
|
44
35
|
};
|
|
45
|
-
setGraphEdge
|
|
46
|
-
sizeSubGraphs
|
|
47
|
-
walkAndPlaceGraph
|
|
36
|
+
private setGraphEdge;
|
|
37
|
+
private sizeSubGraphs;
|
|
38
|
+
private walkAndPlaceGraph;
|
|
48
39
|
placeSubgraphV2(graph: Graph, firstNodeId: string, subgraphEdges: Edge[]): void;
|
|
49
40
|
mergeOriginNodes(node1: RenderItem, pin1: number, node2: RenderItem, pin2: number, originNode1: string, originNode2: string, originNodes: RenderItem[], originNodeGroups: Map<string, RenderItem[]>): void;
|
|
50
|
-
placeSubgraph(graph: Graph, firstNodeId: string, subgraphEdges: Edge[]): void;
|
|
51
41
|
translateNodeBy(offsetX: number, offsetY: number, item: RenderItem): void;
|
|
52
42
|
placeNodeAtPosition(fromX: NumericValue, fromY: NumericValue, item: RenderItem, pin: number, depth?: number): void;
|
|
53
43
|
placeFloatingItems(graph: Graph, item: RenderItem, depth?: number): void;
|
|
54
44
|
printWarnings(): void;
|
|
55
45
|
}
|
|
56
|
-
type EdgeValue = [
|
|
57
|
-
instance1: string,
|
|
58
|
-
instancePin1: number,
|
|
59
|
-
instance2: string,
|
|
60
|
-
instancePin2: number,
|
|
61
|
-
priority: number
|
|
62
|
-
];
|
|
63
46
|
type RenderItem = RenderComponent | RenderWire | RenderText;
|
|
64
47
|
export declare function applyComponentParamsToSymbol(component: ClassComponent, symbol: SymbolGraphic): void;
|
|
65
48
|
export declare function getBounds(components: (RenderComponent | RenderText)[], wires: RenderWire[], junctions: RenderJunction[], frames: RenderFrame[]): BoundBox;
|
|
@@ -124,10 +107,10 @@ export declare class RenderFrame extends RenderObject {
|
|
|
124
107
|
gap: NumericValue;
|
|
125
108
|
borderWidth: NumericValue;
|
|
126
109
|
direction: FramePlotDirection;
|
|
127
|
-
width:
|
|
128
|
-
height:
|
|
110
|
+
width: NumericValue | null;
|
|
111
|
+
height: NumericValue | null;
|
|
129
112
|
subgraphId: string;
|
|
130
|
-
|
|
113
|
+
renderType: RenderFrameType;
|
|
131
114
|
containsTitle: boolean;
|
|
132
115
|
constructor(frame: Frame, type?: RenderFrameType);
|
|
133
116
|
toString(): string;
|
|
@@ -156,12 +139,10 @@ export declare function CalculatePinPositions(component: ClassComponent): Map<nu
|
|
|
156
139
|
angle: NumericValue;
|
|
157
140
|
}>;
|
|
158
141
|
export declare function ExtractDrawingRects(drawing: SymbolDrawingCommands): {
|
|
142
|
+
x: NumericValue;
|
|
143
|
+
y: NumericValue;
|
|
159
144
|
width: NumericValue;
|
|
160
145
|
height: NumericValue;
|
|
146
|
+
className: string | undefined;
|
|
161
147
|
}[];
|
|
162
|
-
type SubGraphInfo = {
|
|
163
|
-
firstNodeId: string;
|
|
164
|
-
components: string[];
|
|
165
|
-
bounds: BoundBox;
|
|
166
|
-
};
|
|
167
148
|
export { BoundBox };
|
|
@@ -29,7 +29,7 @@ export declare class ExecutionScope {
|
|
|
29
29
|
componentGnd: ClassComponent | null;
|
|
30
30
|
componentRoot: ClassComponent | null;
|
|
31
31
|
copyIDs: Map<string, number>;
|
|
32
|
-
sequence:
|
|
32
|
+
sequence: SequenceItem[];
|
|
33
33
|
constructor(scopeId: number);
|
|
34
34
|
static scopeId: number;
|
|
35
35
|
static create(): ExecutionScope;
|
|
@@ -5,6 +5,10 @@ export declare class Frame {
|
|
|
5
5
|
frameType: FrameType;
|
|
6
6
|
constructor(frameId: number, frameType?: FrameType);
|
|
7
7
|
}
|
|
8
|
+
export declare enum FixedFrameIds {
|
|
9
|
+
BaseFrame = -1,
|
|
10
|
+
FrameIdNotUsed = -2
|
|
11
|
+
}
|
|
8
12
|
export declare enum FrameParamKeys {
|
|
9
13
|
Title = "title",
|
|
10
14
|
Direction = "direction",
|
|
@@ -14,6 +18,9 @@ export declare enum FrameParamKeys {
|
|
|
14
18
|
Height = "height",
|
|
15
19
|
PaperSize = "paper_size",
|
|
16
20
|
SheetType = "sheet_type",
|
|
21
|
+
TitleAlign = "title_align",
|
|
22
|
+
HorizontalAlign = "align",
|
|
23
|
+
VerticalAlign = "valign",
|
|
17
24
|
SheetNumber = "sheet_number",
|
|
18
25
|
SheetTotal = "sheet_total"
|
|
19
26
|
}
|
|
@@ -14,6 +14,7 @@ export declare class NumericValue {
|
|
|
14
14
|
toNumber(): number;
|
|
15
15
|
toBigNumber(): Big;
|
|
16
16
|
div(value: NumericValue | number): NumericValue;
|
|
17
|
+
half(): NumericValue;
|
|
17
18
|
mul(value: NumericValue | number): NumericValue;
|
|
18
19
|
add(value: NumericValue | number): NumericValue;
|
|
19
20
|
sub(value: NumericValue | number): NumericValue;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ export type BoundBox = {
|
|
|
13
13
|
xmax: number;
|
|
14
14
|
ymax: number;
|
|
15
15
|
};
|
|
16
|
+
export type BoundBox2 = [
|
|
17
|
+
xmin: number,
|
|
18
|
+
ymin: number,
|
|
19
|
+
xmax: number,
|
|
20
|
+
ymax: number
|
|
21
|
+
];
|
|
16
22
|
export declare function resizeBounds(bounds: BoundBox, value: number): BoundBox;
|
|
17
23
|
export declare function printBounds(bounds: BoundBox): string;
|
|
18
24
|
export declare function resizeToNearestGrid(bounds: BoundBox, gridSize?: number): BoundBox;
|
|
@@ -28,3 +34,5 @@ export declare function combineMaps(map1: Map<string, any>, map2: Map<string, an
|
|
|
28
34
|
export declare function getNumberExponential(value: string): number;
|
|
29
35
|
export declare function getNumberExponentialText(value: number): string;
|
|
30
36
|
export declare function resolveToNumericValue(value: Big): NumericValue;
|
|
37
|
+
export declare function isPointWithinArea(point: [x: number, y: number], bounds: BoundBox2): boolean;
|
|
38
|
+
export declare function areasOverlap(area1: BoundBox2, area2: BoundBox2): boolean;
|
package/libs/lib.cst
CHANGED
|
@@ -64,7 +64,7 @@ def res(value):
|
|
|
64
64
|
return create component:
|
|
65
65
|
pins: 2
|
|
66
66
|
display: create graphic (params):
|
|
67
|
-
|
|
67
|
+
crect: 0, 0, width, height
|
|
68
68
|
hpin: 1, -width/2 - 30, 0, 30
|
|
69
69
|
hpin: 2, width/2 + 30, 0, -30
|
|
70
70
|
label: params.refdes, -width/2, -height/2 - 20, fontSize=50, anchor="left"
|
|
@@ -277,13 +277,15 @@ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin
|
|
|
277
277
|
|
|
278
278
|
# outer rect
|
|
279
279
|
lineColor: "#cccccc"
|
|
280
|
-
|
|
280
|
+
crect: (paper_width/2, paper_height/2,
|
|
281
|
+
paper_width, paper_height, class="paper-area")
|
|
281
282
|
|
|
282
283
|
# inner rect
|
|
283
284
|
lineColor: "#111111"
|
|
284
|
-
|
|
285
|
+
crect: (paper_width/2, paper_height/2,
|
|
286
|
+
inner_width, inner_height, class="plot-area")
|
|
285
287
|
|
|
286
|
-
|
|
288
|
+
crect: (paper_width/2, paper_height/2,
|
|
287
289
|
paper_width - 2 * margin_x + inner_frame_margin * 2,
|
|
288
290
|
paper_height - 2 * margin_y + inner_frame_margin * 2)
|
|
289
291
|
|
|
@@ -358,7 +360,10 @@ def sheet_generator(paper_size_name, paper_width, paper_height, margin_x, margin
|
|
|
358
360
|
anchor: "left"
|
|
359
361
|
vanchor: "bottom"
|
|
360
362
|
|
|
361
|
-
|
|
363
|
+
crect: (title_block_x + title_block_width / 2,
|
|
364
|
+
title_block_y + title_block_height / 2,
|
|
365
|
+
title_block_width, title_block_height,
|
|
366
|
+
class="keepout-area")
|
|
362
367
|
|
|
363
368
|
params:
|
|
364
369
|
title: "Sheet title"
|