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
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Mark van der Net
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # Archiyou
2
+
3
+ ![Archiyou](assets/archiyou_logo_header_white_bg.png)
4
+
5
+ Archiyou is an online platform and Typescript/Javascript library to codify design and building know-how and publish it online.
6
+ Use our editor and community platform for free at [Archiyou.com](https://archiyou.com).
7
+
8
+ [![License](https://img.shields.io/github/license/ArchiyouApp/archiyou-core)](https://github.com/ArchiyouApp/archiyou-core/blob/main/LICENSE) [![build and test](https://github.com/ArchiyouApp/archiyou-core/actions/workflows/build.yml/badge.svg)](https://github.com/ArchiyouApp/archiyou-core/actions/workflows/build.yml) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://docs.archiyou.com)
9
+
10
+ ## Example
11
+
12
+ This is a script on our platform:
13
+
14
+ <img width="250" align="right" src="assets/codecad_table.gif">
15
+
16
+ ```js
17
+ // Parameters
18
+ WIDTH = 100;
19
+ DEPTH = 80;
20
+ HEIGHT = 70;
21
+
22
+ legHeight = HEIGHT-TOP_THICKNESS;
23
+ leg = box(LEG_SIZE, LEG_SIZE, legHeight)
24
+ .move(LEG_SIZE/2, LEG_SIZE/2,legHeight/2); // start position of leg
25
+
26
+ legs = leg.array([2,2],[WIDTH-LEG_SIZE,DEPTH-LEG_SIZE])
27
+ .color('green');
28
+
29
+ top = boxbetween(
30
+ [0,0,legHeight],
31
+ [WIDTH, DEPTH, HEIGHT])
32
+ .color('green');
33
+
34
+ top.fillet(1,'Face||top'); // finish table top
35
+
36
+ ```
37
+
38
+ ## Core Library Features
39
+
40
+ * Minimal object-orientated API that feels like describing your shape.
41
+ * A lot of modeling techniques with our BREP and mesh kernel: CSG, 2D Sketch, surface modeling
42
+ * Exports: BREP, STEP, GLTF/GLB, DXF, PDF, Excel etc
43
+ * Generate documentation: spec sheets, plans, instructables
44
+ * Connected CAD: Import assets (SVG, JPG) from the web and use for modeling
45
+ * Assemble models by using scripts as components
46
+ * More than a model: Manage data, pipelines, components and outputs
47
+ * Publish your script as parametric model in a configurator and serve to the web
48
+
49
+ ## Platform Features
50
+
51
+ * [Free Editor](https://editor.archiyou.com)
52
+ * Open Design: Share scripts and build upon others
53
+ * Project management [Coming]
54
+
55
+ ## Developer Quickstart
56
+
57
+ To use Archiyou as a module to generate designs and documentation independently from our platform it's available as module on npm.
58
+
59
+ ```bash
60
+ # install with any package manager
61
+ pnpm add archiyou
62
+ # or
63
+ npm add archiyou
64
+ # or
65
+ yarn add archiyou
66
+ ```
67
+
68
+ Now run this script in Node or browser:
69
+
70
+ ```js
71
+ import { init, Brep, Doc } from 'archiyou'
72
+
73
+ await init();
74
+
75
+ const brep = new Brep();
76
+
77
+ const myModel = brep.Box(100)
78
+ .subtract( // subtract a box from the main box
79
+ brep.Box(50,50,100)
80
+ .move(25,-25,50)
81
+ .hide()
82
+ ).fillet(5); // Give it round edges
83
+
84
+ await myModel.save('mybox.glb')
85
+
86
+ const myIso = myModel.iso([1,-1,1])
87
+ myIso.save('myboxiso.svg'); // export as SVG file
88
+
89
+ const myDoc = new Doc() // Doc module
90
+ .create('myDoc') // start a new document (and first page)
91
+ .page('myPage')
92
+ .text('My design') // place text
93
+ .view('iso', myIso); // place view of myIso shapes
94
+
95
+ await myDoc.save('myboxdoc.pdf');
96
+ ```
97
+ <img src="assets/archiyou_start_example.png">
98
+
99
+ ## Development: Starter templates
100
+
101
+ For starter-templates for some popular frameworks and build stacks see /examples/templates.
102
+
103
+ * [Node starter template](/examples/templates/node)
104
+ * [Nuxt3+](/examples/templates/nuxt)
105
+ * TODO: React
106
+ * TODO: Next
107
+
108
+ It's easiest to clone this repo, navigate to the starter template directory (examples/templates) and use the npm install, dev etc commands.
109
+
110
+ If your framework is not present, just look at the others for inspiration. Modern ones work with the same methods. Contributions are welcome.
111
+
112
+ ## Notes on the WASM file
113
+
114
+ Archiyou is a TS/JS layer on top of a WASM build of [OpenCascade](https://github.com/Open-Cascade-SAS/OCCT).
115
+ Your application needs to be able to find the WASM file for it to work. If you experience errors during import or execution this is most probably the cause! Check starter templates how to configure build systems like Vite for WASM.
116
+
117
+
118
+ ## Run scripts independently from Archiyou platform
119
+
120
+ If you want to locally execute scripts from our Editor and get certain outputs: use the Runner.
121
+
122
+
123
+ ```ts
124
+ import { Runner } from 'archiyou'
125
+ // A runner executes Archiyou scripts
126
+ const runner = new Runner()
127
+
128
+ // First a Runner needs to load (because it uses WASM)
129
+ runner.load().then(async (runner) =>
130
+ {
131
+ // Then you execute a script in the default scope
132
+ const r = await runner.execute({
133
+ code: `b = box($SIZE)`,
134
+ params: { SIZE: 100 } },
135
+ { formats: ['glb'] }
136
+ );
137
+ const glb = r?.meshGLB; // The 3D model mesh in GLB format (default)
138
+ console.log(`Generating a GLB box took: ${r.duration} ms`);
139
+ });
140
+
141
+ ```
142
+
143
+ Runner also offers easy ways to execute scripts in a Webworker which is the best way if you want create a larger online CAD application.
144
+
145
+ ## Examples and use cases
146
+
147
+ Archiyou is focused on physical things to build - like furniture and constructions - but the Editor can do much more:
148
+
149
+ <table>
150
+ <tr>
151
+ <td>
152
+ <a href="https://editor.archiyou.com/_/mark/scripts/Mascotte:0.5">
153
+ <img src="/assets/ay_example_mascotte.png" width="24%">
154
+ </a>
155
+ </td>
156
+ <td>
157
+ <a href="https://editor.archiyou.com/_/mark/scripts/Bracket:0.1">
158
+ <img src="/assets/ay_example_bracket.png" width="24%">
159
+ </a>
160
+ </td>
161
+ <td>
162
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/Boat:0.6">
163
+ <img src="/assets/ay_example_boat.png" width="24%">
164
+ </a>
165
+ </td>
166
+ <td>
167
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/BooleanBlob:0.1">
168
+ <img src="/assets/ay_example_booleanblob.png" width="24%">
169
+ </a>
170
+ </td>
171
+ </tr>
172
+ <tr>
173
+ <td>
174
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/KeyChain:0.6">
175
+ <img src="/assets/ay_example_keychain.png" width="24%">
176
+ </a>
177
+ </td>
178
+ <td>
179
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/GardenChair:0.5.0">
180
+ <img src="/assets/ay_example_gardenchair.png" width="24%">
181
+ </td>
182
+ <td>
183
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/UrBent:0.1">
184
+ <img src="/assets/ay_example_bent.png" width="24%">
185
+ </a>
186
+ </td>
187
+ <td>
188
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/UrHouseAssembly:0.5">
189
+ <img src="/assets/ay_example_house.png" width="24%">
190
+ </a>
191
+ </td>
192
+ </tr>
193
+ </table>
194
+
195
+ Where Archiyou really shines is handling documentation and output pipelines:
196
+
197
+ <a href="https://editor.archiyou.com/_/archiyou/scripts/MariTavolo:0.6"><img src="/assets/archiyou_docs.png" width="100%"></a>
198
+
199
+ ## Roadmap 2026
200
+
201
+ Thanks to [NLNET NG0 Commons Fund](https://nlnet.nl/project/Archiyou/) we can further develop the open source and open design community functionalies of Archiyou.
202
+
203
+ This is a basic roadmap:
204
+
205
+ - [x] Open design user research, strategy and UX/UI
206
+ - [x] DevX: Archiyou as module, examples, templates
207
+ - [x] New high performance (mesh) geometry kernel: [CSGRS](https://github.com/timschmidt/csgrs) and [Meshup](https://github.com/ArchiyouApp/meshup)
208
+ - [ ] Fully open source stack (including publishing)
209
+ - [ ] New lightweight viewer/configurator: portability, extendability
210
+ - [ ] New editor: more value for more users
211
+ - [ ] New open design platform
212
+
213
+ Please reach out for more information, ideas or collaboration!
214
+
215
+