archiyou 0.7.0

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 (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +215 -0
  3. package/dist/archiyou.js +35969 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/src/Annotator.d.ts +55 -0
  6. package/dist/src/AnnotatorBaseAnnotation.d.ts +16 -0
  7. package/dist/src/AnnotatorDimensionLine.d.ts +92 -0
  8. package/dist/src/Bbox.d.ts +126 -0
  9. package/dist/src/Beams.d.ts +316 -0
  10. package/dist/src/Brep.d.ts +152 -0
  11. package/dist/src/Calc.d.ts +48 -0
  12. package/dist/src/CalcDb.d.ts +33 -0
  13. package/dist/src/CalcTable.d.ts +60 -0
  14. package/dist/src/CalcTableIO.d.ts +130 -0
  15. package/dist/src/CodeParser.d.ts +58 -0
  16. package/dist/src/ComponentManager.d.ts +33 -0
  17. package/dist/src/Console.d.ts +34 -0
  18. package/dist/src/Doc.d.ts +181 -0
  19. package/dist/src/DocDocument.d.ts +27 -0
  20. package/dist/src/DocPDFExporter.d.ts +105 -0
  21. package/dist/src/DocPage.d.ts +75 -0
  22. package/dist/src/DocPageContainer.d.ts +65 -0
  23. package/dist/src/DocPageContainerGraphic.d.ts +10 -0
  24. package/dist/src/DocPageContainerImage.d.ts +21 -0
  25. package/dist/src/DocPageContainerTable.d.ts +21 -0
  26. package/dist/src/DocPageContainerText.d.ts +23 -0
  27. package/dist/src/DocPageContainerTextArea.d.ts +23 -0
  28. package/dist/src/DocPageContainerView.d.ts +22 -0
  29. package/dist/src/DocUtils.d.ts +12 -0
  30. package/dist/src/DocViewSVGManager.d.ts +91 -0
  31. package/dist/src/Edge.d.ts +190 -0
  32. package/dist/src/Exporter.d.ts +100 -0
  33. package/dist/src/Face.d.ts +134 -0
  34. package/dist/src/GLTFBuilder.d.ts +30 -0
  35. package/dist/src/IO.d.ts +87 -0
  36. package/dist/src/LibraryConnector.d.ts +56 -0
  37. package/dist/src/Make.d.ts +85 -0
  38. package/dist/src/MakeOperations.d.ts +32 -0
  39. package/dist/src/OBbox.d.ts +121 -0
  40. package/dist/src/Obj.d.ts +104 -0
  41. package/dist/src/OcLoader.d.ts +39 -0
  42. package/dist/src/ParamManager.d.ts +57 -0
  43. package/dist/src/ParamManagerOperator.d.ts +68 -0
  44. package/dist/src/Pipeline.d.ts +20 -0
  45. package/dist/src/Point.d.ts +88 -0
  46. package/dist/src/Runner.d.ts +230 -0
  47. package/dist/src/RunnerComponentImporter.d.ts +71 -0
  48. package/dist/src/RunnerOps.d.ts +15 -0
  49. package/dist/src/Script.d.ts +78 -0
  50. package/dist/src/ScriptOutputManager.d.ts +19 -0
  51. package/dist/src/ScriptOutputPath.d.ts +48 -0
  52. package/dist/src/ScriptParam.d.ts +78 -0
  53. package/dist/src/Selector.d.ts +48 -0
  54. package/dist/src/Services.d.ts +68 -0
  55. package/dist/src/Shape.d.ts +628 -0
  56. package/dist/src/ShapeCollection.d.ts +429 -0
  57. package/dist/src/Shell.d.ts +48 -0
  58. package/dist/src/Sketch.d.ts +162 -0
  59. package/dist/src/Solid.d.ts +54 -0
  60. package/dist/src/Vector.d.ts +167 -0
  61. package/dist/src/Vertex.d.ts +57 -0
  62. package/dist/src/VertexCollection.d.ts +11 -0
  63. package/dist/src/Wire.d.ts +180 -0
  64. package/dist/src/constants.d.ts +112 -0
  65. package/dist/src/decorators.d.ts +27 -0
  66. package/dist/src/garbageCollection.d.ts +4 -0
  67. package/dist/src/init.d.ts +5 -0
  68. package/dist/src/internal.d.ts +67 -0
  69. package/dist/src/models.d.ts +40 -0
  70. package/dist/src/typeguards.d.ts +88 -0
  71. package/dist/src/types.d.ts +944 -0
  72. package/dist/src/utils.d.ts +140 -0
  73. package/dist/src/wasm/build-scripts/build_wasm_base64.d.ts +8 -0
  74. package/dist/src/wasm/index.d.ts +8 -0
  75. package/dist/src/workerUtils.d.ts +14 -0
  76. package/dist/wasm/README.md +13 -0
  77. package/dist/wasm/archiyou-opencascade.d.ts +9933 -0
  78. package/dist/wasm/archiyou-opencascade.js +16 -0
  79. package/dist/wasm/archiyou-opencascade.wasm +0 -0
  80. package/dist/wasm/index.js +32 -0
  81. package/dist/wasm/node.d.ts +16 -0
  82. package/dist/wasm/node.js +40 -0
  83. package/package.json +66 -0
@@ -0,0 +1,91 @@
1
+ import { SVGtoPDFtransform, PageData, ContainerData, DocPDFExporter, DocPathStyle, PDFLinePath } from './internal';
2
+ export declare class DocViewSVGManager {
3
+ PATH_BASE_STYLE: DocPathStyle;
4
+ DIMLINE_LINE_THICKNESS_MM: number;
5
+ DIMLINE_ARROW_SVG_WIDTH: number;
6
+ DIMLINE_ARROW_PDF_WIDTH_MM: number;
7
+ DIMLINE_IS_SMALL_FACTOR_TIMES_TEXT_WIDTH: number;
8
+ DIMLINE_TEXT_SIZE_MM: number;
9
+ DIMLINE_TEXT_MAX_WIDTH_MM: number;
10
+ DIMLINE_TEXT_BACKGROUND_COLOR: string;
11
+ DIMLINE_TEXT_SMALL_OFFSET_TIMES_TEXT_SIZE: number;
12
+ _svg: string;
13
+ _svgXML: any;
14
+ _svgToPDFTransform: SVGtoPDFtransform;
15
+ _docActivePage: PageData;
16
+ constructor(view?: ContainerData);
17
+ parse(view?: ContainerData): any;
18
+ _setCleanSvg(view?: ContainerData): string;
19
+ reset(): void;
20
+ /** Return changed SVG as string */
21
+ export(): string;
22
+ setViewBox(): void;
23
+ setNoStrokeScaling(): void;
24
+ /** Information that is needed to transform SVG shape content to PDF */
25
+ toPDFDocTransform(pdfExporter: DocPDFExporter, view: ContainerData, page: PageData): SVGtoPDFtransform;
26
+ /** Transform and scale SVG Shape data to PDF space coordinates (points)
27
+ * This includes styling based on classes
28
+ *
29
+ * NOTES:
30
+ * - incoming SVG units are worldUnits (in <svg _worldUnits="..">) [ NOTE: after parsing XML nodes _ is removed!]
31
+ * - bbox is in <svg _bbox="left top width height"
32
+ */
33
+ toPDFDocShapePaths(pdfExporter: DocPDFExporter, view: ContainerData, page: PageData): Array<PDFLinePath>;
34
+ /** Within SVG path (<path d="..">) we have multiple ways to set style
35
+ * 1. on object itself as attribute: stroke="#0000FF" (see Edge._getSvgPathAttributes )
36
+ * 2. by classes
37
+ *
38
+ * Classes have priority over object styling because it allowes the user to quickly override
39
+ * styling without going into the script
40
+ */
41
+ gatherPDFPathStyleFromSVG(svgPathNode: any): DocPathStyle;
42
+ _svgPathAttributesToPDFPathStyle(svgPathNode: any): DocPathStyle;
43
+ /** Translate the classes applied to svg path to a PDF style map
44
+ *
45
+ * Settings are in constants.ts: CLASS_TO_STYLE
46
+ *
47
+ * Currently these styles exists:
48
+ * - line - the default line edge
49
+ * - dashed - dashed line edge
50
+ * - hidden - a line edge that is hidden behind other shapes used in elevations
51
+ * - outline - a line edge that is the outline of a projection
52
+ * - dimensionline - a dimension line (see: Annotator)
53
+ *
54
+ * Classes are applied in order (last has priority)
55
+ */
56
+ _svgPathClassesToPDFPathStyle(svgPathNode: any): DocPathStyle | null;
57
+ /** jsPDF needs Line paths as [{op: m|l, c: [x,y] }] */
58
+ _pdfLinePathToJsPDFPathLines(pdfPath: PDFLinePath): Array<Record<string, any>>;
59
+ /** Get d attribute of a SVG path and convert to PDF line path, this includes transformation of the coordinates and styling */
60
+ _svgPathDToPDFPath(d: string, transform: SVGtoPDFtransform): string;
61
+ drawDimLinesToPDF(pdfExporter: DocPDFExporter): void;
62
+ /**
63
+ * if a SVG Dimension is considered small
64
+ * Utility used by Dimension Line drawing functions
65
+ */
66
+ _svgDimLineIsSmall(dimLineNode: any): boolean;
67
+ /** Parse SVG dimension node and return line coordines in PDF system */
68
+ _svgDimLineParseLine(dimLineNode: any): [number, number, number, number] | null;
69
+ /** Get normalized offset vector from dimension line
70
+ * TODO: This does not take into account the original offset direction!
71
+ * NOTE: We can't use archiyou-core because we are probably in the main app!
72
+ */
73
+ _svgDimLineOffsetVec(dimLineNode: any, length?: number): [number, number] | null;
74
+ /** Rotate a Vector a given angle around the origin and give it a certain length */
75
+ _rotateVec(v: [number, number], angle: number, length?: number): [number, number];
76
+ /** Draw the line element of a dimLineNode to PDFdocument
77
+ * Returns the coordinates of the line in PDF coordinates
78
+ */
79
+ _drawDimLineLine(dimLineNode: any, pdfExporter: DocPDFExporter): Array<number>;
80
+ /** Draw the line nodes of a dimeLineNode to PDFDocument
81
+ * When dimension line is small, the arrows are flipped ( <--> to >--< )
82
+ */
83
+ _drawDimLineArrows(dimLineNode: any, pdfExporter: DocPDFExporter): void;
84
+ /** Draw text label of Dimension line */
85
+ _drawDimLineText(dimLineNode: any, pdfExporter: DocPDFExporter): void;
86
+ /** Draw a raw SVG path d datastring to PDF after transforming
87
+ * TODO: styles for jsPDF
88
+ */
89
+ _drawSVGPathToPDF(d: string, pdfExporter: DocPDFExporter, localTransforms?: Record<string, any>, styles?: Record<string, any>): void;
90
+ _svgCoordToPDFcoord(transform: SVGtoPDFtransform, c: number | string, axis?: 'x' | 'y'): number;
91
+ }
@@ -0,0 +1,190 @@
1
+ import { DxfBlock } from '@tarikjabiri/dxf';
2
+ import { ThickenDirection, PointLike, Cursor, AnyShape, AnyShapeOrCollection, LinearShape, LinearShapeTail, PointLikeSequence, DimensionOptions, Vector, Point, Shape, Vertex, Wire, Face, Shell, Solid, ShapeCollection, VertexCollection, DimensionLine } from './internal';
3
+ type IWire = Wire;
4
+ type IFace = Face;
5
+ type IShell = Shell;
6
+ type IDimensionLine = DimensionLine;
7
+ export declare class Edge extends Shape {
8
+ TO_SVG_DASH_SIZE_DEFAULT: number;
9
+ TO_SVG_LINE_WIDTH_DEFAULT: number;
10
+ TO_SVG_LINE_COLOR_DEFAULT: string;
11
+ TO_SVG_OPACTIY_DEFAULT: number;
12
+ /** Creates a simple Line Edge, use new Edge().makeCicle etc for others */
13
+ constructor(start?: any, end?: any);
14
+ _fromOcEdge(ocEdge: any): this;
15
+ /**
16
+ * Create Edge from given OC Curve
17
+ * @param ocCurve Geom_Curve
18
+ * @param ocStartPnt gp_Pnt
19
+ * @param ocEndPnt gp_Pnt
20
+ */
21
+ _fromOcCurve(ocCurve: any): Edge;
22
+ _ocGeom(): Edge;
23
+ /** Convert Edge to one Vector */
24
+ toVector(): Vector;
25
+ _toWire(): IWire;
26
+ /** Convert to Wire and add to Scene */
27
+ toWire(): IWire;
28
+ _toOcCurve(): any;
29
+ _toOcCurveHandle(): any;
30
+ getCursor(): Cursor;
31
+ makeLine(start: PointLike, end: PointLike): Edge;
32
+ /** Create a Circle Edge with given radius (default:50) and center (default: [0,0,0]) */
33
+ makeCircle(radius?: number, center?: PointLike): Edge;
34
+ /** Make Spline that goes through Vectors provided in list of points (PointLike) */
35
+ makeSpline(points: PointLikeSequence, ...args: any[]): Edge;
36
+ /** Make Arc line
37
+ * @param type threepoint or tangent
38
+ */
39
+ makeArc(start: PointLike, mid: PointLike, end: PointLike, type?: string): Edge;
40
+ /** Make Bezier curve from given points. One control point for Quadratic. Two for Cubic */
41
+ makeBezier(points: PointLikeSequence, ...args: any[]): Edge;
42
+ /** Make weighted Bezier Curve by supplying (control)points and weights */
43
+ /** Get first Vertex of Edge */
44
+ start(): Vertex;
45
+ /** Get last Vertex of Edge */
46
+ end(): Vertex;
47
+ _firstVertex(): Vertex;
48
+ _lastVertex(): Vertex;
49
+ /** Get Edge Type: Line, Circle, Ellipse, Hyperbola, Parabola, BezierCurve, BSplineCurve, OffsetCurve, OtherCurve
50
+ * IMPORTANT: Because it generates a lot of confusion we add here the distinction Circle/Arc that is not in OpenCascade
51
+ */
52
+ edgeType(): string;
53
+ is2DXY(): boolean;
54
+ /** TODO: Make this more robust? */
55
+ isCircular(): boolean;
56
+ /** Get length of Edge */
57
+ length(): number;
58
+ /** Calculate the center of this Edge and return a Point */
59
+ center(): Point;
60
+ /** Return middle of Edge */
61
+ middle(): Point;
62
+ /** Calculate the normal of the straight line Edge
63
+ * Force that normal always faces flipTo (otherwise the side is determined by direction)
64
+ */
65
+ normal(orientTo?: PointLike, ...args: any[]): Vector;
66
+ /** Calculate workplane normal if 2D (not a 1D Line) */
67
+ workPlaneNormal(): Vector;
68
+ _reverseOcEdge(ocEdge: any): any;
69
+ /** Reverse Edge in place */
70
+ reverse(): Edge;
71
+ /** Create a new Edge by reversing current one */
72
+ reversed(): Edge;
73
+ /** Get direction Vector of Line Edge from start to end */
74
+ direction(normalize?: boolean): Vector;
75
+ /** Alias for direction. Always returns normalized Vector */
76
+ dir(): Vector;
77
+ /** Get tangent (= direction ) at certain point on the Edge */
78
+ tangent(): Vector;
79
+ /** Get direction = tangent at certain point on the Edge */
80
+ directionAt(point: PointLike, ...args: any[]): Vector;
81
+ /** Get direction Vector at start Vertex */
82
+ directionAtStart(): Vector;
83
+ /** Get direction Vector at end Vertex */
84
+ directionAtEnd(): Vector;
85
+ /** Get direction Vector at percentage of length */
86
+ directionAtPerc(perc: any): Vector;
87
+ /** Get tangent Vector (=direction) at certain point on the Edge */
88
+ tangentAt(point: PointLike, ...args: any[]): Vector;
89
+ /** Close a non-Line Edge to create a Wire **/
90
+ close(): IWire;
91
+ /** Thicken Edge to create a Face (private: without adding result to Scene) */
92
+ _thickened(amount?: number, direction?: ThickenDirection, onPlaneNormal?: PointLike): IFace;
93
+ /** Thicken Edge to create a Face */
94
+ thickened(amount?: number, direction?: string, onPlaneNormal?: PointLike): IFace;
95
+ thicken(amount: number, direction?: ThickenDirection, onPlaneNormal?: PointLike): IFace;
96
+ /** Thicken the Edge along the normal to create a Face */
97
+ thickenOffsetted(amount?: number, v?: PointLike, flip?: boolean): IFace;
98
+ /** Offset Edge a given amount into normal direction or reversed with '-amount' and return new Edge (private without adding to Scene)
99
+ * NOTE: param type does nothing but is for consistency
100
+ */
101
+ _offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): Edge | Wire;
102
+ /** Offset Edge a given amount into normal direction or reversed with '-amount' and return new Edge */
103
+ offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): Edge | Wire;
104
+ /** Offset Edge a given amount into normal direction or reversed with '-amount' */
105
+ offset(amount?: number, type?: string, onPlaneNormal?: PointLike): Edge | Wire;
106
+ /** Get start value of Edge parameter range */
107
+ paramStart(): number;
108
+ /** Get end value of Edge parameter range */
109
+ paramEnd(): number;
110
+ /**
111
+ * Generate a Point at specific percentage of this Edge
112
+ * @param perc: number between 0 and 1
113
+ */
114
+ pointAt(perc: number): Point;
115
+ /** Get Point at specific param value */
116
+ pointAtParam(param: number): Point;
117
+ /** Check if Edge has a Vertex that equals the given Vertex */
118
+ isVertex(vertex: PointLike, ...args: any[]): Vertex;
119
+ /** Calculate the normal for a point on the Edge */
120
+ normalAt(point: PointLike, ...args: any[]): Vector;
121
+ /** Get normal of Edge at percentage of length */
122
+ normalAtPerc(perc: number): Vector;
123
+ /** Calculate the angle between two touching Edges at either ends */
124
+ angleTo(other: Edge): number;
125
+ /** Needed to fix some Edges, for example after projecting */
126
+ _buildCurves(): void;
127
+ /** Extend Edge into a given direction (start or end)
128
+ * NOTE: Check quality of Edge - there are signs of resulting Edges not being consistent
129
+ */
130
+ extend(amount?: number, direction?: LinearShapeTail): Edge;
131
+ /** Extend Edge into a certain direction (start or end) and return a copy */
132
+ _extended(amount?: number, direction?: LinearShapeTail): Edge;
133
+ /** Extend Edge into a certain direction (start or end) and return a copy */
134
+ extended(amount?: number, direction?: LinearShapeTail): Edge;
135
+ /** Extend Edge to nearest point that is shared by other Shape (if any!)
136
+ * @param other
137
+ * @param direction Extend at start or end. If not given pick closest
138
+ */
139
+ extendTo(other: AnyShape, direction?: LinearShapeTail): this;
140
+ extendedTo(other: AnyShape, direction?: LinearShapeTail): Edge;
141
+ _maxCircularShape(): Edge | null;
142
+ /** Loft (forwarded to Wire) */
143
+ loft(sections: AnyShapeOrCollection, solid?: boolean): IShell | Solid;
144
+ lofted(sections: AnyShapeOrCollection, solid?: boolean): IShell | Solid;
145
+ alignTo(other: LinearShape, from?: LinearShapeTail, to?: LinearShapeTail): this;
146
+ /** Get parameter (U) on Edge for given Point. If not on Edge will pick closest */
147
+ getParamAt(point: PointLike): number | null;
148
+ /** Generate a Collection of a given number of Vertices equally spaced over this Edge including the start and end of the Edge */
149
+ populated(num?: number): VertexCollection;
150
+ /** Break a curved Edge up into a Wire consisting of Line Edges with given angle between segments */
151
+ segmentize(angle?: number, size?: number): LinearShape;
152
+ /** Get distributed points on Edge according to QuasiUniformDeflection method
153
+ * See: https://dev.opencascade.org/doc/refman/html/class_g_c_pnts___quasi_uniform_deflection.html#details
154
+ * Used in toSVG()
155
+ */
156
+ _segmentizeToPoints(angularDeflection?: number, force2D?: boolean): Array<Point>;
157
+ _intersectionsWithEdge(other: Edge): Vertex | Edge | ShapeCollection;
158
+ /** Test if an Edge shares a Vertex with another */
159
+ connected(other: Edge): boolean;
160
+ /** Check if this Edge is parallel to other given entity */
161
+ parallel(other?: PointLike | Edge, ...args: any[]): boolean;
162
+ dimension(options?: DimensionOptions): IDimensionLine;
163
+ /** Alias for dimension() */
164
+ dim(options?: DimensionOptions): IDimensionLine;
165
+ /** Minimal raw data of this Edge */
166
+ toData(): Array<Array<number>>;
167
+ /** Export entity and minimal data as string (used for outputting on console and hashing ) */
168
+ toString(): string;
169
+ /** Export (segmentized) Edge (only X,Y coords) to SVG string
170
+ * <path d="M 10 10 L 100 200">
171
+ * IMPORTANT: official SVG path (without comma!)
172
+ * code inspired from CadQuery: https://github.com/CadQuery/cadquery/blob/917d918e34690c101a50a233a11026974b87574b/cadquery/occ_impl/exporters/svg.py#L84
173
+ */
174
+ toSVG(): string;
175
+ /** get SVG attributes from style properties of Shape */
176
+ _getSvgPathAttributes(): string;
177
+ /** Based on attributes or tests add classes to Svg that help us select and style these SVG elements later */
178
+ _getSvgClasses(): string;
179
+ /** Export Edge to DXF writer instance
180
+ * Now only lines are supported
181
+ * TODO: Introduce arcs and splines
182
+ */
183
+ toDXF(dxf: DxfBlock): this;
184
+ /** Getting U min and max of Curve
185
+ * IMPORTANT: For Line Curves the parameters are the same as the length
186
+ * For Arc Curves and Circles the U is the angle ( in radians ) - Half a circle: U = [0, PI] - Circle [0,PI*2]
187
+ */
188
+ getParamMinMax(): Array<number>;
189
+ }
190
+ export {};
@@ -0,0 +1,100 @@
1
+ import { ArchiyouApp, AnyShapeOrCollection, ExportGLTFOptions, MeshingQualitySettings, toSVGOptions, AnyShape, ShapeCollection } from './internal';
2
+ type XmlNode = any;
3
+ declare global {
4
+ interface Window {
5
+ showOpenFilePicker: any;
6
+ showSaveFilePicker: any;
7
+ }
8
+ interface globalThis {
9
+ showOpenFilePicker: any;
10
+ showSaveFilePicker: any;
11
+ }
12
+ interface Console {
13
+ geom: any;
14
+ user: any;
15
+ }
16
+ }
17
+ export declare class Exporter {
18
+ DEFAULT_MESH_QUALITY: {
19
+ linearDeflection: number;
20
+ angularDeflection: number;
21
+ tolerance: number;
22
+ edgeMinimalPoints: number;
23
+ edgeMinimalLength: number;
24
+ };
25
+ DEFAULT_GLTF_OPTIONS: ExportGLTFOptions;
26
+ _ay: ArchiyouApp;
27
+ constructor(ay?: ArchiyouApp);
28
+ setArchiyou(ay: ArchiyouApp): this;
29
+ /** Export given shapes or all shapes in Brep instance to STEP
30
+ * Optionally supply a filename
31
+ */
32
+ exportToSTEP(shapes?: AnyShape | ShapeCollection, options?: Record<string, any>, filename?: string): string;
33
+ /** Open a window to save the file in browser */
34
+ exportToSTEPWindow(content?: string): Promise<void>;
35
+ /** Export given shapes or all shapes in Brep instance to STL
36
+ * Optionally supply a filename
37
+ */
38
+ exportToSTL(shapes?: AnyShape | ShapeCollection, options?: Record<string, any>, filename?: string): Uint8Array;
39
+ /** Open a window to save the STL file in browser */
40
+ exportToSTLWindow(content?: ArrayBuffer): Promise<void>;
41
+ /** Export Scene to GLTF
42
+
43
+ Export high-resolution GLTF with added loose Points and Lines. And optionally export seperate Vertices and Edges per Shape
44
+
45
+ OC docs:
46
+ - RWGltf_CafWriter: https://dev.opencascade.org/doc/refman/html/class_r_w_gltf___caf_writer.html
47
+ - XCAFDoc_DocumentTool: - https://dev.opencascade.org/doc/refman/html/class_x_c_a_f_doc___document_tool.html
48
+ - ShapeTool: https://dev.opencascade.org/doc/refman/html/class_x_c_a_f_doc___shape_tool.html
49
+ - TDF_Label: https://dev.opencascade.org/doc/refman/html/class_t_d_f___label.html
50
+ - TDataStd_Name: https://dev.opencascade.org/doc/refman/html/class_t_data_std___name.html
51
+ - VisMaterialTool: https://dev.opencascade.org/doc/refman/html/class_x_c_a_f_doc___vis_material_tool.html#aaa1fb4d64b9eb24ed86bbe6d368010ab
52
+ - XCAFDoc_VisMaterial - https://dev.opencascade.org/doc/refman/html/class_x_c_a_f_doc___vis_material.html
53
+ - VisMaterialPBR: https://dev.opencascade.org/doc/refman/html/struct_x_c_a_f_doc___vis_material_p_b_r.html
54
+
55
+ */
56
+ exportToGLTF(shapes?: AnyShapeOrCollection, options?: ExportGLTFOptions, filename?: string): Promise<ArrayBuffer | null>;
57
+ /** Needs to be called before before STL
58
+ * Also with GLTF but keep it seperate for now
59
+ * Return OcIncMesh instance to be able to delete them
60
+ */
61
+ _triangulateShapes(shapes: ShapeCollection, meshingQuality?: MeshingQualitySettings): Array<any>;
62
+ /** Export GLTF (binary or text) to the browser window */
63
+ exportToGLTFWindow(content?: Uint8Array | string): Promise<void>;
64
+ exportToGLTFAnimation(frameGLBs: Array<Uint8Array>): Promise<Uint8Array>;
65
+ exportToGLTFAnimationWindow(content: Uint8Array): Promise<void>;
66
+ /** Export entire (visual) model by creating a isometric 2D view
67
+ * TODO: seperate these functions into export3DtoSVG and export2DtoSVG
68
+ */
69
+ exportToSVG(shapes?: ShapeCollection, options?: toSVGOptions): string;
70
+ /** Shortcut function to export 3D shapes to SVG
71
+ Make a isometry first
72
+ */
73
+ _export3DToSVG(shapes: ShapeCollection, options?: toSVGOptions): string;
74
+ /** Export 2D shapes to SVG */
75
+ _export2DToSVG(shapes: ShapeCollection, options?: toSVGOptions): string;
76
+ /** Combine all SVG's into one with SMIL keyframe animations
77
+ * We parse all SVGs and put all their content in seperate groups named "frame{{N}}"
78
+ * At the same time apply special SLIM SVG keyframe animation tags
79
+ * so the SVG animation can be viewed inside ordinary browsers
80
+ */
81
+ exportToSVGAnimation(svgs: Array<string>): string;
82
+ /** For some reason TXML does not offer a good node.toString() method */
83
+ _XmlNodeToString(n: any, wrapped?: string): string;
84
+ _getSvgBboxArea(svg: XmlNode): number;
85
+ /** Open browser file window to save svg */
86
+ exportToSVGWindow(content: string): Promise<void>;
87
+ exportToDXF(shapes?: AnyShape | ShapeCollection, options?: Record<string, any>): string | null;
88
+ /** Convenience method for exporting Shapes and save as file in browser and node */
89
+ save(filename: string, options?: any, shapes?: ShapeCollection): Promise<void>;
90
+ /** save raw data to file in browser of node */
91
+ _saveDataToFile(data: any, filename: string): Promise<void>;
92
+ /** Simplified function to output data to a file window */
93
+ saveDataToFileWindow(data: any, filename: string): Promise<void>;
94
+ /** Write data to local disk by opening a file picker in browser */
95
+ _exportToFileWindow(data: any, mime: string, ext: string, desc: string): Promise<void>;
96
+ _getFileName(): string;
97
+ _mimeFromFileName(fileName: string): string;
98
+ getNewFileHandle(desc: any, mime: any, ext: any, open?: boolean): Promise<any>;
99
+ }
100
+ export {};
@@ -0,0 +1,134 @@
1
+ import { PointLike, Cursor, PointLikeSequence, MakeFaceInput, AnyShape, Axis, ThickenDirection, PointLikeOrAnyShape, PointLikeOrVertexCollection, AnyShapeSequence, AnyShapeOrCollection, PointLikeOrAnyShapeOrCollectionOrSelectionString, DimensionOptions, Vector, Point, Shape, Vertex, Edge, Wire, Shell, Solid, ShapeCollection, DimensionLine } from './internal';
2
+ type IShell = Shell;
3
+ type ISolid = Solid;
4
+ export declare class Face extends Shape {
5
+ constructor(entities?: any, ...args: Array<any>);
6
+ /** Create Face from all kinds of inputs */
7
+ fromAll(o: MakeFaceInput, ...args: any[]): this;
8
+ /** Create Face from a Wire */
9
+ fromWire(wire: Wire): Face | Shell;
10
+ /** Create a Face from Vertices */
11
+ fromVertices(vertices: PointLikeSequence, ...args: any[]): Face;
12
+ fromEdges(shapes: AnyShapeSequence, ...args: any[]): Face;
13
+ /** Create a Face from a OC Face instance */
14
+ _fromOcFace(ocFace: any): Face;
15
+ /** Generate Cursor */
16
+ getCursor(): Cursor;
17
+ makePlane(width?: number, depth?: number, position?: PointLike, normal?: PointLike): Face;
18
+ /** Make Plane parallel to one of the baseplanes */
19
+ makePlaneBetween(from: PointLike, to: PointLike): Face;
20
+ /** Make the base planes of the coordinate system
21
+ * @param axis can be 'z' for 'xy' plane, or directly 'xy'
22
+ */
23
+ makeBasePlane(axis?: Axis, size?: number): any;
24
+ /** Make a 2D plane from two coordinates. See makePlaneBetween for 3D */
25
+ makeRectBetween(from: PointLike, to: PointLike): Face;
26
+ makeCircle(radius: number, center: PointLike): Face;
27
+ /**
28
+ * docs: https://dev.opencascade.org/doc/occt-7.5.0/refman/html/class_b_rep_offset_a_p_i___make_filling.html#a50e5b1deb08a18908eb8c8dde15dcefd
29
+ * NOTE: Taken from code by Roger Maitland for CadQuery: https://github.com/CadQuery/cadquery/issues/562 */
30
+ makeNonPlanar(wireOrEdges: AnyShapeOrCollection, surfacePoints?: PointLikeSequence, holes?: AnyShapeOrCollection): this | AnyShapeOrCollection;
31
+ _setToOc(): void;
32
+ _toOcSurface(): any;
33
+ _ocGeom(): any;
34
+ /** Create Wire of Face without adding to scene */
35
+ _toWire(): Wire;
36
+ toWire(): Wire;
37
+ /** Create Shell with one Face */
38
+ toShell(): IShell;
39
+ _toShellWhenOcShell(): Face | Shell;
40
+ /** Center of this surface (not its center of mass!) - Override center() of Shape because it results in weird results */
41
+ center(): Point;
42
+ /** Check if this Face is planar */
43
+ isPlanar(): boolean;
44
+ is2DXY(): boolean;
45
+ /** Alias for isPlanar */
46
+ planar(): boolean;
47
+ /** Get subtype of Face - used in Selectors */
48
+ faceType(): string;
49
+ outerWire(): Wire;
50
+ innerWires(): ShapeCollection;
51
+ /** Get min U, max U, min V and max V parameters of current Face */
52
+ uvBounds(): number[];
53
+ /** Reverse Face */
54
+ reverse(): Face;
55
+ /** Get uv paramaters at center of Face */
56
+ uvCenter(): Array<number>;
57
+ /** Get center of this Face surface */
58
+ surfaceCenter(): Point;
59
+ /** Get normal of Plane Face - use normalAt for curved surfaces */
60
+ normal(): Vector;
61
+ /** Get the normal at a certain Point location on the Face */
62
+ normalAt(p: PointLike): Vector;
63
+ /** Get normal at given uv coordinates */
64
+ normalAtUv(u: number, v: number): Vector;
65
+ /** Create a Edge for Planar Face Normal */
66
+ normalEdge(size?: number): Edge;
67
+ /** Calculate the area of this Face */
68
+ area(): number;
69
+ /** Rotate this Face to its normal is parallel to the given Vector */
70
+ rotateTo(vector: PointLike, pivot?: PointLike): Face;
71
+ /** Extrude a Face a certain amount into a given direction. (private: not added to Scene)
72
+ * This always creates a different type of Shape ( from Face to Solid ) to use extruded instead of extrude for now
73
+ */
74
+ _extruded(amount?: number, direction?: PointLike): ISolid;
75
+ /** Extrude a Face a certain amount into a given direction. (private: not added to Scene) */
76
+ extruded(amount?: number, direction?: PointLike): ISolid;
77
+ /** Same as extruded() but replaces old Shape with extruded one */
78
+ extrude(amount?: number, direction?: PointLike): ISolid;
79
+ /** For consistency: Refer shell() to extrude() on Faces */
80
+ shell(amount?: number): ISolid;
81
+ shelled(amount?: number): ISolid;
82
+ /** Make a bigger (+amount) or smaller (-amount) Face (private)
83
+ * NOTE: onPlaneNormal is for consistency and does nothing
84
+ */
85
+ _offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): this;
86
+ /** Make a bigger (+amount) or smaller (-amount) Face (private) */
87
+ offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): this;
88
+ /** Make the Face bigger (+amount) or smaller (-amount) */
89
+ offset(amount?: number, type?: string, onPlaneNormal?: PointLike): this;
90
+ /** Thicken the Face a given amount and direction to create a Solid */
91
+ _thickened(amount?: number, direction?: ThickenDirection): ISolid;
92
+ thickened(amount?: number, direction?: ThickenDirection): ISolid;
93
+ /** Thicken current Face */
94
+ thicken(amount?: number, direction?: ThickenDirection): ISolid;
95
+ /** Make a Shell or Solid by lofting outerWire of Face to other Wire Shapes */
96
+ _lofted(sections: AnyShapeOrCollection, solid?: boolean): IShell | Solid;
97
+ lofted(sections: AnyShapeOrCollection, solid?: boolean): IShell | Solid;
98
+ /** Loft current Face */
99
+ loft(sections: AnyShapeOrCollection, solid?: boolean): IShell | Solid;
100
+ /** Extrude and twist a given amount of angles (private, without adding to scene ) */
101
+ _twistExtruded(amount?: number, angle?: number, pivot?: PointLike, direction?: PointLike, lefthand?: boolean): ISolid;
102
+ /** Extrude and twist a given amount of angles (public ) */
103
+ twistExtruded(amount?: number, angle?: number, pivot?: PointLike, direction?: PointLike, lefthand?: boolean): ISolid;
104
+ /** Extrude Face and rotate a given angle */
105
+ twistExtrude(amount?: number, angle?: number, pivot?: PointLike, direction?: PointLike, lefthand?: boolean): ISolid;
106
+ /** Round corners of Wire with given radius, at given Vertex (same or equals) or VertexCollection or all if given none */
107
+ fillet(radius?: number, at?: PointLikeOrAnyShapeOrCollectionOrSelectionString): this;
108
+ /** Chamfer two connected Edges at given Vertex and with and angle of given Edge */
109
+ chamfer(distance?: number, angle?: number, vertices?: PointLikeOrVertexCollection, edges?: ShapeCollection): this;
110
+ /** Create a new Face by projecting current onto another Face, Shell or Solid
111
+ * NOTE: converted from code by Roger Maitland for CadQuery: https://github.com/CadQuery/cadquery/issues/562
112
+ * TODO: FINISH
113
+ */
114
+ _projectTo(other: AnyShape, direction: Vector, center?: Vector): null | ShapeCollection;
115
+ _intersectionsWithFace(other: Face): Shape | Vertex | Edge | Vertex | Face | ShapeCollection;
116
+ _testUvToBounds(u: number, v: number): boolean;
117
+ /** Get position Vector at UV coords */
118
+ pointAtUv(u: number, v: number): Point;
119
+ /** Get UV coordinates of point on Face */
120
+ uvAt(point: PointLike): Array<number>;
121
+ /** Check if a given Point or Shape can be considered parallel to current Face */
122
+ parallel(other: PointLikeOrAnyShape): boolean;
123
+ /** Check if this Face is orthogonal (parallel with one of the base planes) */
124
+ orthogonal(): boolean;
125
+ /** Simply generate dimension lines for all visible Edges in this Face
126
+ * TODO: make sure offsets are right, skip same edges in boxes
127
+ */
128
+ dimension(dim?: DimensionOptions): DimensionLine | Array<DimensionLine>;
129
+ /** Alias for dimension() */
130
+ dim(dim?: DimensionOptions): DimensionLine | Array<DimensionLine>;
131
+ /** Export entity and minimal data as string (used for outputting on console and hashing ) */
132
+ toString(): string;
133
+ }
134
+ export {};
@@ -0,0 +1,30 @@
1
+ import { AnyShape, Vector, ShapeCollection, ArchiyouApp, MeshingQualitySettings, ArchiyouData, ArchiyouOutputSettings } from './internal';
2
+ export declare class GLTFBuilder {
3
+ doc: any;
4
+ scene: any;
5
+ buffer: any;
6
+ SUBSHAPE_OUTPUT_NAME_SEPERATOR: string;
7
+ constructor();
8
+ /** To binary GLTF buffer */
9
+ toGLTFBuffer(): Promise<Uint8Array>;
10
+ /** build Animated GLTF */
11
+ createAnimation(frameGLBs: Array<Uint8Array>): Promise<void>;
12
+ /** Load GLB of frame into scene */
13
+ frameGLBToNode(GLBBuffer: Uint8Array, nodeName: string): Promise<void>;
14
+ loadFramesIntoScene(frameGLBs: Array<Uint8Array>): Promise<void>;
15
+ _quaternionFromAxisAngle(axis: Vector, angleDeg: number): Array<number>;
16
+ /** Apply Archiyou GLTF format data to raw GLTF content buffer */
17
+ addArchiyouData(gltfContent: ArrayBuffer | Uint8Array, ay: ArchiyouApp, settings?: ArchiyouOutputSettings): Promise<Uint8Array>;
18
+ /** Add all loose point and line Shapes (Vertex,Edge,Wire) to the GLTF buffer */
19
+ addPointsAndLines(gltfContent: ArrayBuffer | Uint8Array, shapes: ShapeCollection, quality: MeshingQualitySettings): Promise<Uint8Array>;
20
+ /** Add Vertices of Shape (including just one Vertex) as node to GLTF */
21
+ _addPoints(shape: AnyShape, gltfBuffer: ArrayBuffer | Uint8Array): void;
22
+ _addShapeLines(shape: AnyShape, gltfBuffer: ArrayBuffer | Uint8Array, quality: MeshingQualitySettings): void;
23
+ /** For visualization purposes it's handy output seperate point- and line buffer into the GLTF
24
+ * So these can be seperately styled in a GLTF viewer
25
+ */
26
+ addSeperatePointsAndLinesForShapes(gltfContent: ArrayBuffer | Uint8Array, shapes: ShapeCollection, quality: MeshingQualitySettings): Promise<Uint8Array>;
27
+ /** Get ArchiyouData from GLTF binary */
28
+ readArchiyouData(gltf: ArrayBuffer | Uint8Array): Promise<ArchiyouData>;
29
+ _convertArrayBufferToUint8Array(buffer: ArrayBuffer | Uint8Array): Uint8Array;
30
+ }
@@ -0,0 +1,87 @@
1
+ import { Brep, AnyShape, ShapeCollection } from './internal';
2
+ interface Asset {
3
+ source: string;
4
+ valid: boolean;
5
+ locationType: 'url' | 'local';
6
+ url: string;
7
+ localId: string;
8
+ formatType: 'data' | 'geodata' | 'vector' | 'bitmap' | 'api';
9
+ format: string;
10
+ content?: any;
11
+ fetchError?: string;
12
+ imported?: any;
13
+ }
14
+ interface SvgTransform {
15
+ x: number;
16
+ y: number;
17
+ }
18
+ export declare class IO {
19
+ _oc: any;
20
+ _brep: Brep;
21
+ source: string;
22
+ asset: Asset;
23
+ cache: {
24
+ [key: string]: Asset;
25
+ };
26
+ FORMAT_TO_TYPE: {
27
+ svg: string;
28
+ json: string;
29
+ geojson: string;
30
+ jpg: string;
31
+ gif: string;
32
+ png: string;
33
+ };
34
+ constructor(brep: Brep);
35
+ load(source: string, forceFetch?: boolean, onlyCache?: boolean): Promise<any>;
36
+ /** Load directly from hot cache (no async) */
37
+ loadFromCache(source: string): AnyShape | ShapeCollection;
38
+ _parse(source: string): Asset;
39
+ _getAssetFromCache(source: string): Promise<any>;
40
+ _fetch(asset: Asset): Promise<{
41
+ content: any;
42
+ source: string;
43
+ valid: boolean;
44
+ locationType: "local" | "url";
45
+ url: string;
46
+ localId: string;
47
+ formatType: "data" | "geodata" | "vector" | "bitmap" | "api";
48
+ format: string;
49
+ fetchError?: string;
50
+ imported?: any;
51
+ }>;
52
+ _fetchAsset(asset: Asset): Promise<{
53
+ content: any;
54
+ source: string;
55
+ valid: boolean;
56
+ locationType: "local" | "url";
57
+ url: string;
58
+ localId: string;
59
+ formatType: "data" | "geodata" | "vector" | "bitmap" | "api";
60
+ format: string;
61
+ fetchError?: string;
62
+ imported?: any;
63
+ }>;
64
+ _handleFetchedAsset(asset: Asset, response: any): Promise<{
65
+ content: any;
66
+ source: string;
67
+ valid: boolean;
68
+ locationType: "local" | "url";
69
+ url: string;
70
+ localId: string;
71
+ formatType: "data" | "geodata" | "vector" | "bitmap" | "api";
72
+ format: string;
73
+ fetchError?: string;
74
+ imported?: any;
75
+ }>;
76
+ _handleFetchedAssetError(asset: Asset): void;
77
+ /** Convert and import fetched asset to Archiyou entity: either some Shape or raw data like a text or json data structure */
78
+ _importAsset(asset: Asset): any;
79
+ _importSVG(asset: Asset): ShapeCollection;
80
+ _getSvgNodesRecursive(svgTree: any, svgNodesWithTransform?: any[], parentTransform?: SvgTransform): any[];
81
+ _parseTransformString(t: string): {
82
+ x: number;
83
+ y: number;
84
+ };
85
+ _importSVGPath(pathData: string, transform?: SvgTransform): AnyShape | ShapeCollection;
86
+ }
87
+ export {};