From 78cb17baa42fd9bf94fd47c9cce7ee795eb088be Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sat, 10 Oct 2020 12:23:57 +1100 Subject: [PATCH 1/9] add component --- web/src/components/BlogPost/BlogPost.js | 16 ++++++++++++++++ web/src/components/BlogPost/BlogPost.stories.js | 7 +++++++ web/src/components/BlogPost/BlogPost.test.js | 11 +++++++++++ web/src/components/BlogPostCell/BlogPostCell.js | 4 +++- .../components/BlogPostsCell/BlogPostsCell.js | 15 +++------------ 5 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 web/src/components/BlogPost/BlogPost.js create mode 100644 web/src/components/BlogPost/BlogPost.stories.js create mode 100644 web/src/components/BlogPost/BlogPost.test.js diff --git a/web/src/components/BlogPost/BlogPost.js b/web/src/components/BlogPost/BlogPost.js new file mode 100644 index 0000000..524ee4b --- /dev/null +++ b/web/src/components/BlogPost/BlogPost.js @@ -0,0 +1,16 @@ +import { Link, routes } from '@redwoodjs/router' + +const BlogPost = ({ post }) => { + return ( +
+
+

+ {post.title} +

+
+
{post.body}
+
+ ) +} + +export default BlogPost \ No newline at end of file diff --git a/web/src/components/BlogPost/BlogPost.stories.js b/web/src/components/BlogPost/BlogPost.stories.js new file mode 100644 index 0000000..03e9f5f --- /dev/null +++ b/web/src/components/BlogPost/BlogPost.stories.js @@ -0,0 +1,7 @@ +import BlogPost from './BlogPost' + +export const generated = () => { + return +} + +export default { title: 'Components/BlogPost' } diff --git a/web/src/components/BlogPost/BlogPost.test.js b/web/src/components/BlogPost/BlogPost.test.js new file mode 100644 index 0000000..87f976f --- /dev/null +++ b/web/src/components/BlogPost/BlogPost.test.js @@ -0,0 +1,11 @@ +import { render } from '@redwoodjs/testing' + +import BlogPost from './BlogPost' + +describe('BlogPost', () => { + it('renders successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) +}) diff --git a/web/src/components/BlogPostCell/BlogPostCell.js b/web/src/components/BlogPostCell/BlogPostCell.js index f3a0cb4..fd7987f 100644 --- a/web/src/components/BlogPostCell/BlogPostCell.js +++ b/web/src/components/BlogPostCell/BlogPostCell.js @@ -1,3 +1,5 @@ +import BlogPost from 'src/components/BlogPost' + export const QUERY = gql` query BlogPostQuery($id: Int!) { post(id: $id) { @@ -16,5 +18,5 @@ export const Empty = () =>
Empty
export const Failure = ({ error }) =>
Error: {error.message}
export const Success = ({ post }) => { - return JSON.stringify(post) + return } diff --git a/web/src/components/BlogPostsCell/BlogPostsCell.js b/web/src/components/BlogPostsCell/BlogPostsCell.js index 6c48cae..1d4cb61 100644 --- a/web/src/components/BlogPostsCell/BlogPostsCell.js +++ b/web/src/components/BlogPostsCell/BlogPostsCell.js @@ -1,4 +1,5 @@ import { Link, routes } from '@redwoodjs/router' +import BlogPost from 'src/components/BlogPost' export const QUERY = gql` query BlogPostsQuery { @@ -18,15 +19,5 @@ export const Empty = () =>
Empty
export const Failure = ({ error }) =>
Error: {error.message}
export const Success = ({ posts }) => { - return posts.map((post) => ( -
-
-

- {post.title} -

-
-

{post.body}

-
Posted on: {post.createdAt.split('T')[0]}
-
- )) -} \ No newline at end of file + return posts.map((post) => ) +} From 72ef8347e936672c48f1d03e39b63672bf4bc2c7 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 11 Oct 2020 07:26:08 +1100 Subject: [PATCH 2/9] get editor running somewhat --- .gitmodules | 3 +++ .vscode/settings.json | 10 +++++++++- package.json | 10 +++++++++- web/src/cascade | 1 + web/src/pages/HomePage/HomePage.js | 4 ++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 web/src/cascade diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2afed48 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "web/src/cascade"] + path = web/src/cascade + url = https://github.com/zalo/CascadeStudio.git diff --git a/.vscode/settings.json b/.vscode/settings.json index bb0578d..a95220c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,13 @@ }, "[prisma]": { "editor.formatOnSave": true - } + }, + "eslint.workingDirectories": [ + "./api", + "./web/src/components", + "./web/src/layouts", + "./web/src/pages", + "./web/src/index.js", + "./web/src/Routes.js", + ] } diff --git a/package.json b/package.json index ca2982c..df618e1 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,15 @@ "@redwoodjs/core": "^0.19.2" }, "eslintConfig": { - "extends": "@redwoodjs/eslint-config" + "extends": "@redwoodjs/eslint-config", + "workingDirectories": [ + "./api", + "./web/src/components", + "./web/src/layouts", + "./web/src/pages", + "./web/src/index.js", + "./web/src/Routes.js" + ] }, "engines": { "node": ">=12", diff --git a/web/src/cascade b/web/src/cascade new file mode 160000 index 0000000..755670b --- /dev/null +++ b/web/src/cascade @@ -0,0 +1 @@ +Subproject commit 755670b8ebd57a491b7e2bf919af99f5dbfe5d1a diff --git a/web/src/pages/HomePage/HomePage.js b/web/src/pages/HomePage/HomePage.js index 7d32e12..749ab04 100644 --- a/web/src/pages/HomePage/HomePage.js +++ b/web/src/pages/HomePage/HomePage.js @@ -1,11 +1,15 @@ import BlogLayout from 'src/layouts/BlogLayout' import BlogPostsCell from 'src/components/BlogPostsCell' +import { initialize} from 'src/cascade/js/MainPage/CascadeMain' const HomePage = () => { return ( +
+ +
) } From 8fa059c53b3b650f6f14a596857148b5ca49e655 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 11 Oct 2020 08:27:33 +1100 Subject: [PATCH 3/9] resolved a number more errors --- web/src/cascade | 2 +- web/src/index.html | 3 +++ web/src/pages/HomePage/HomePage.js | 40 ++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/web/src/cascade b/web/src/cascade index 755670b..fa92c11 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit 755670b8ebd57a491b7e2bf919af99f5dbfe5d1a +Subproject commit fa92c1143305f5ac2a4041fe6fdc4e82d407874a diff --git a/web/src/index.html b/web/src/index.html index 8f69230..3b63adb 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -5,6 +5,9 @@ <%= htmlWebpackPlugin.options.title %> +
diff --git a/web/src/pages/HomePage/HomePage.js b/web/src/pages/HomePage/HomePage.js index 749ab04..86fec29 100644 --- a/web/src/pages/HomePage/HomePage.js +++ b/web/src/pages/HomePage/HomePage.js @@ -1,6 +1,7 @@ import BlogLayout from 'src/layouts/BlogLayout' import BlogPostsCell from 'src/components/BlogPostsCell' -import { initialize} from 'src/cascade/js/MainPage/CascadeMain' +import { initialize } from 'src/cascade/js/MainPage/CascadeMain' + const HomePage = () => { return ( @@ -9,9 +10,44 @@ const HomePage = () => { ) } -export default HomePage \ No newline at end of file +export default HomePage From 365674b7a3faa8b10d9e22a9849a339eed933f06 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 11 Oct 2020 12:33:10 +1100 Subject: [PATCH 4/9] Displaying in browser --- package.json | 4 + web/config/webpack.config.js | 7 + web/package.json | 9 +- web/public/StandardLibraryIntellisense.ts | 213 +++ web/public/Three.d.ts | 177 +++ web/public/opencascade.d.ts | 1644 +++++++++++++++++++++ web/src/cascade | 2 +- web/src/index.html | 31 +- web/src/index.js | 4 + web/src/pages/HomePage/HomePage.js | 13 +- yarn.lock | 39 + 11 files changed, 2133 insertions(+), 10 deletions(-) create mode 100644 web/config/webpack.config.js create mode 100644 web/public/StandardLibraryIntellisense.ts create mode 100644 web/public/Three.d.ts create mode 100644 web/public/opencascade.d.ts diff --git a/package.json b/package.json index df618e1..8f4dc54 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "web" ] }, + "scripts": { + "comment": "Rather crude approach to move ts definitions into the public folder so the browser can grab them later in CascadeMain.js", + "move-ts-defs": "cp ./node_modules/opencascade.js/dist/opencascade.d.ts ./web/public && cp ./node_modules/three/src/Three.d.ts ./web/public && cp ./web/src/cascade/js/StandardLibraryIntellisense.ts ./web/public" + }, "devDependencies": { "@redwoodjs/core": "^0.19.2" }, diff --git a/web/config/webpack.config.js b/web/config/webpack.config.js new file mode 100644 index 0000000..78b4eb9 --- /dev/null +++ b/web/config/webpack.config.js @@ -0,0 +1,7 @@ +const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); + +module.exports = { + plugins: [ + new MonacoWebpackPlugin() + ] +} diff --git a/web/package.json b/web/package.json index 094fe55..b6b12fa 100644 --- a/web/package.json +++ b/web/package.json @@ -16,8 +16,15 @@ "@redwoodjs/forms": "^0.19.2", "@redwoodjs/router": "^0.19.2", "@redwoodjs/web": "^0.19.2", + "controlkit": "^0.1.9", + "golden-layout": "^1.5.9", + "jquery": "^3.5.1", + "monaco-editor": "^0.20.0", + "monaco-editor-webpack-plugin": "^1.9.1", + "opencascade.js": "^0.1.15", "prop-types": "^15.7.2", "react": "^16.13.1", - "react-dom": "^16.13.1" + "react-dom": "^16.13.1", + "three": "^0.118.3" } } diff --git a/web/public/StandardLibraryIntellisense.ts b/web/public/StandardLibraryIntellisense.ts new file mode 100644 index 0000000..f0e0bd4 --- /dev/null +++ b/web/public/StandardLibraryIntellisense.ts @@ -0,0 +1,213 @@ +/** The list that stores all of the OpenCascade shapes for rendering. + * Add to this when using imported files or doing custom oc. operations. + * @example```sceneShapes.push(externalShapes['myStep.step']);``` */ +var sceneShapes: oc.TopoDS_Shape[]; + +/** The dictionary that stores all of your imported STEP and IGES files. Push to sceneShapes to render in the view! + * @example```sceneShapes.push(externalShapes['myStep.step']);``` */ +var externalShapes: { [filename: string]: oc.TopoDS_Shape }; + +/** Starts sketching a 2D shape which can contain lines, arcs, bezier splines, and fillets. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let sketch = new Sketch([0,0]).LineTo([100,0]).Fillet(20).LineTo([100,100]).End(true).Face();```*/ +class Sketch { + constructor(startingPoint: number[]); + + faces : oc.TopoDS_Face[]; + wires : oc.TopoDS_Wire[]; + firstPoint : oc.gp_Pnt; + lastPoint : oc.gp_Pnt; + wireBuilder : oc.BRepBuilderAPI_MakeWire; + + Start (startingPoint : number[] ) : Sketch; + End (closed ?: boolean , reversed?:boolean) : Sketch; + AddWire (wire : oc. TopoDS_Wire) : Sketch; + + LineTo (nextPoint : number[] ) : Sketch; + ArcTo (pointOnArc : number[], arcEnd : number[]) : Sketch; + BezierTo(bezierControlPoints : number[][]): Sketch; + BSplineTo(bsplinePoints : number[][]): Sketch; + /** Adds a 2D Fillet of specified radius at this vertex. Only applies to Faces! + * If a Wire is needed, use ForEachWire() to get the Wire from the resulting Face! */ + Fillet (radius : number ) : Sketch; + Face (reversed ?:boolean) : oc.TopoDS_Face; + Wire (reversed ?:boolean) : oc.TopoDS_Wire; + /** Punches a circular hole in the existing face (may need to use reversed) */ + Circle (center ?:number[], radius:number, reversed?:boolean) : Sketch; +} + +/** Creates a solid box with dimensions x, y, and, z and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let myBox = Box(10, 20, 30);```*/ +function Box(x: number, y: number, z: number, centered?: boolean): oc.TopoDS_Shape; +/** Creates a solid sphere of specified radius and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let mySphere = Sphere(40);```*/ +function Sphere(radius: number): oc.TopoDS_Shape; +/** Creates a solid cylinder of specified radius and height and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let myCylinder = Cylinder(30, 50);```*/ +function Cylinder(radius: number, height: number, centered?: boolean): oc.TopoDS_Shape; +/** Creates a solid cone of specified bottom radius, top radius, and height and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let myCone = Cone(30, 50);```*/ +function Cone(radius1: number, radius2: number, height: number): oc.TopoDS_Shape; +/** Creates a polygon from a list of 3-component lists (points) and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let triangle = Polygon([[0, 0, 0], [50, 0, 0], [25, 50, 0]]);```*/ +function Polygon(points: number[][], wire?: boolean): oc.TopoDS_Shape; +/** Creates a circle from a radius and adds it to `sceneShapes` for rendering. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let circle = Circle(50);```*/ +function Circle(radius:number, wire?:boolean) : oc.TopoDS_Shape; +/** Creates a bspline from a list of 3-component lists (points). + * This can be converted into a face via the respective oc.BRepBuilderAPI functions. + * Or used directly with BRepPrimAPI_MakeRevolution() + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let bspline = BSpline([[0,0,0], [40, 0, 50], [50, 0, 50]], true);```*/ +function BSpline(points:number[][], closed?:boolean) : oc.TopoDS_Shape; +/** Creates set of glyph solids from a string and a font-file and adds it to sceneShapes. + * Note that all the characters share a singular face. + * + * Defaults: size:36, height:0.15, fontName: 'Consolas' + * + * Try 'Roboto' or 'Papyrus' for an alternative typeface. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let myText = Text3D("Hello!");```*/ +function Text3D(text?: string = "Hi!", size?: number = "36", height?: number = 0.15, fontURL?: string = "Consolas") : oc.TopoDS_Shape; + + +/** Joins a list of shapes into a single solid. + * The original shapes are removed unless `keepObjects` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let sharpSphere = Union([Sphere(38), Box(50, 50, 50, true)]);```*/ +function Union(objectsToJoin: oc.TopoDS_Shape[], keepObjects?: boolean, fuzzValue?:number, keepEdges?: boolean): oc.TopoDS_Shape; +/** Subtracts a list of shapes from mainBody. + * The original shapes are removed unless `keepObjects` is true. Returns a Compound Shape unless onlyFirstSolid is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let floatingCorners = Difference(Box(50, 50, 50, true), [Sphere(38)]);```*/ +function Difference(mainBody: oc.TopoDS_Shape, objectsToSubtract: oc.TopoDS_Shape[], keepObjects?: boolean, fuzzValue?:number, keepEdges?: boolean): oc.TopoDS_Shape; +/** Takes only the intersection of a list of shapes. + * The original shapes are removed unless `keepObjects` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let roundedBox = Intersection([Box(50, 50, 50, true), Sphere(38)]);```*/ +function Intersection(objectsToIntersect: oc.TopoDS_Shape[], keepObjects?: boolean, fuzzValue?: number, keepEdges?: boolean): oc.TopoDS_Shape; +/** Removes internal, unused edges from the insides of faces on this shape. Keeps the model clean. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let cleanPart = RemoveInternalEdges(part);```*/ +function RemoveInternalEdges(shape: oc.TopoDS_Shape, keepShape?: boolean) : oc.TopoDS_Shape; +/** Extrudes a shape along direction, a 3-component vector. Edges form faces, Wires form shells, Faces form solids, etc. + * The original face is removed unless `keepFace` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let tallTriangle = Extrude(Polygon([[0, 0, 0], [50, 0, 0], [25, 50, 0]]), [0, 0, 50]);```*/ +function Extrude(face: oc.TopoDS_Shape, direction: number[], keepFace?: boolean) : oc.TopoDS_Shape; +/** Extrudes and twists a flat *wire* upwards along the z-axis (see the optional argument for Polygon). + * The original wire is removed unless `keepWire` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let twistyTriangle = RotatedExtrude(Polygon([[-25, -15, 0], [25, -15, 0], [0, 35, 0]], true), 50, 90);```*/ +function RotatedExtrude(wire: oc.TopoDS_Shape, height: number, rotation: number, keepWire?: boolean) : oc.TopoDS_Shape; +/** Lofts a solid through the sections defined by an array of 2 or more closed wires. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) */ +function Loft(wireSections: oc.TopoDS_Shape[], keepWires?: boolean): oc.TopoDS_Shape; +/** Revolves this shape "degrees" about "axis" (a 3-component array). Edges form faces, Wires form shells, Faces form solids, etc. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let cone = Revolve(Polygon([[0, 0, 0], [0, 0, 50], [50, 0, 0]]));```*/ +function Revolve(shape: oc.TopoDS_Shape, degrees?: number, axis?: number[], keepShape?: boolean, copy?: boolean): oc.TopoDS_Shape; +/** Sweeps this shape along a path wire. + * The original shapes are removed unless `keepObjects` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let pipe = Pipe(Circle(20), BSpline([[0,0,0],[0,0,50],[20,0,100]], false, true));```*/ +function Pipe(shape: oc.TopoDS_Shape, wirePath: oc.TopoDS_Shape, keepInputs?: boolean): oc.TopoDS_Shape; +/** Offsets the faces of a shape by offsetDistance + * The original shape is removed unless `keepShape` is true. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let roundedCube = Offset(Box(10,10,10), 10);```*/ +function Offset(shape: oc.TopoDS_Shape, offsetDistance: number, tolerance?: number, keepShape?: boolean) : oc.TopoDS_Shape; + +/** Creates a labeled slider with specified defaults, mins, and max ranges. + * @example```let currentSliderValue = Slider("Radius", 30 , 20 , 40);``` + * `name` needs to be unique! + * + * `callback` triggers whenever the mouse is let go, and `realTime` will cause the slider to update every frame that there is movement (but it's buggy!)*/ +function Slider(name: string, defaultValue: number, min: number, max: number, realTime?: boolean): number; +/** Creates a button that will trigger `callback` when clicked. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```Button("Yell", ()=>{ console.log("Help! I've been clicked!"); });```*/ +function Button(name: string) : void; +/** Creates a checkbox that returns true or false. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let currentCheckboxValue = Checkbox("Check?", true);``` + * + * `callback` triggers when the button is clicked.*/ +function Checkbox(name: string, defaultValue: boolean): boolean; + +/** BETA: Transform a shape using an in-view transformation gizmo. + * + * Shortcuts: `T` - Translate, `R` - Rotate, `S` - Scale, `W`/`L` - Toggle World/Local Space + * + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let transformedSphere = Transform(Sphere(50));```*/ +function Transform(shape: oc.TopoDS_Shape): oc.TopoDS_Shape; +/** BETA: Transform a shape using an in-view transformation gizmo. + * + * Shortcuts: `T` - Translate, `R` - Rotate, `S` - Scale, `W`/`L` - Toggle World/Local + * + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let transformedSphere = Transform(Sphere(50));```*/ +function Transform(translation: number[], rotation: (number|number[])[], scale: number, shape: oc.TopoDS_Shape, keepOriginal?: boolean): oc.TopoDS_Shape; + +/** Translate a shape along the x, y, and z axes (using an array of 3 numbers). + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let upwardSphere = Translate([0, 0, 50], Sphere(50));```*/ +function Translate(offset: number[], shape: oc.TopoDS_Shape, keepOriginal?: boolean): oc.TopoDS_Shape; + +/** Rotate a shape degrees about a 3-coordinate axis. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let leaningCylinder = Rotate([0, 1, 0], 45, Cylinder(25, 50));```*/ +function Rotate(axis: number[], degrees: number, shape: oc.TopoDS_Shape, keepOriginal?: boolean): oc.TopoDS_Shape; + +/** Scale a shape to be `scale` times its current size. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let scaledCylinder = Scale(50, Cylinder(0.5, 1));```*/ +function Scale(scale: number, shape: oc.TopoDS_Shape, keepOriginal?: boolean): oc.TopoDS_Shape; + +/** Iterate over all the solids in this shape, calling `callback` on each one. */ +function ForEachSolid(shape: oc.TopoDS_Shape, callback: (index: Number, shell: oc.TopoDS_Solid) => void): void; +/** Gets the indexth solid from this compound shape. */ +function GetSolidFromCompound(shape: oc.TopoDS_Shape, index?:number, keepOriginal?:boolean): oc.TopoDS_Solid; +/** Gets the indexth wire from this face (or above) shape. */ +function GetWire(shape: oc.TopoDS_Face, index?:number, keepOriginal?:boolean): oc.TopoDS_Wire; +/** Iterate over all the shells in this shape, calling `callback` on each one. */ +function ForEachShell(shape: oc.TopoDS_Shape, callback: (index: Number, shell: oc.TopoDS_Shell) => void): void; +/** Iterate over all the faces in this shape, calling `callback` on each one. */ +function ForEachFace(shape: oc.TopoDS_Shape, callback: (index: number, face: oc.TopoDS_Face) => void): void; +/** Iterate over all the wires in this shape, calling `callback` on each one. */ +function ForEachWire(shape: oc.TopoDS_Shape, callback: (wire: oc.TopoDS_Wire) => void): void; +/** Iterate over all the UNIQUE indices and edges in this shape, calling `callback` on each one. */ +function ForEachEdge(shape: oc.TopoDS_Shape, callback: (index: number, edge: oc.TopoDS_Edge) => void): {[edgeHash:number] : Number}[]; +/** Iterate over all the vertices in this shape, calling `callback` on each one. */ +function ForEachVertex(shape: oc.TopoDS_Shape, callback: (vertex: oc.TopoDS_Vertex) => void): void; +/** Attempt to Fillet all selected edge indices in "edgeList" with a radius. + * Hover over the edges you'd like to select and use those indices as in the example. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```FilletEdges(shape, 1, [0,1,2,7]);``` */ +function FilletEdges(shape: oc.TopoDS_Shape, radius: number, edgeList: number[], keepOriginal?:boolean): oc.TopoDS_Shape; +/** Attempt to Chamfer all selected edge indices in "edgeList" symmetrically by distance. + * Hover over the edges you'd like to select and use those indices in the edgeList array. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```ChamferEdges(shape, 1, [0,1,2,7]);``` */ +function ChamferEdges(shape: oc.TopoDS_Shape, distance: number, edgeList: number[], keepOriginal?:boolean): oc.TopoDS_Shape; + +/** Download this file URL through the browser. Use this to export information from the CAD engine. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```SaveFile("myInfo.txt", URL.createObjectURL( new Blob(["Hello, Harddrive!"], { type: 'text/plain' }) ));``` */ +function SaveFile(filename: string, fileURL: string): void; + +/** Explicitly Cache the result of this operation so that it can return instantly next time it is called with the same arguments. + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let box = CacheOp(arguments, () => { return new oc.BRepPrimAPI_MakeBox(x, y, z).Shape(); });``` */ +function CacheOp(arguments: IArguments, cacheMiss: () => oc.TopoDS_Shape): oc.TopoDS_Shape; + /** Remove this object from this array. Useful for preventing objects being added to `sceneShapes` (in cached functions). + * [Source](https://github.com/zalo/CascadeStudio/blob/master/js/CADWorker/CascadeStudioStandardLibrary.js) + * @example```let box = CacheOp(arguments, () => { let box = Box(x,y,z); sceneShapes = Remove(sceneShapes, box); return box; });``` */ +function Remove(array: any[], toRemove: any): any[]; diff --git a/web/public/Three.d.ts b/web/public/Three.d.ts new file mode 100644 index 0000000..b26e322 --- /dev/null +++ b/web/public/Three.d.ts @@ -0,0 +1,177 @@ +export * from './polyfills'; +export * from './renderers/WebGLMultisampleRenderTarget'; +export * from './renderers/WebGLCubeRenderTarget'; +export * from './renderers/WebGLRenderTarget'; +export * from './renderers/WebGLRenderer'; +export * from './renderers/WebGL1Renderer'; +export * from './renderers/shaders/ShaderLib'; +export * from './renderers/shaders/UniformsLib'; +export * from './renderers/shaders/UniformsUtils'; +export * from './renderers/shaders/ShaderChunk'; +export * from './scenes/FogExp2'; +export * from './scenes/Fog'; +export * from './scenes/Scene'; +export * from './objects/Sprite'; +export * from './objects/LOD'; +export * from './objects/InstancedMesh'; +export * from './objects/SkinnedMesh'; +export * from './objects/Skeleton'; +export * from './objects/Bone'; +export * from './objects/Mesh'; +export * from './objects/LineSegments'; +export * from './objects/LineLoop'; +export * from './objects/Line'; +export * from './objects/Points'; +export * from './objects/Group'; +export * from './textures/VideoTexture'; +export * from './textures/DataTexture'; +export * from './textures/DataTexture3D'; +export * from './textures/CompressedTexture'; +export * from './textures/CubeTexture'; +export * from './textures/CanvasTexture'; +export * from './textures/DepthTexture'; +export * from './textures/Texture'; +export * from './geometries/Geometries'; +export * from './materials/Materials'; +export * from './loaders/AnimationLoader'; +export * from './loaders/CompressedTextureLoader'; +export * from './loaders/DataTextureLoader'; +export * from './loaders/CubeTextureLoader'; +export * from './loaders/TextureLoader'; +export * from './loaders/ObjectLoader'; +export * from './loaders/MaterialLoader'; +export * from './loaders/BufferGeometryLoader'; +export * from './loaders/LoadingManager'; +export * from './loaders/ImageLoader'; +export * from './loaders/ImageBitmapLoader'; +export * from './loaders/FontLoader'; +export * from './loaders/FileLoader'; +export * from './loaders/Loader'; +export * from './loaders/LoaderUtils'; +export * from './loaders/Cache'; +export * from './loaders/AudioLoader'; +export * from './lights/SpotLightShadow'; +export * from './lights/SpotLight'; +export * from './lights/PointLight'; +export * from './lights/RectAreaLight'; +export * from './lights/HemisphereLight'; +export * from './lights/DirectionalLightShadow'; +export * from './lights/DirectionalLight'; +export * from './lights/AmbientLight'; +export * from './lights/LightShadow'; +export * from './lights/Light'; +export * from './lights/AmbientLightProbe'; +export * from './lights/HemisphereLightProbe'; +export * from './lights/LightProbe'; +export * from './cameras/StereoCamera'; +export * from './cameras/PerspectiveCamera'; +export * from './cameras/OrthographicCamera'; +export * from './cameras/CubeCamera'; +export * from './cameras/ArrayCamera'; +export * from './cameras/Camera'; +export * from './audio/AudioListener'; +export * from './audio/PositionalAudio'; +export * from './audio/AudioContext'; +export * from './audio/AudioAnalyser'; +export * from './audio/Audio'; +export * from './animation/tracks/VectorKeyframeTrack'; +export * from './animation/tracks/StringKeyframeTrack'; +export * from './animation/tracks/QuaternionKeyframeTrack'; +export * from './animation/tracks/NumberKeyframeTrack'; +export * from './animation/tracks/ColorKeyframeTrack'; +export * from './animation/tracks/BooleanKeyframeTrack'; +export * from './animation/PropertyMixer'; +export * from './animation/PropertyBinding'; +export * from './animation/KeyframeTrack'; +export * from './animation/AnimationUtils'; +export * from './animation/AnimationObjectGroup'; +export * from './animation/AnimationMixer'; +export * from './animation/AnimationClip'; +export * from './animation/AnimationAction'; +export * from './core/Uniform'; +export * from './core/InstancedBufferGeometry'; +export * from './core/BufferGeometry'; +export * from './core/Geometry'; +export * from './core/InterleavedBufferAttribute'; +export * from './core/InstancedInterleavedBuffer'; +export * from './core/InterleavedBuffer'; +export * from './core/InstancedBufferAttribute'; +export * from './core/BufferAttribute'; +export * from './core/Face3'; +export * from './core/Object3D'; +export * from './core/Raycaster'; +export * from './core/Layers'; +export * from './core/EventDispatcher'; +export * from './core/DirectGeometry'; +export * from './core/Clock'; +export * from './math/interpolants/QuaternionLinearInterpolant'; +export * from './math/interpolants/LinearInterpolant'; +export * from './math/interpolants/DiscreteInterpolant'; +export * from './math/interpolants/CubicInterpolant'; +export * from './math/Interpolant'; +export * from './math/Triangle'; +export * from './math/MathUtils'; +export * from './math/Spherical'; +export * from './math/Cylindrical'; +export * from './math/Plane'; +export * from './math/Frustum'; +export * from './math/Sphere'; +export * from './math/Ray'; +export * from './math/Matrix4'; +export * from './math/Matrix3'; +export * from './math/Box3'; +export * from './math/Box2'; +export * from './math/Line3'; +export * from './math/Euler'; +export * from './math/Vector4'; +export * from './math/Vector3'; +export * from './math/Vector2'; +export * from './math/Quaternion'; +export * from './math/Color'; +export * from './math/SphericalHarmonics3'; +export * from './extras/objects/ImmediateRenderObject'; +export * from './helpers/SpotLightHelper'; +export * from './helpers/SkeletonHelper'; +export * from './helpers/PointLightHelper'; +export * from './helpers/HemisphereLightHelper'; +export * from './helpers/GridHelper'; +export * from './helpers/PolarGridHelper'; +export * from './helpers/DirectionalLightHelper'; +export * from './helpers/CameraHelper'; +export * from './helpers/BoxHelper'; +export * from './helpers/Box3Helper'; +export * from './helpers/PlaneHelper'; +export * from './helpers/ArrowHelper'; +export * from './helpers/AxesHelper'; +export * from './extras/curves/Curves'; +export * from './extras/core/Shape'; +export * from './extras/core/Path'; +export * from './extras/core/ShapePath'; +export * from './extras/core/Font'; +export * from './extras/core/CurvePath'; +export * from './extras/core/Curve'; +export * from './extras/ImageUtils'; +export * from './extras/ShapeUtils'; +export * from './extras/PMREMGenerator'; +export * from './renderers/webgl/WebGLBufferRenderer'; +export * from './renderers/webgl/WebGLCapabilities'; +export * from './renderers/webgl/WebGLClipping'; +export * from './renderers/webgl/WebGLExtensions'; +export * from './renderers/webgl/WebGLGeometries'; +export * from './renderers/webgl/WebGLIndexedBufferRenderer'; +export * from './renderers/webgl/WebGLInfo'; +export * from './renderers/webgl/WebGLLights'; +export * from './renderers/webgl/WebGLObjects'; +export * from './renderers/webgl/WebGLProgram'; +export * from './renderers/webgl/WebGLPrograms'; +export * from './renderers/webgl/WebGLProperties'; +export * from './renderers/webgl/WebGLRenderLists'; +export * from './renderers/webgl/WebGLShader'; +export * from './renderers/webgl/WebGLShadowMap'; +export * from './renderers/webgl/WebGLState'; +export * from './renderers/webgl/WebGLTextures'; +export * from './renderers/webgl/WebGLUniforms'; +export * from './constants'; +export * from './Three.Legacy'; + +export as namespace THREE; diff --git a/web/public/opencascade.d.ts b/web/public/opencascade.d.ts new file mode 100644 index 0000000..ec2e400 --- /dev/null +++ b/web/public/opencascade.d.ts @@ -0,0 +1,1644 @@ +export default opencascade; +declare function opencascade(target?: T): Promise; +declare module opencascade { + function destroy(obj: any): void; + function _malloc(size: number): number; + function _free(ptr: number): void; + const HEAP8: Int8Array; + const HEAP16: Int16Array; + const HEAP32: Int32Array; + const HEAPU8: Uint8Array; + const HEAPU16: Uint16Array; + const HEAPU32: Uint32Array; + const HEAPF32: Float32Array; + const HEAPF64: Float64Array; + type Standard_Real = number; + type Standard_Boolean = boolean; + type Standard_Integer = number; + type Standard_CString = string; + class BRepBuilderAPI_MakeShape { + Build(): void; + Shape(): TopoDS_Shape; + IsDeleted(S: TopoDS_Shape): Standard_Boolean; + } + class BRepPrimAPI_MakeBox extends BRepBuilderAPI_MakeShape { + constructor(dx: Standard_Real, dy: Standard_Real, dz: Standard_Real); + constructor(P1: gp_Pnt, P2: gp_Pnt); + constructor(Axes: gp_Ax2, dx: Standard_Real, dy: Standard_Real, dz: Standard_Real); + Build(): void; + Shell(): TopoDS_Shell; + Solid(): TopoDS_Solid; + BottomFace(): TopoDS_Face; + BackFace(): TopoDS_Face; + FrontFace(): TopoDS_Face; + LeftFace(): TopoDS_Face; + RightFace(): TopoDS_Face; + TopFace(): TopoDS_Face; + } + class BRepPrimAPI_MakeCone extends BRepPrimAPI_MakeOneAxis { + constructor(R1: Standard_Real, R2: Standard_Real, H: Standard_Real); + constructor(R1: Standard_Real, R2: Standard_Real, H: Standard_Real, angle: Standard_Real); + constructor(Axes: gp_Ax2, R1: Standard_Real, R2: Standard_Real, H: Standard_Real, angle: Standard_Real); + } + class BRepPrimAPI_MakeCylinder extends BRepPrimAPI_MakeOneAxis { + constructor(R: Standard_Real, H: Standard_Real); + constructor(Axes: gp_Ax2, R: Standard_Real, H: Standard_Real); + constructor(Axes: gp_Ax2, R: Standard_Real, H: Standard_Real, Angle: Standard_Real); + } + class BRepPrimAPI_MakeHalfSpace extends BRepBuilderAPI_MakeShape { + constructor(Shell: TopoDS_Shell, RefPnt: gp_Pnt); + Solid(): TopoDS_Solid; + } + class BRepPrimAPI_MakeOneAxis extends BRepBuilderAPI_MakeShape { + Build(): void; + Face(): TopoDS_Face; + Shell(): TopoDS_Shell; + Solid(): TopoDS_Solid; + } + class BRepPrimAPI_MakeSweep extends BRepBuilderAPI_MakeShape { + FirstShape(): TopoDS_Shape; + LastShape(): TopoDS_Shape; + } + class BRepPrimAPI_MakePrism extends BRepPrimAPI_MakeSweep { + constructor(S: TopoDS_Shape, V: gp_Vec, Copy?: Standard_Boolean, Canonize?: Standard_Boolean); + Build(): void; + Generated(S: TopoDS_Shape): TopTools_ListOfShape; + IsDeleted(S: TopoDS_Shape): Standard_Boolean; + FirstShape(theShape: TopoDS_Shape): TopoDS_Shape; + LastShape(theShape: TopoDS_Shape): TopoDS_Shape; + } + class BRepPrimAPI_MakeRevol extends BRepPrimAPI_MakeSweep { + constructor(S: TopoDS_Shape, A: gp_Ax1, D: Standard_Real, Copy: Standard_Boolean); + constructor(S: TopoDS_Shape, A: gp_Ax1, Copy: Standard_Boolean); + Build(): void; + Generated(S: TopoDS_Shape): TopTools_ListOfShape; + IsDeleted(S: TopoDS_Shape): Standard_Boolean; + FirstShape(theShape: TopoDS_Shape): TopoDS_Shape; + LastShape(theShape: TopoDS_Shape): TopoDS_Shape; + HasDegenerated(): Standard_Boolean; + Degenerated(): TopTools_ListOfShape; + } + class BRepPrimAPI_MakeRevolution extends BRepPrimAPI_MakeOneAxis { + constructor(Meridian: Handle_Geom_Curve); + constructor(Meridian: Handle_Geom_Curve, angle: Standard_Real); + constructor(Axes: gp_Ax2, Meridian: Handle_Geom_Curve, angle: Standard_Real); + constructor(Axes: gp_Ax2, Meridian: Handle_Geom_Curve, VMin: Standard_Real, VMax: Standard_Real); + constructor(Axes: gp_Ax2, Meridian: Handle_Geom_Curve, VMin: Standard_Real, VMax: Standard_Real, angle: Standard_Real); + } + class BRepPrimAPI_MakeSphere extends BRepPrimAPI_MakeOneAxis { + constructor(R: Standard_Real); + constructor(Axis: gp_Ax2, R: Standard_Real); + constructor(Axis: gp_Ax2, R: Standard_Real, angle: Standard_Real); + constructor(Axis: gp_Ax2, R: Standard_Real, angle1: Standard_Real, angle2: Standard_Real); + constructor(Axis: gp_Ax2, R: Standard_Real, angle1: Standard_Real, angle2: Standard_Real, angle3: Standard_Real); + Sphere(): BRepPrim_Sphere; + } + class BRepPrimAPI_MakeTorus extends BRepPrimAPI_MakeOneAxis { + constructor(Axes: gp_Ax2, R1: Standard_Real, R2: Standard_Real); + constructor(Axes: gp_Ax2, R1: Standard_Real, R2: Standard_Real, angle: Standard_Real); + constructor(Axes: gp_Ax2, R1: Standard_Real, R2: Standard_Real, angle1: Standard_Real, angle2: Standard_Real); + constructor(Axes: gp_Ax2, R1: Standard_Real, R2: Standard_Real, angle1: Standard_Real, angle2: Standard_Real, angle: Standard_Real); + } + class BRepPrimAPI_MakeWedge extends BRepBuilderAPI_MakeShape { + constructor(dx: Standard_Real, dy: Standard_Real, dz: Standard_Real, ltx: Standard_Real); + constructor(Axes: gp_Ax2, dx: Standard_Real, dy: Standard_Real, dz: Standard_Real, ltx: Standard_Real); + constructor(dx: Standard_Real, dy: Standard_Real, dz: Standard_Real, xmin: Standard_Real, zmin: Standard_Real, xmax: Standard_Real, zmax: Standard_Real); + constructor(Axes: gp_Ax2, dx: Standard_Real, dy: Standard_Real, dz: Standard_Real, xmin: Standard_Real, zmin: Standard_Real, xmax: Standard_Real, zmax: Standard_Real); + Build(): void; + Shell(): TopoDS_Shell; + Solid(): TopoDS_Solid; + } + class BRepPrim_Sphere { + } + class GeomAPI_PointsToBSpline { + constructor(Points: TColgp_Array1OfPnt, DegMin?: Standard_Integer, DegMax?: Standard_Integer, Continuity?: GeomAbs_Shape, Tol3D?: Standard_Real); + Curve(): Handle_Geom_BSplineCurve; + IsDone(): Standard_Boolean; + } + class TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_Shape); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class GProp_GProps { + constructor(); + constructor(SystemLocation: gp_Pnt); + Mass(): Standard_Real; + CentreOfMass(): gp_Pnt; + MomentOfInertia(A1: gp_Ax1): Standard_Real; + RadiusOfGyration(A: gp_Ax1): Standard_Real; + StaticMoments(Ix: Standard_Real, Iy: Standard_Real, Iz: Standard_Real): void; + } + class BRepGProp { + LinearProperties(S: TopoDS_Shape, LProps: GProp_GProps, SkipShared?: Standard_Boolean, UseTriangulation?: Standard_Boolean): void; + SurfaceProperties(S: TopoDS_Shape, SProps: GProp_GProps, SkipShared?: Standard_Boolean, UseTriangulation?: Standard_Boolean): void; + SurfaceProperties2(S: TopoDS_Shape, SProps: GProp_GProps, Eps: Standard_Real, SkipShared?: Standard_Boolean): Standard_Real; + VolumeProperties(S: TopoDS_Shape, VProps: GProp_GProps, OnlyClosed?: Standard_Boolean, SkipShared?: Standard_Boolean, UseTriangulation?: Standard_Boolean): void; + VolumeProperties2(S: TopoDS_Shape, VProps: GProp_GProps, Eps: Standard_Real, OnlyClosed?: Standard_Boolean, SkipShared?: Standard_Boolean): Standard_Real; + VolumePropertiesGK(S: TopoDS_Shape, VProps: GProp_GProps, Eps?: Standard_Real, OnlyClosed?: Standard_Boolean, IsUseSpan?: Standard_Boolean, CGFlag?: Standard_Boolean, IFlag?: Standard_Boolean, SkipShared?: Standard_Boolean): Standard_Real; + VolumePropertiesGK2(S: TopoDS_Shape, VProps: GProp_GProps, thePln: gp_Pln, Eps?: Standard_Real, OnlyClosed?: Standard_Boolean, IsUseSpan?: Standard_Boolean, CGFlag?: Standard_Boolean, IFlag?: Standard_Boolean, SkipShared?: Standard_Boolean): Standard_Real; + } + class gp_Pln { + constructor(); + constructor(P: gp_Pnt, V: gp_Dir); + Coefficients(A: Standard_Real, B: Standard_Real, C: Standard_Real, D: Standard_Real): void; + SetAxis(A1: gp_Ax1): void; + SetLocation(Loc: gp_Pnt): void; + UReverse(): void; + VReverse(): void; + Direct(): Standard_Boolean; + Axis(): gp_Ax1; + Location(): gp_Pnt; + Distance(P: gp_Pnt): Standard_Real; + SquareDistance(P: gp_Pnt): Standard_Real; + XAxis(): gp_Ax1; + YAxis(): gp_Ax1; + Contains(P: gp_Pnt, LinearTolerance: Standard_Real): Standard_Boolean; + Contains(L: gp_Lin, LinearTolerance: Standard_Real, AngularTolerance: Standard_Real): Standard_Boolean; + Mirror(P: gp_Pnt): void; + Mirrored(P: gp_Pnt): gp_Pln; + Rotate(A1: gp_Ax1, Ang: Standard_Real): void; + Rotated(A1: gp_Ax1, Ang: Standard_Real): gp_Pln; + Scale(P: gp_Pnt, S: Standard_Real): void; + Scaled(P: gp_Pnt, S: Standard_Real): gp_Pln; + Transform(T: gp_Trsf): void; + Transformed(T: gp_Trsf): gp_Pln; + Translate(V: gp_Vec): void; + Translated(V: gp_Vec): gp_Pln; + Translate(P1: gp_Pnt, P2: gp_Pnt): void; + Translated(P1: gp_Pnt, P2: gp_Pnt): gp_Pln; + } + class BRepMesh_IncrementalMesh { + constructor(); + constructor(theShape: TopoDS_Shape, theLinDeflection: Standard_Real); + constructor(theShape: TopoDS_Shape, theLinDeflection: Standard_Real, isRelative: Standard_Boolean); + constructor(theShape: TopoDS_Shape, theLinDeflection: Standard_Real, isRelative: Standard_Boolean, theAngDeflection: Standard_Real); + } + class Bnd_Box { + constructor(); + constructor(theMin: gp_Pnt, theMax: gp_Pnt); + SetWhole(): void; + SetVoid(): void; + Set(P: gp_Pnt): void; + Set(P: gp_Pnt, D: gp_Dir): void; + Update(aXMin: Standard_Real, aYMin: Standard_Real, aZMin: Standard_Real, aXMax: Standard_Real, aYMax: Standard_Real, aZMax: Standard_Real): void; + Update(X: Standard_Real, Y: Standard_Real, Z: Standard_Real): void; + GetGap(): Standard_Real; + SetGap(Tol: Standard_Real): void; + Enlarge(Tol: Standard_Real): void; + GetXmin(): Standard_Real; + GetXmax(): Standard_Real; + GetYmin(): Standard_Real; + GetYmax(): Standard_Real; + GetZmin(): Standard_Real; + GetZmax(): Standard_Real; + CornerMin(): gp_Pnt; + CornerMax(): gp_Pnt; + OpenXmin(): void; + OpenXmax(): void; + OpenYmin(): void; + OpenYmax(): void; + OpenZmin(): void; + OpenZmax(): void; + IsOpen(): Standard_Boolean; + IsOpenXmin(): Standard_Boolean; + IsOpenXmax(): Standard_Boolean; + IsOpenYmin(): Standard_Boolean; + IsOpenYmax(): Standard_Boolean; + IsOpenZmin(): Standard_Boolean; + IsOpenZmax(): Standard_Boolean; + IsWhole(): Standard_Boolean; + IsVoid(): Standard_Boolean; + IsXThin(tol: Standard_Real): Standard_Boolean; + IsYThin(tol: Standard_Real): Standard_Boolean; + IsZThin(tol: Standard_Real): Standard_Boolean; + IsThin(tol: Standard_Real): Standard_Boolean; + Transformed(T: gp_Trsf): Bnd_Box; + Add(Other: Bnd_Box): void; + Add(P: gp_Pnt, D: gp_Dir): void; + IsOut(P: gp_Pnt): Standard_Boolean; + IsOut(Other: Bnd_Box, T: gp_Trsf): Standard_Boolean; + IsOut(T1: gp_Trsf, Other: Bnd_Box, T2: gp_Trsf): Standard_Boolean; + Distance(Other: Bnd_Box): Standard_Real; + Dump(): void; + SquareExtent(): Standard_Real; + FinitePart(): Bnd_Box; + HasFinitePart(): Standard_Boolean; + } + class Bnd_OBB { + constructor(); + constructor(theCenter: gp_Pnt, theXDirection: gp_Dir, theYDirection: gp_Dir, theZDirection: gp_Dir, theHXSize: Standard_Real, theHYSize: Standard_Real, theHZSize: Standard_Real); + constructor(theBox: Bnd_Box); + ReBuild(theListOfPoints: TColgp_Array1OfPnt, theListOfTolerances: TColStd_Array1OfReal, theIsOptimal?: Standard_Boolean): void; + SetCenter(theCenter: gp_Pnt): void; + SetXComponent(theXDirection: gp_Dir, theHXSize: Standard_Real): void; + SetYComponent(theYDirection: gp_Dir, theHYSize: Standard_Real): void; + SetZComponent(theZDirection: gp_Dir, theHZSize: Standard_Real): void; + XHSize(): Standard_Real; + YHSize(): Standard_Real; + ZHSize(): Standard_Real; + IsVoid(): Standard_Boolean; + SetVoid(): void; + SetAABox(theFlag: Standard_Boolean): void; + IsAABox(): Standard_Boolean; + Enlarge(theGapAdd: Standard_Real): void; + GetVertex(theP: gp_Pnt): Standard_Boolean; + SquareExtent(): Standard_Real; + IsOut(theOther: Bnd_OBB): Standard_Boolean; + IsCompletelyInside(theOther: Bnd_OBB): Standard_Boolean; + Add(theOther: Bnd_OBB): void; + } + class BRepBndLib { + constructor(); + Add(S: TopoDS_Shape, B: Bnd_Box, useTriangulation?: Standard_Boolean): void; + AddClose(S: TopoDS_Shape, B: Bnd_Box): void; + AddOptimal(S: TopoDS_Shape, B: Bnd_Box, useTriangulation?: Standard_Boolean, useShapeToerance?: Standard_Boolean): void; + AddOBB(theS: TopoDS_Shape, theOBB: Bnd_OBB, theIsTriangulationUsed?: Standard_Boolean, theIsOptimal?: Standard_Boolean, theIsShapeToleranceUsed?: Standard_Boolean): void; + } + class gp_Vec { + constructor(Xv: Standard_Real, Yv: Standard_Real, Zv: Standard_Real); + X(): Standard_Real; + Y(): Standard_Real; + Z(): Standard_Real; + } + class Geom_Circle { + constructor(C: gp_Circ); + constructor(A2: gp_Ax2, Radius: Standard_Real); + Radius(): Standard_Real; + } + class Geom_Ellipse extends Geom_Conic { + constructor(C: gp_Elips); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + MajorRadius(): Standard_Real; + MinorRadius(): Standard_Real; + } + class Geom_Hyperbola extends Geom_Conic { + constructor(C: gp_Hypr); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + MajorRadius(): Standard_Real; + MinorRadius(): Standard_Real; + } + class Geom_Parabola extends Geom_Conic { + constructor(C: gp_Parab); + constructor(A2: gp_Ax2, Focal: Standard_Real); + Focal(): Standard_Real; + } + class Geom_Conic extends Geom_Curve { + } + class gp_Pnt { + constructor(); + constructor(Xp: Standard_Real, Yp: Standard_Real, Zp: Standard_Real); + SetCoord(Index: Standard_Integer, Xi: Standard_Real): void; + SetCoord(Xp: Standard_Real, Yp: Standard_Real, Zp: Standard_Real): void; + SetX(X: Standard_Real): void; + SetY(Y: Standard_Real): void; + SetZ(Z: Standard_Real): void; + Coord(Index: Standard_Integer): Standard_Real; + X(): Standard_Real; + Y(): Standard_Real; + Z(): Standard_Real; + BaryCenter(Alpha: Standard_Real, P: gp_Pnt, Beta: Standard_Real): void; + IsEqual(Other: gp_Pnt, LinearTolerance: Standard_Real): Standard_Boolean; + Distance(Other: gp_Pnt): Standard_Real; + SquareDistance(Other: gp_Pnt): Standard_Real; + Mirror(P: gp_Pnt): void; + Rotate(A1: gp_Ax1, Ang: Standard_Real): void; + Rotated(A1: gp_Ax1, Ang: Standard_Real): gp_Pnt; + Scale(P: gp_Pnt, S: Standard_Real): void; + Scaled(P: gp_Pnt, S: Standard_Real): gp_Pnt; + Transform(T: gp_Trsf): void; + Transformed(T: gp_Trsf): gp_Pnt; + Translated(V: gp_Vec): gp_Pnt; + Translated(P1: gp_Pnt, P2: gp_Pnt): gp_Pnt; + } + class gp_XYZ { + constructor(X: Standard_Real, Y: Standard_Real, Z: Standard_Real); + SetCoord(Xp: Standard_Real, Yp: Standard_Real, Zp: Standard_Real): void; + SetX(X: Standard_Real): void; + SetY(Y: Standard_Real): void; + SetZ(Z: Standard_Real): void; + Coord(Index: Standard_Integer): Standard_Real; + X(): Standard_Real; + Y(): Standard_Real; + Z(): Standard_Real; + IsEqual(Other: gp_XYZ, Tolerance: Standard_Real): Standard_Boolean; + } + class GC_MakeArcOfCircle { + constructor(Circ: gp_Circ, Alpha1: Standard_Real, Alpha2: Standard_Real, Sense: Standard_Boolean); + constructor(P1: gp_Pnt, P2: gp_Pnt, P3: gp_Pnt); + Value(): Handle_Geom_TrimmedCurve; + } + class GC_MakeSegment { + constructor(P1: gp_Pnt, P2: gp_Pnt); + constructor(Line: gp_Lin, U1: Standard_Real, U2: Standard_Real); + Value(): Handle_Geom_TrimmedCurve; + } + class GC_MakeCircle { + constructor(Circ: gp_Circ); + constructor(A2: gp_Ax2, Radius: Standard_Real); + Value(): Handle_Geom_Circle; + } + class GC_MakeEllipse { + constructor(E: gp_Elips); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + Value(): Handle_Geom_Ellipse; + } + class GC_MakeHyperbola { + constructor(E: gp_Hypr); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + Value(): Handle_Geom_Hyperbola; + } + class GC_MakeArcOfParabola { + constructor(Parab: gp_Parab, Alpha1: Standard_Real, Alpha2: Standard_Real, Sense: Standard_Boolean); + Value(): Handle_Geom_TrimmedCurve; + } + class TopoDS_Edge { + constructor(); + constructor(T2: TopoDS_Edge); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class TopoDS_Wire { + constructor(); + constructor(T2: TopoDS_Wire); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class TopoDS_Compound extends TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_Compound); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class TopoDS_Face { + constructor(); + constructor(T2: TopoDS_Face); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class TopoDS_Vertex extends TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_Vertex); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class gp_Ax1 { + constructor(); + constructor(P: gp_Pnt, V: gp_Dir); + } + class gp_Ax2 { + constructor(); + constructor(P: gp_Pnt, V: gp_Dir); + } + class gp { + OX(): gp_Ax1; + DZ(): gp_Dir; + } + class gp_Dir { + constructor(); + constructor(V: gp_Vec); + constructor(Xv: Standard_Real, Yv: Standard_Real, Zv: Standard_Real); + SetCoord(Index: Standard_Integer, Xi: Standard_Real): void; + SetCoord(Xv: Standard_Real, Yv: Standard_Real, Zv: Standard_Real): void; + SetX(X: Standard_Real): void; + SetY(Y: Standard_Real): void; + SetZ(Z: Standard_Real): void; + Coord(Index: Standard_Integer): Standard_Real; + X(): Standard_Real; + Y(): Standard_Real; + Z(): Standard_Real; + IsEqual(Other: gp_Dir, AngularTolerance: Standard_Real): Standard_Boolean; + IsNormal(Other: gp_Dir, AngularTolerance: Standard_Real): Standard_Boolean; + IsOpposite(Other: gp_Dir, AngularTolerance: Standard_Real): Standard_Boolean; + IsParallel(Other: gp_Dir, AngularTolerance: Standard_Real): Standard_Boolean; + Angle(Other: gp_Dir): Standard_Real; + AngleWithRef(Other: gp_Dir, VRef: gp_Dir): Standard_Real; + Cross(Right: gp_Dir): void; + Crossed(Right: gp_Dir): gp_Dir; + CrossCross(V1: gp_Dir, V2: gp_Dir): void; + CrossCrossed(V1: gp_Dir, V2: gp_Dir): gp_Dir; + Dot(Other: gp_Dir): Standard_Real; + DotCross(V1: gp_Dir, V2: gp_Dir): Standard_Real; + Reversed(): gp_Dir; + Mirror(V: gp_Dir): void; + Mirrored(V: gp_Dir): gp_Dir; + Rotate(A1: gp_Ax1, Ang: Standard_Real): void; + Rotated(A1: gp_Ax1, Ang: Standard_Real): gp_Dir; + Transform(T: gp_Trsf): void; + Transformed(T: gp_Trsf): gp_Dir; + } + class gp_Trsf { + constructor(); + SetMirror(A1: gp_Ax1): void; + SetTranslation(V: gp_Vec): void; + SetTranslationPart(V: gp_Vec): void; + SetRotation(A1: gp_Ax1, Ang: Standard_Real): void; + SetScaleFactor(S: Standard_Real): void; + Multiply(T: gp_Trsf): void; + PreMultiply(T: gp_Trsf): void; + Value(Row: Standard_Integer, Col: Standard_Integer): Standard_Real; + Inverted(): gp_Trsf; + TranslationPart(): gp_XYZ; + ScaleFactor(): Standard_Real; + Multiplied(T: gp_Trsf): gp_Trsf; + } + class BRepBuilderAPI_Transform { + constructor(S: TopoDS_Shape, T: gp_Trsf, Copy?: Standard_Boolean); + } + class BRepBuilderAPI_ModifyShape { + } + class TopoDS { + Vertex(S: TopoDS_Shape): TopoDS_Vertex; + Edge(S: TopoDS_Shape): TopoDS_Edge; + Wire(S: TopoDS_Shape): TopoDS_Wire; + Face(S: TopoDS_Shape): TopoDS_Face; + Shell(S: TopoDS_Shape): TopoDS_Shell; + Solid(S: TopoDS_Shape): TopoDS_Solid; + CompSolid(S: TopoDS_Shape): TopoDS_CompSolid; + Compound(S: TopoDS_Shape): TopoDS_Compound; + } + class BRepBuilderAPI_MakeFace { + constructor(W: TopoDS_Wire); + constructor(F: TopoDS_Face, W: TopoDS_Wire); + Face(): TopoDS_Face; + Add(W: TopoDS_Wire): void; + Error(): BRepBuilderAPI_FaceError; + } + class BRepFilletAPI_MakeFillet2d { + constructor(F: TopoDS_Face); + AddFillet(V: TopoDS_Vertex, Radius: Standard_Real): void; + Status(): ChFi2d_ConstructionError; + } + class BRepFilletAPI_MakeFillet { + constructor(S: TopoDS_Shape); + Add(Radius: Standard_Real, E: TopoDS_Edge): void; + } + class BRepFilletAPI_MakeChamfer { + constructor(S: TopoDS_Shape); + Add(Dis: Standard_Real, E: TopoDS_Edge): void; + Add(Dis1: Standard_Real, Dis2: Standard_Real, E: TopoDS_Edge, F: TopoDS_Face): void; + } + class BRepFilletAPI_LocalOperation { + } + class TopExp_Explorer { + constructor(); + constructor(S: TopoDS_Shape, ToFind: TopAbs_ShapeEnum, ToAvoid?: TopAbs_ShapeEnum); + Init(S: TopoDS_Shape, ToFind: TopAbs_ShapeEnum, ToAvoid?: TopAbs_ShapeEnum): void; + More(): Standard_Boolean; + Next(): void; + Current(): TopoDS_Shape; + ReInit(): void; + Depth(): Standard_Integer; + Clear(): void; + Destroy(): void; + } + class TopLoc_Location { + constructor(); + constructor(T: gp_Trsf); + Identity(): void; + FirstPower(): Standard_Integer; + NextLocation(): TopLoc_Location; + Transformation(): gp_Trsf; + } + class Adaptor3d_Curve { + FirstParameter(): Standard_Real; + LastParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + Value(U: Standard_Real): gp_Pnt; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): void; + Resolution(R3d: Standard_Real): Standard_Real; + Line(): gp_Lin; + Circle(): gp_Circ; + Degree(): Standard_Integer; + IsRational(): Standard_Boolean; + NbPoles(): Standard_Integer; + NbKnots(): Standard_Integer; + Bezier(): Handle_Geom_BezierCurve; + BSpline(): Handle_Geom_BSplineCurve; + } + class BRepAdaptor_Curve { + constructor(); + constructor(E: TopoDS_Edge); + constructor(E: TopoDS_Edge, F: TopoDS_Face); + Reset(): void; + Initialize(E: TopoDS_Edge): void; + Initialize(E: TopoDS_Edge, F: TopoDS_Face): void; + Trsf(): gp_Trsf; + Is3DCurve(): Standard_Boolean; + IsCurveOnSurface(): Standard_Boolean; + Edge(): TopoDS_Edge; + Tolerance(): Standard_Real; + FirstParameter(): Standard_Real; + LastParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + Value(U: Standard_Real): gp_Pnt; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): void; + Resolution(R3d: Standard_Real): Standard_Real; + Line(): gp_Lin; + Circle(): gp_Circ; + Degree(): Standard_Integer; + IsRational(): Standard_Boolean; + NbPoles(): Standard_Integer; + NbKnots(): Standard_Integer; + Bezier(): Handle_Geom_BezierCurve; + BSpline(): Handle_Geom_BSplineCurve; + } + class GCPnts_TangentialDeflection { + constructor(); + constructor(C: Adaptor3d_Curve, AngularDeflection: Standard_Real, CurvatureDeflection: Standard_Real, MinimumOfPoints?: Standard_Integer, UTol?: Standard_Real, theMinLen?: Standard_Real); + constructor(C: Adaptor3d_Curve, FirstParameter: Standard_Real, LastParameter: Standard_Real, AngularDeflection: Standard_Real, CurvatureDeflection: Standard_Real, MinimumOfPoints: Standard_Integer, UTol: Standard_Real, theMinLen: Standard_Real); + Initialize(C: Adaptor3d_Curve, AngularDeflection: Standard_Real, CurvatureDeflection: Standard_Real, MinimumOfPoints?: Standard_Integer, UTol?: Standard_Real, theMinLen?: Standard_Real): void; + Initialize(C: Adaptor3d_Curve, FirstParameter: Standard_Real, LastParameter: Standard_Real, AngularDeflection: Standard_Real, CurvatureDeflection: Standard_Real, MinimumOfPoints: Standard_Integer, UTol: Standard_Real, theMinLen: Standard_Real): void; + AddPoint(thePnt: gp_Pnt, theParam: Standard_Real, theIsReplace?: Standard_Boolean): Standard_Integer; + NbPoints(): Standard_Integer; + Parameter(I: Standard_Integer): Standard_Real; + Value(I: Standard_Integer): gp_Pnt; + ArcAngularStep(theRadius: Standard_Real, theLinearDeflection: Standard_Real, theAngularDeflection: Standard_Real, theMinLength: Standard_Real): Standard_Real; + } + class Geom_Curve { + Reverse(): void; + ReversedParameter(U: Standard_Real): Standard_Real; + TransformedParameter(U: Standard_Real, T: gp_Trsf): Standard_Real; + ParametricTransformation(T: gp_Trsf): Standard_Real; + Reversed(): Handle_Geom_Curve; + FirstParameter(): Standard_Real; + LastParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + IsCN(N: Standard_Integer): Standard_Boolean; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): void; + Value(U: Standard_Real): gp_Pnt; + } + class BRep_Tool { + IsClosed(S: TopoDS_Shape): Standard_Boolean; + Surface(F: TopoDS_Face): Handle_Geom_Surface; + Triangulation(F: TopoDS_Face, L: TopLoc_Location): Handle_Poly_Triangulation; + Tolerance(F: TopoDS_Face): Standard_Real; + NaturalRestriction(F: TopoDS_Face): Standard_Boolean; + IsGeometric(E: TopoDS_Edge): Standard_Boolean; + Curve(E: TopoDS_Edge, L: TopLoc_Location, First: Standard_Real, Last: Standard_Real): Handle_Geom_Curve; + Polygon3D(E: TopoDS_Edge, L: TopLoc_Location): Handle_Poly_Polygon3D; + PolygonOnTriangulation(E: TopoDS_Edge, T: Handle_Poly_Triangulation, L: TopLoc_Location): Handle_Poly_PolygonOnTriangulation; + IsClosed(E: TopoDS_Edge, F: TopoDS_Face): Standard_Boolean; + IsClosed(E: TopoDS_Edge, T: Handle_Poly_Triangulation, L: TopLoc_Location): Standard_Boolean; + SameParameter(E: TopoDS_Edge): Standard_Boolean; + SameRange(E: TopoDS_Edge): Standard_Boolean; + Degenerated(E: TopoDS_Edge): Standard_Boolean; + Range(E: TopoDS_Edge, First: Standard_Real, Last: Standard_Real): void; + Range(E: TopoDS_Edge, F: TopoDS_Face, First: Standard_Real, Last: Standard_Real): void; + HasContinuity(E: TopoDS_Edge, F1: TopoDS_Face, F2: TopoDS_Face): Standard_Boolean; + HasContinuity(E: TopoDS_Edge): Standard_Boolean; + Parameter(V: TopoDS_Vertex, E: TopoDS_Edge): Standard_Real; + Parameter(V: TopoDS_Vertex, E: TopoDS_Edge, F: TopoDS_Face): Standard_Real; + Pnt(V: TopoDS_Vertex): gp_Pnt; + Parameters(V: TopoDS_Vertex, F: TopoDS_Face): gp_Pnt2d; + MaxTolerance(theShape: TopoDS_Shape, theSubShape: TopAbs_ShapeEnum): Standard_Real; + } + class Poly_Polygon3D { + constructor(Nodes: TColgp_Array1OfPnt); + constructor(Nodes: TColgp_Array1OfPnt, Parameters: TColStd_Array1OfReal); + Copy(): Handle_Poly_Polygon3D; + Deflection(): Standard_Real; + NbNodes(): Standard_Integer; + Nodes(): TColgp_Array1OfPnt; + HasParameters(): Standard_Boolean; + Parameters(): TColStd_Array1OfReal; + ChangeParameters(): TColStd_Array1OfReal; + } + class GCE2d_MakeSegment { + constructor(P1: gp_Pnt2d, P2: gp_Pnt2d); + Value(): Handle_Geom2d_TrimmedCurve; + } + class Geom_BoundedCurve extends Geom_Curve { + } + class Geom2d_Ellipse extends Geom2d_Conic { + constructor(MajorAxis: gp_Ax2d, MajorRadius: Standard_Real, MinorRadius: Standard_Real, Sense?: Standard_Boolean); + } + class Geom2d_TrimmedCurve extends Geom2d_BoundedCurve { + constructor(C: Handle_Geom2d_Curve, U1: Standard_Real, U2: Standard_Real, Sense?: Standard_Boolean, theAdjustPeriodic?: Standard_Boolean); + } + class Geom_TrimmedCurve extends Geom_BoundedCurve { + constructor(C: Handle_Geom_Curve, U1: Standard_Real, U2: Standard_Real, Sense?: Standard_Boolean, theAdjustPeriodic?: Standard_Boolean); + Reverse(): void; + ReversedParameter(U: Standard_Real): Standard_Real; + SetTrim(U1: Standard_Real, U2: Standard_Real, Sense?: Standard_Boolean, theAdjust?: Standard_Boolean): void; + BasisCurve(): Handle_Geom_Curve; + IsCN(N: Standard_Integer): Standard_Boolean; + FirstParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + LastParameter(): Standard_Real; + StartPoint(): gp_Pnt; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): void; + Transform(T: gp_Trsf): void; + TransformedParameter(U: Standard_Real, T: gp_Trsf): Standard_Real; + ParametricTransformation(T: gp_Trsf): Standard_Real; + } + class Geom_BezierCurve extends Geom_Curve { + constructor(CurvePoles: TColgp_Array1OfPnt); + constructor(CurvePoles: TColgp_Array1OfPnt, PoleWeights: TColStd_Array1OfReal); + Reverse(): void; + ReversedParameter(U: Standard_Real): Standard_Real; + IsCN(N: Standard_Integer): Standard_Boolean; + FirstParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + LastParameter(): Standard_Real; + StartPoint(): gp_Pnt; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): gp_Vec; + Transform(T: gp_Trsf): void; + } + class Geom_BSplineCurve extends Geom_Curve { + constructor(Poles: TColgp_Array1OfPnt, Weights: TColStd_Array1OfReal, Knots: TColStd_Array1OfReal, Multiplicities: TColStd_Array1OfInteger, Degree: Standard_Integer, Periodic?: Standard_Boolean, CheckRational?: Standard_Boolean); + Reverse(): void; + ReversedParameter(U: Standard_Real): Standard_Real; + IsCN(N: Standard_Integer): Standard_Boolean; + FirstParameter(): Standard_Real; + IsClosed(): Standard_Boolean; + IsPeriodic(): Standard_Boolean; + Period(): Standard_Real; + LastParameter(): Standard_Real; + StartPoint(): gp_Pnt; + D0(U: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, P: gp_Pnt, V1: gp_Vec): void; + D2(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec): void; + D3(U: Standard_Real, P: gp_Pnt, V1: gp_Vec, V2: gp_Vec, V3: gp_Vec): void; + DN(U: Standard_Real, N: Standard_Integer): gp_Vec; + Transform(T: gp_Trsf): void; + } + class Standard_Transient { + get_type_name(): string; + DynamicType(): Handle_Standard_Type; + } + class Standard_Type extends Standard_Transient { + Name(): string; + } + class Geom_Geometry extends Standard_Transient { + } + class Geom_Surface extends Geom_Geometry { + } + class Geom_ElementarySurface extends Geom_Surface { + Location(): gp_Pnt; + } + class Geom_Plane extends Geom_ElementarySurface { + } + class gp_Ax3 { + constructor(); + } + class gp_Pnt2d { + constructor(); + constructor(Xp: Standard_Real, Yp: Standard_Real); + X(): Standard_Real; + Y(): Standard_Real; + } + class gp_Dir2d { + constructor(); + constructor(Xv: Standard_Real, Yv: Standard_Real); + } + class gp_Ax2d { + constructor(); + constructor(P: gp_Pnt2d, V: gp_Dir2d); + } + class Geom_CylindricalSurface { + constructor(A3: gp_Ax3, Radius: Standard_Real); + } + class Geom2d_Curve { + Period(): Standard_Real; + Value(U: Standard_Real): gp_Pnt2d; + } + class Geom2d_BoundedCurve extends Geom2d_Curve { + } + class Geom2d_Conic extends Geom2d_Curve { + } + class Handle_Geom2d_TrimmedCurve { + constructor(); + constructor(thePtr: Geom2d_TrimmedCurve); + IsNull(): boolean; + Nullify(): void; + get(): Geom2d_TrimmedCurve; + } + class Handle_Geom2d_Curve { + constructor(); + constructor(thePtr: Geom2d_Curve); + IsNull(): boolean; + Nullify(): void; + get(): Geom2d_Curve; + } + class Handle_Standard_Type { + constructor(); + constructor(thePtr: Standard_Type); + IsNull(): boolean; + Nullify(): void; + get(): Standard_Type; + } + class Handle_Geom_Plane { + constructor(); + constructor(thePtr: Geom_Plane); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Plane; + } + class Handle_Geom_Surface { + constructor(); + constructor(thePtr: Geom_Surface); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Surface; + } + class Handle_Geom_Curve { + constructor(); + constructor(thePtr: Geom_Curve); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Curve; + } + class Handle_Geom_TrimmedCurve { + constructor(); + constructor(thePtr: Geom_TrimmedCurve); + IsNull(): boolean; + Nullify(): void; + get(): Geom_TrimmedCurve; + } + class Handle_Geom_Circle { + constructor(); + constructor(thePtr: Geom_Circle); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Circle; + } + class Handle_Geom_Ellipse { + constructor(); + constructor(thePtr: Geom_Ellipse); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Ellipse; + } + class Handle_Geom_Hyperbola { + constructor(); + constructor(thePtr: Geom_Hyperbola); + IsNull(): boolean; + Nullify(): void; + get(): Geom_Hyperbola; + } + class Handle_Geom_BezierCurve { + constructor(); + constructor(thePtr: Geom_BezierCurve); + IsNull(): boolean; + Nullify(): void; + get(): Geom_BezierCurve; + } + class Handle_Geom_BSplineCurve { + constructor(); + constructor(thePtr: Geom_BSplineCurve); + IsNull(): boolean; + Nullify(): void; + get(): Geom_BSplineCurve; + } + class Handle_Poly_Polygon3D { + constructor(); + constructor(thePtr: Poly_Polygon3D); + IsNull(): boolean; + Nullify(): void; + get(): Poly_Polygon3D; + } + class Handle_ShapeFix_Shell { + IsNull(): boolean; + get(): ShapeFix_Shell; + } + class Handle_Poly_Triangulation { + constructor(); + constructor(thePtr: Poly_Triangulation); + IsNull(): boolean; + Nullify(): void; + get(): Poly_Triangulation; + } + class Handle_Poly_PolygonOnTriangulation { + constructor(); + constructor(thePtr: Poly_PolygonOnTriangulation); + IsNull(): boolean; + Nullify(): void; + get(): Poly_PolygonOnTriangulation; + } + class Handle_XSControl_WorkSession { + constructor(); + constructor(thePtr: XSControl_WorkSession); + IsNull(): boolean; + Nullify(): void; + get(): XSControl_WorkSession; + } + class Handle_Transfer_TransientProcess { + constructor(); + constructor(thePtr: Transfer_TransientProcess); + IsNull(): boolean; + Nullify(): void; + get(): Transfer_TransientProcess; + } + class Handle_Message_ProgressIndicator { + constructor(); + constructor(thePtr: Message_ProgressIndicator); + IsNull(): boolean; + Nullify(): void; + get(): Message_ProgressIndicator; + } + class TColgp_Array1OfPnt { + constructor(); + constructor(theLower: Standard_Integer, theUpper: Standard_Integer); + Length(): Standard_Integer; + Lower(): Standard_Integer; + Upper(): Standard_Integer; + Value(theIndex: Standard_Integer): gp_Pnt; + SetValue(Index: Standard_Integer, Value: gp_Pnt): void; + } + class TColgp_Array1OfDir { + constructor(); + constructor(theLower: Standard_Integer, theUpper: Standard_Integer); + Length(): Standard_Integer; + Lower(): Standard_Integer; + Upper(): Standard_Integer; + Value(theIndex: Standard_Integer): gp_Dir; + } + class Poly_Array1OfTriangle { + constructor(); + constructor(theLower: Standard_Integer, theUpper: Standard_Integer); + Length(): Standard_Integer; + Lower(): Standard_Integer; + Upper(): Standard_Integer; + Value(theIndex: Standard_Integer): Poly_Triangle; + SetValue(Index: Standard_Integer, Value: Poly_Triangle): void; + } + class TColStd_Array1OfReal { + constructor(); + constructor(theLower: Standard_Integer, theUpper: Standard_Integer); + Length(): Standard_Integer; + Lower(): Standard_Integer; + Upper(): Standard_Integer; + Value(theIndex: Standard_Integer): Standard_Real; + SetValue(Index: Standard_Integer, Value: Standard_Real): void; + } + class TColStd_Array1OfInteger { + constructor(); + constructor(theLower: Standard_Integer, theUpper: Standard_Integer); + Length(): Standard_Integer; + Lower(): Standard_Integer; + Upper(): Standard_Integer; + Value(theIndex: Standard_Integer): Standard_Integer; + SetValue(Index: Standard_Integer, Value: Standard_Integer): void; + } + class XSControl_WorkSession { + constructor(); + ClearData(theMode: Standard_Integer): void; + SelectNorm(theNormName: Standard_CString): Standard_Boolean; + ClearContext(): void; + InitTransferReader(theMode: Standard_Integer): void; + MapReader(): Handle_Transfer_TransientProcess; + SetMapReader(theTP: Handle_Transfer_TransientProcess): Standard_Boolean; + TransferReadRoots(): Standard_Integer; + TransferWriteShape(theShape: TopoDS_Shape, theCompGraph?: Standard_Boolean): IFSelect_ReturnStatus; + } + class Transfer_ProcessForTransient { + constructor(); + GetProgress(): Handle_Message_ProgressIndicator; + SetProgress(theProgess: Handle_Message_ProgressIndicator): void; + } + class Transfer_TransientProcess extends Transfer_ProcessForTransient { + constructor(nb?: Standard_Integer); + HasGraph(): Standard_Boolean; + } + class Message_ProgressIndicator { + GetPosition(): Standard_Real; + GetValue(): Standard_Real; + NewScope(name: Standard_CString): Standard_Boolean; + NewScope(span: Standard_Real, name: Standard_CString): Standard_Boolean; + EndScope(): Standard_Boolean; + Reset(): void; + } + class Poly_Triangulation { + constructor(nbNodes: Standard_Integer, nbTriangles: Standard_Integer, UVNodes: Standard_Boolean); + Copy(): Handle_Poly_Triangulation; + constructor(theTriangulation: Handle_Poly_Triangulation); + Deflection(theDeflection: Standard_Real): void; + RemoveUVNodes(): void; + NbNodes(): Standard_Integer; + NbTriangles(): Standard_Integer; + HasUVNodes(): Standard_Boolean; + Nodes(): TColgp_Array1OfPnt; + ChangeNodes(): TColgp_Array1OfPnt; + Triangles(): Poly_Array1OfTriangle; + ChangeTriangles(): Poly_Array1OfTriangle; + HasNormals(): Standard_Boolean; + Normal(theIndex: Standard_Integer): gp_Dir; + SetNormal(theIndex: Standard_Integer, theNormal: gp_Dir): void; + } + class Poly_Triangle { + constructor(); + constructor(N1: Standard_Integer, N2: Standard_Integer, N3: Standard_Integer); + Set(N1: Standard_Integer, N2: Standard_Integer, N3: Standard_Integer): void; + Set(Index: Standard_Integer, Node: Standard_Integer): void; + Value(Index: Standard_Integer): Standard_Integer; + ChangeValue(Index: Standard_Integer): Standard_Integer; + } + class Poly_Connect { + constructor(); + constructor(theTriangulation: Handle_Poly_Triangulation); + Load(theTriangulation: Handle_Poly_Triangulation): void; + Triangulation(): Handle_Poly_Triangulation; + Triangle(N: Standard_Integer): Standard_Integer; + Triangles(T: Standard_Integer, t1: Standard_Integer, t2: Standard_Integer, t3: Standard_Integer): void; + Nodes(T: Standard_Integer, t1: Standard_Integer, t2: Standard_Integer, t3: Standard_Integer): void; + Initialize(N: Standard_Integer): void; + More(): Standard_Boolean; + Next(): void; + Value(): Standard_Integer; + } + class StdPrs_ToolTriangulatedShape { + constructor(); + IsTriangulated(theShape: TopoDS_Shape): Standard_Boolean; + IsClosed(theShape: TopoDS_Shape): Standard_Boolean; + ComputeNormals(theFace: TopoDS_Face, theTris: Handle_Poly_Triangulation): void; + ComputeNormals(theFace: TopoDS_Face, theTris: Handle_Poly_Triangulation, thePolyConnect: Poly_Connect): void; + Normal(theFace: TopoDS_Face, thePolyConnect: Poly_Connect, theNormals: TColgp_Array1OfDir): void; + } + class BRepBuilderAPI_Sewing { + constructor(tolerance?: Standard_Real, option1?: Standard_Boolean, option2?: Standard_Boolean, option3?: Standard_Boolean, option4?: Standard_Boolean); + Init(tolerance?: Standard_Real, option1?: Standard_Boolean, option2?: Standard_Boolean, option3?: Standard_Boolean, option4?: Standard_Boolean): void; + Load(shape: TopoDS_Shape): void; + Add(shape: TopoDS_Shape): void; + Perform(thePI?: Handle_Message_ProgressIndicator): void; + SewedShape(): TopoDS_Shape; + NbFreeEdges(): Standard_Integer; + FreeEdge(index: Standard_Integer): TopoDS_Edge; + NbMultipleEdges(): Standard_Integer; + MultipleEdge(index: Standard_Integer): TopoDS_Edge; + NbContigousEdges(): Standard_Integer; + ContigousEdge(index: Standard_Integer): TopoDS_Edge; + IsSectionBound(section: TopoDS_Edge): Standard_Boolean; + SectionToBoundary(section: TopoDS_Edge): TopoDS_Edge; + NbDegeneratedShapes(): Standard_Integer; + DegeneratedShape(index: Standard_Integer): TopoDS_Shape; + IsDegenerated(shape: TopoDS_Shape): Standard_Boolean; + IsModified(shape: TopoDS_Shape): Standard_Boolean; + Modified(shape: TopoDS_Shape): TopoDS_Shape; + IsModifiedSubShape(shape: TopoDS_Shape): Standard_Boolean; + ModifiedSubShape(shape: TopoDS_Shape): TopoDS_Shape; + Dump(): void; + NbDeletedFaces(): Standard_Integer; + DeletedFace(index: Standard_Integer): TopoDS_Face; + WhichFace(theEdg: TopoDS_Edge, index?: Standard_Integer): TopoDS_Face; + SameParameterMode(): Standard_Boolean; + SetSameParameterMode(SameParameterMode: Standard_Boolean): void; + Tolerance(): Standard_Real; + SetTolerance(theToler: Standard_Real): void; + MinTolerance(): Standard_Real; + SetMinTolerance(theMinToler: Standard_Real): void; + MaxTolerance(): Standard_Real; + SetMaxTolerance(theMaxToler: Standard_Real): void; + FaceMode(): Standard_Boolean; + SetFaceMode(theFaceMode: Standard_Boolean): void; + FloatingEdgesMode(): Standard_Boolean; + SetFloatingEdgesMode(theFloatingEdgesMode: Standard_Boolean): void; + LocalTolerancesMode(): Standard_Boolean; + SetLocalTolerancesMode(theLocalTolerancesMode: Standard_Boolean): void; + SetNonManifoldMode(theNonManifoldMode: Standard_Boolean): void; + NonManifoldMode(): Standard_Boolean; + } + class TopoDS_Builder { + MakeWire(W: TopoDS_Wire): void; + MakeCompound(C: TopoDS_Compound): void; + Add(S: TopoDS_Shape, C: TopoDS_Shape): void; + Remove(S: TopoDS_Shape, C: TopoDS_Shape): void; + } + class BRep_Builder extends TopoDS_Builder { + constructor(); + MakeFace(F: TopoDS_Face): void; + MakeFace(F: TopoDS_Face, T: Handle_Poly_Triangulation): void; + UpdateFace(F: TopoDS_Face, T: Handle_Poly_Triangulation): void; + NaturalRestriction(F: TopoDS_Face, N: Standard_Boolean): void; + MakeEdge(E: TopoDS_Edge): void; + SameParameter(E: TopoDS_Edge, S: Standard_Boolean): void; + SameRange(E: TopoDS_Edge, S: Standard_Boolean): void; + Degenerated(E: TopoDS_Edge, D: Standard_Boolean): void; + Range(E: TopoDS_Edge, First: Standard_Real, Last: Standard_Real, Only3d?: Standard_Boolean): void; + Transfert(Ein: TopoDS_Edge, Eout: TopoDS_Edge): void; + MakeVertex(V: TopoDS_Vertex): void; + MakeVertex(V: TopoDS_Vertex, P: gp_Pnt, Tol: Standard_Real): void; + UpdateVertex(V: TopoDS_Vertex, P: gp_Pnt, Tol: Standard_Real): void; + UpdateVertex(Ve: TopoDS_Vertex, U: Standard_Real, V: Standard_Real, F: TopoDS_Face, Tol: Standard_Real): void; + UpdateVertex(V: TopoDS_Vertex, Tol: Standard_Real): void; + Transfert(Ein: TopoDS_Edge, Eout: TopoDS_Edge, Vin: TopoDS_Vertex, Vout: TopoDS_Vertex): void; + } + class BRepAdaptor_Surface { + constructor(); + constructor(F: TopoDS_Face, R?: Standard_Boolean); + Initialize(F: TopoDS_Face, R?: Standard_Boolean): void; + Trsf(): gp_Trsf; + Face(): TopoDS_Face; + Tolerance(): Standard_Real; + FirstUParameter(): Standard_Real; + LastUParameter(): Standard_Real; + FirstVParameter(): Standard_Real; + LastVParameter(): Standard_Real; + IsUClosed(): Standard_Boolean; + IsVClosed(): Standard_Boolean; + IsUPeriodic(): Standard_Boolean; + UPeriod(): Standard_Real; + IsVPeriodic(): Standard_Boolean; + VPeriod(): Standard_Real; + Value(U: Standard_Real, V: Standard_Real): gp_Pnt; + D0(U: Standard_Real, V: Standard_Real, P: gp_Pnt): void; + D1(U: Standard_Real, V: Standard_Real, P: gp_Pnt, D1U: gp_Vec, D1V: gp_Vec): void; + D2(U: Standard_Real, V: Standard_Real, P: gp_Pnt, D1U: gp_Vec, D1V: gp_Vec, D2U: gp_Vec, D2V: gp_Vec, D2UV: gp_Vec): void; + D3(U: Standard_Real, V: Standard_Real, P: gp_Pnt, D1U: gp_Vec, D1V: gp_Vec, D2U: gp_Vec, D2V: gp_Vec, D2UV: gp_Vec, D3U: gp_Vec, D3V: gp_Vec, D3UUV: gp_Vec, D3UVV: gp_Vec): void; + DN(U: Standard_Real, V: Standard_Real, Nu: Standard_Integer, Nv: Standard_Integer): gp_Vec; + UResolution(R3d: Standard_Real): Standard_Real; + VResolution(R3d: Standard_Real): Standard_Real; + GetType(): GeomAbs_SurfaceType; + Plane(): gp_Pln; + UDegree(): Standard_Integer; + NbUPoles(): Standard_Integer; + VDegree(): Standard_Integer; + NbVPoles(): Standard_Integer; + NbUKnots(): Standard_Integer; + NbVKnots(): Standard_Integer; + IsURational(): Standard_Boolean; + IsVRational(): Standard_Boolean; + AxeOfRevolution(): gp_Ax1; + Direction(): gp_Dir; + OffsetValue(): Standard_Real; + } + class StlAPI_Reader { + constructor(); + Read(theShape: TopoDS_Shape, theFileName: Standard_CString): Standard_Boolean; + } + type TopAbs_Orientation = "TopAbs_FORWARD" | "TopAbs_REVERSED" | "TopAbs_INTERNAL" | "TopAbs_EXTERNAL"; + type TopAbs_ShapeEnum = "TopAbs_COMPOUND" | "TopAbs_COMPSOLID" | "TopAbs_SOLID" | "TopAbs_SHELL" | "TopAbs_FACE" | "TopAbs_WIRE" | "TopAbs_EDGE" | "TopAbs_VERTEX" | "TopAbs_SHAPE"; + type GeomAbs_SurfaceType = "GeomAbs_Plane" | "GeomAbs_Cylinder" | "GeomAbs_Cone" | "GeomAbs_Sphere" | "GeomAbs_Torus" | "GeomAbs_BezierSurface" | "GeomAbs_BSplineSurface" | "GeomAbs_SurfaceOfRevolution" | "GeomAbs_SurfaceOfExtrusion" | "GeomAbs_OffsetSurface" | "GeomAbs_OtherSurface"; + class BRepAlgoAPI_Fuse extends BRepAlgoAPI_BooleanOperation { + constructor(S1: TopoDS_Shape, S2: TopoDS_Shape); + } + class BRepAlgoAPI_Cut { + constructor(S1: TopoDS_Shape, S2: TopoDS_Shape); + } + class BRepAlgoAPI_Common extends BRepAlgoAPI_BooleanOperation { + constructor(S1: TopoDS_Shape, S2: TopoDS_Shape); + } + class BRepAlgoAPI_BooleanOperation { + } + class gp_Lin { + constructor(); + constructor(A1: gp_Ax1); + } + class gp_Circ { + constructor(); + constructor(A2: gp_Ax2, Radius: Standard_Real); + Radius(): Standard_Real; + Length(): Standard_Real; + Area(): Standard_Real; + } + class gp_Elips { + constructor(); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + Eccentricity(): Standard_Real; + Focal(): Standard_Real; + Area(): Standard_Real; + MajorRadius(): Standard_Real; + MinorRadius(): Standard_Real; + } + class gp_Hypr { + constructor(); + constructor(A2: gp_Ax2, MajorRadius: Standard_Real, MinorRadius: Standard_Real); + Eccentricity(): Standard_Real; + Focal(): Standard_Real; + MajorRadius(): Standard_Real; + MinorRadius(): Standard_Real; + } + class gp_Parab { + constructor(); + constructor(A2: gp_Ax2, Focal: Standard_Real); + Focal(): Standard_Real; + } + class BRepBuilderAPI_MakeEdge { + constructor(C: Handle_Geom_Curve); + constructor(L: Handle_Geom2d_Curve, S: Handle_Geom_Surface); + Edge(): TopoDS_Edge; + } + class BRepBuilderAPI_MakeWire { + constructor(); + constructor(E: TopoDS_Edge); + constructor(E1: TopoDS_Edge, E2: TopoDS_Edge); + constructor(E1: TopoDS_Edge, E2: TopoDS_Edge, E3: TopoDS_Edge); + Add(W: TopoDS_Wire): void; + Wire(): TopoDS_Wire; + } + class BRepLib { + BuildCurve3d(E: TopoDS_Edge, Tolerance?: Standard_Real, Continuity?: GeomAbs_Shape, MaxDegree?: Standard_Integer, MaxSegment?: Standard_Integer): Standard_Boolean; + BuildCurves3d(S: TopoDS_Shape): Standard_Boolean; + } + class BRepOffsetAPI_ThruSections extends BRepBuilderAPI_MakeShape { + constructor(isSolid?: Standard_Boolean, ruled?: Standard_Boolean, pres3d?: Standard_Real); + AddWire(wire: TopoDS_Wire): void; + CheckCompatibility(check?: Standard_Boolean): void; + } + class BRepOffsetAPI_MakePipe extends BRepBuilderAPI_MakeShape { + constructor(Spine: TopoDS_Wire, Profile: TopoDS_Shape); + Build(): void; + Generated(SSpine: TopoDS_Shape, SProfile: TopoDS_Shape): TopoDS_Shape; + FirstShape(): TopoDS_Shape; + LastShape(): TopoDS_Shape; + ErrorOnSurface(): Standard_Real; + } + class BRepOffsetAPI_MakePipeShell { + constructor(Spine: TopoDS_Wire); + SetMode(AuxiliarySpine: TopoDS_Wire, CurvilinearEquivalence: Standard_Boolean, KeepContact?: BRepFill_TypeOfContact): void; + Add(Profile: TopoDS_Shape, WithContact?: Standard_Boolean, WithCorrection?: Standard_Boolean): void; + Build(): void; + MakeSolid(): Standard_Boolean; + Generated(S: TopoDS_Shape): TopTools_ListOfShape; + FirstShape(): TopoDS_Shape; + LastShape(): TopoDS_Shape; + Shape(): TopoDS_Shape; + ErrorOnSurface(): Standard_Real; + GetStatus(): BRepBuilderAPI_PipeError; + IsReady(): Standard_Boolean; + } + class BRepBuilderAPI_MakeVertex extends BRepBuilderAPI_MakeShape { + constructor(P: gp_Pnt); + Vertex(): TopoDS_Vertex; + } + class BRepBuilderAPI_MakePolygon extends BRepBuilderAPI_MakeShape { + constructor(); + constructor(V1: TopoDS_Vertex, V2: TopoDS_Vertex); + constructor(V1: TopoDS_Vertex, V2: TopoDS_Vertex, V3: TopoDS_Vertex, Close: Standard_Boolean); + constructor(V1: TopoDS_Vertex, V2: TopoDS_Vertex, V3: TopoDS_Vertex, V4: TopoDS_Vertex, Close: Standard_Boolean); + Add(V: TopoDS_Vertex): void; + Added(): Standard_Boolean; + Close(): void; + FirstVertex(): TopoDS_Vertex; + LastVertex(): TopoDS_Vertex; + IsDone(): Standard_Boolean; + Edge(): TopoDS_Edge; + Wire(): TopoDS_Wire; + } + class XSControl_Reader { + constructor(); + constructor(norm: Standard_CString); + constructor(WS: Handle_XSControl_WorkSession, scratch: Standard_Boolean); + SetNorm(norm: Standard_CString): Standard_Boolean; + SetWS(WS: Handle_XSControl_WorkSession, scratch?: Standard_Boolean): void; + WS(): Handle_XSControl_WorkSession; + ReadFile(filename: string): IFSelect_ReturnStatus; + NbRootsForTransfer(): Standard_Integer; + TransferOneRoot(num?: Standard_Integer): Standard_Boolean; + TransferOne(num: Standard_Integer): Standard_Boolean; + TransferRoots(): Standard_Integer; + ClearShapes(): void; + NbShapes(): Standard_Integer; + Shape(num?: Standard_Integer): TopoDS_Shape; + OneShape(): TopoDS_Shape; + PrintStatsTransfer(what: Standard_Integer, mode?: Standard_Integer): void; + } + class STEPControl_Reader extends XSControl_Reader { + constructor(); + } + class IGESControl_Reader extends XSControl_Reader { + constructor(); + } + class TopTools_ListOfShape { + constructor(); + Append(theItem: TopoDS_Shape): TopoDS_Shape; + First(): TopoDS_Shape; + Last(): TopoDS_Shape; + } + class BRepOffsetAPI_MakeOffset extends BRepBuilderAPI_MakeShape { + constructor(); + constructor(Spine: TopoDS_Wire, Join?: GeomAbs_JoinType, IsOpenResult?: Standard_Boolean); + AddWire(Spine: TopoDS_Wire): void; + Perform(Offset: Standard_Real, Alt?: Standard_Real): void; + Shape(): TopoDS_Shape; + } + class BRepOffsetAPI_MakeOffsetShape extends BRepBuilderAPI_MakeShape { + constructor(); + PerformBySimple(theS: TopoDS_Shape, theOffsetValue: Standard_Real): void; + PerformByJoin(S: TopoDS_Shape, Offset: Standard_Real, Tol: Standard_Real, Mode?: BRepOffset_Mode, Intersection?: Standard_Boolean, SelfInter?: Standard_Boolean, Join?: GeomAbs_JoinType, RemoveIntEdges?: Standard_Boolean): void; + Shape(): TopoDS_Shape; + } + class BRepOffsetAPI_MakeThickSolid extends BRepOffsetAPI_MakeOffsetShape { + constructor(); + MakeThickSolidByJoin(S: TopoDS_Shape, ClosingFaces: TopTools_ListOfShape, Offset: Standard_Real, Tol: Standard_Real): void; + } + class ShapeFix_Face { + constructor(); + constructor(face: TopoDS_Face); + ClearModes(): void; + Init(face: TopoDS_Face): void; + SetPrecision(preci: Standard_Real): void; + SetMinTolerance(mintol: Standard_Real): void; + SetMaxTolerance(maxtol: Standard_Real): void; + FixWireMode(): Standard_Integer; + FixOrientationMode(): Standard_Integer; + FixAddNaturalBoundMode(): Standard_Integer; + FixMissingSeamMode(): Standard_Integer; + FixSmallAreaWireMode(): Standard_Integer; + RemoveSmallAreaFaceMode(): Standard_Integer; + FixIntersectingWiresMode(): Standard_Integer; + FixLoopWiresMode(): Standard_Integer; + FixSplitFaceMode(): Standard_Integer; + AutoCorrectPrecisionMode(): Standard_Integer; + FixPeriodicDegeneratedMode(): Standard_Integer; + Face(): TopoDS_Face; + Result(): TopoDS_Shape; + Add(wire: TopoDS_Wire): void; + Perform(): Standard_Boolean; + FixOrientation(): Standard_Boolean; + FixAddNaturalBound(): Standard_Boolean; + FixMissingSeam(): Standard_Boolean; + FixSmallAreaWire(theIsRemoveSmallFace: Standard_Boolean): Standard_Boolean; + FixIntersectingWires(): Standard_Boolean; + FixWiresTwoCoincEdges(): Standard_Boolean; + FixPeriodicDegenerated(): Standard_Boolean; + } + class ShapeFix_Shape { + constructor(); + constructor(shape: TopoDS_Shape); + Init(shape: TopoDS_Shape): void; + Perform(theProgress?: Handle_Message_ProgressIndicator): Standard_Boolean; + Shape(): TopoDS_Shape; + FixShellTool(): Handle_ShapeFix_Shell; + Status(status: ShapeExtend_Status): Standard_Boolean; + SetPrecision(preci: Standard_Real): void; + SetMinTolerance(mintol: Standard_Real): void; + SetMaxTolerance(maxtol: Standard_Real): void; + FixSolidMode(): Standard_Integer; + FixFreeShellMode(): Standard_Integer; + FixFreeFaceMode(): Standard_Integer; + FixFreeWireMode(): Standard_Integer; + FixSameParameterMode(): Standard_Integer; + FixVertexPositionMode(): Standard_Integer; + FixVertexTolMode(): Standard_Integer; + } + class TopoDS_Shell extends TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_Shell); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class ShapeFix_Shell { + constructor(); + constructor(shape: TopoDS_Shell); + Init(shell: TopoDS_Shell): void; + Perform(theProgress?: Handle_Message_ProgressIndicator): Standard_Boolean; + FixFaceOrientation(shell: TopoDS_Shell, isAccountMultiConex?: Standard_Boolean, NonManifold?: Standard_Boolean): Standard_Boolean; + Shell(): TopoDS_Shell; + Shape(): TopoDS_Shape; + NbShells(): Standard_Integer; + ErrorFaces(): TopoDS_Compound; + Status(status: ShapeExtend_Status): Standard_Boolean; + SetPrecision(preci: Standard_Real): void; + SetMinTolerance(mintol: Standard_Real): void; + SetMaxTolerance(maxtol: Standard_Real): void; + FixFaceMode(): Standard_Integer; + FixOrientationMode(): Standard_Integer; + SetNonManifoldFlag(isNonManifold: Standard_Boolean): void; + } + class TopoDS_CompSolid extends TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_CompSolid); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class TopoDS_Solid extends TopoDS_Shape { + constructor(); + constructor(T2: TopoDS_Solid); + IsNull(): Standard_Boolean; + Nullify(): void; + Location(): TopLoc_Location; + Located(theLoc: TopLoc_Location): TopoDS_Shape; + Orientation(): TopAbs_Orientation; + Oriented(theOrient: TopAbs_Orientation): TopoDS_Shape; + ShapeType(): TopAbs_ShapeEnum; + Free(): Standard_Boolean; + Locked(): Standard_Boolean; + Modified(): Standard_Boolean; + Checked(): Standard_Boolean; + Orientable(): Standard_Boolean; + Closed(): Standard_Boolean; + Infinite(): Standard_Boolean; + Convex(): Standard_Boolean; + Move(thePosition: TopLoc_Location): void; + Moved(thePosition: TopLoc_Location): TopoDS_Shape; + Reverse(): void; + Reversed(): TopoDS_Shape; + Complement(): void; + Complemented(): TopoDS_Shape; + Compose(theOrient: TopAbs_Orientation): void; + Composed(theOrient: TopAbs_Orientation): TopoDS_Shape; + NbChildren(): Standard_Integer; + IsPartner(theOther: TopoDS_Shape): Standard_Boolean; + IsSame(theOther: TopoDS_Shape): Standard_Boolean; + IsEqual(theOther: TopoDS_Shape): Standard_Boolean; + IsNotEqual(theOther: TopoDS_Shape): Standard_Boolean; + HashCode(theUpperBound: Standard_Integer): Standard_Integer; + EmptyCopy(): void; + EmptyCopied(): TopoDS_Shape; + } + class BRepBuilderAPI_MakeSolid { + constructor(); + constructor(S: TopoDS_CompSolid); + constructor(S1: TopoDS_Shell, S2: TopoDS_Shell); + constructor(S1: TopoDS_Shell, S2: TopoDS_Shell, S3: TopoDS_Shell); + Add(S: TopoDS_Shell): void; + IsDone(): Standard_Boolean; + Solid(): TopoDS_Solid; + IsDeleted(S: TopoDS_Shape): Standard_Boolean; + } + class STEPControl_Writer { + constructor(); + SetTolerance(Tol: Standard_Real): void; + UnsetTolerance(): void; + Transfer(sh: TopoDS_Shape, mode: STEPControl_StepModelType, compgraph?: Standard_Boolean): IFSelect_ReturnStatus; + Write(filename: string): IFSelect_ReturnStatus; + PrintStatsTransfer(what: Standard_Integer, mode?: Standard_Integer): void; + } + class Poly_PolygonOnTriangulation { + constructor(Nodes: TColStd_Array1OfInteger); + constructor(Nodes: TColStd_Array1OfInteger, Parameters: TColStd_Array1OfReal); + Deflection(D: Standard_Real): void; + NbNodes(): Standard_Integer; + Nodes(): TColStd_Array1OfInteger; + HasParameters(): Standard_Boolean; + } + class BRepBuilderAPI_Copy { + constructor(); + constructor(S: TopoDS_Shape, copyGeom?: Standard_Boolean, copyMesh?: Standard_Boolean); + Perform(S: TopoDS_Shape, copyGeom?: Standard_Boolean, copyMesh?: Standard_Boolean): void; + } + type STEPControl_StepModelType = "STEPControl_AsIs" | "STEPControl_ManifoldSolidBrep" | "STEPControl_BrepWithVoids" | "STEPControl_FacetedBrep" | "STEPControl_FacetedBrepAndBrepWithVoids" | "STEPControl_ShellBasedSurfaceModel" | "STEPControl_GeometricCurveSet" | "STEPControl_Hybrid"; + type BRepOffset_Mode = "BRepOffset_Skin" | "BRepOffset_Pipe" | "BRepOffset_RectoVerso"; + type IFSelect_ReturnStatus = "IFSelect_RetVoid" | "IFSelect_RetDone" | "IFSelect_RetError" | "IFSelect_RetFail" | "IFSelect_RetStop"; + type GeomAbs_JoinType = "GeomAbs_Arc" | "GeomAbs_Tangent" | "GeomAbs_Intersection"; + type GeomAbs_Shape = "GeomAbs_C0" | "GeomAbs_G1" | "GeomAbs_C1" | "GeomAbs_G2" | "GeomAbs_C2" | "GeomAbs_C3" | "GeomAbs_CN"; + type ShapeExtend_Status = "ShapeExtend_OK" | "ShapeExtend_DONE1" | "ShapeExtend_DONE2" | "ShapeExtend_DONE3" | "ShapeExtend_DONE4" | "ShapeExtend_DONE5" | "ShapeExtend_DONE6" | "ShapeExtend_DONE7" | "ShapeExtend_DONE8" | "ShapeExtend_DONE" | "ShapeExtend_FAIL1" | "ShapeExtend_FAIL2" | "ShapeExtend_FAIL3" | "ShapeExtend_FAIL4" | "ShapeExtend_FAIL5" | "ShapeExtend_FAIL6" | "ShapeExtend_FAIL7" | "ShapeExtend_FAIL8" | "ShapeExtend_FAIL"; + type BRepBuilderAPI_PipeError = "BRepBuilderAPI_PipeDone" | "BRepBuilderAPI_PipeNotDone" | "BRepBuilderAPI_PlaneNotIntersectGuide" | "BRepBuilderAPI_ImpossibleContact"; + type BRepFill_TypeOfContact = "BRepFill_NoContact" | "BRepFill_Contact" | "BRepFill_ContactOnBorder"; + type BRepBuilderAPI_FaceError = "BRepBuilderAPI_FaceDone" | "BRepBuilderAPI_NoFace" | "BRepBuilderAPI_NotPlanar" | "BRepBuilderAPI_CurveProjectionFailed" | "BRepBuilderAPI_ParametersOutOfRange"; + type ChFi2d_ConstructionError = "ChFi2d_NotPlanar" | "ChFi2d_NoFace" | "ChFi2d_InitialisationError" | "ChFi2d_ParametersError" | "ChFi2d_Ready" | "ChFi2d_IsDone" | "ChFi2d_ComputationError" | "ChFi2d_ConnexionError" | "ChFi2d_TangencyError" | "ChFi2d_FirstEdgeDegenerated" | "ChFi2d_LastEdgeDegenerated" | "ChFi2d_BothEdgesDegenerated" | "ChFi2d_NotAuthorized"; +} \ No newline at end of file diff --git a/web/src/cascade b/web/src/cascade index fa92c11..73da6e1 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit fa92c1143305f5ac2a4041fe6fdc4e82d407874a +Subproject commit 73da6e1c64ab563d2a26dcf6733697ada550ac37 diff --git a/web/src/index.html b/web/src/index.html index 3b63adb..d5ef6a7 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -6,7 +6,36 @@ <%= htmlWebpackPlugin.options.title %> diff --git a/web/src/index.js b/web/src/index.js index c7a2415..bc813e8 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -6,6 +6,10 @@ import Routes from 'src/Routes' import './scaffold.css' import './index.css' +import 'golden-layout/src/css/goldenlayout-base.css' +import 'golden-layout/src/css/goldenlayout-dark-theme.css' +import './cascade/css/main.css' +import 'monaco-editor/min/vs/editor/editor.main.css' ReactDOM.render( diff --git a/web/src/pages/HomePage/HomePage.js b/web/src/pages/HomePage/HomePage.js index 86fec29..2663ddb 100644 --- a/web/src/pages/HomePage/HomePage.js +++ b/web/src/pages/HomePage/HomePage.js @@ -1,15 +1,20 @@ import BlogLayout from 'src/layouts/BlogLayout' import BlogPostsCell from 'src/components/BlogPostsCell' import { initialize } from 'src/cascade/js/MainPage/CascadeMain' +import { useEffect } from 'react' const HomePage = () => { + useEffect(() => { + new initialize() + // TODO currently you need to press f5 to get the first render to work and for the evaluate menu to show up + // figure out why it's not initializing properly + }, []) return (
-

Cascade Studio 0.0.6 @@ -38,12 +43,6 @@ const HomePage = () => { }}>Reset Project
- {/* */} - {/* - - - - */}
diff --git a/yarn.lock b/yarn.lock index b492f49..c408422 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5874,6 +5874,11 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== +controlkit@^0.1.9: + version "0.1.9" + resolved "https://registry.yarnpkg.com/controlkit/-/controlkit-0.1.9.tgz#00a0598a2a3c25f85494327d86d3daf1b11f08ab" + integrity sha1-AKBZiio8JfhUlDJ9htPa8bEfCKs= + convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" @@ -8235,6 +8240,13 @@ globby@^6.1.0: pify "^2.0.0" pinkie-promise "^2.0.0" +golden-layout@^1.5.9: + version "1.5.9" + resolved "https://registry.yarnpkg.com/golden-layout/-/golden-layout-1.5.9.tgz#a39bc1f6a67e6f886b797c016dd924e9426ba77f" + integrity sha1-o5vB9qZ+b4hreXwBbdkk6UJrp38= + dependencies: + jquery "*" + good-listener@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" @@ -9892,6 +9904,11 @@ jest@^26.1.0: import-local "^3.0.2" jest-cli "^26.2.2" +jquery@*, jquery@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5" + integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -10919,6 +10936,18 @@ module-not-found-error@^1.0.1: resolved "https://registry.yarnpkg.com/module-not-found-error/-/module-not-found-error-1.0.1.tgz#cf8b4ff4f29640674d6cdd02b0e3bc523c2bbdc0" integrity sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA= +monaco-editor-webpack-plugin@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.9.1.tgz#eb4bbb1c5e5bfb554541c1ae1542e74c2a9f43fd" + integrity sha512-x7fx1w3i/uwZERIgztHAAK3VQMsL8+ku0lFXXbO81hKDg8IieACqjGEa2mqEueg0c/fX+wd0oI+75wB19KJAsA== + dependencies: + loader-utils "^1.2.3" + +monaco-editor@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.20.0.tgz#5d5009343a550124426cb4d965a4d27a348b4dea" + integrity sha512-hkvf4EtPJRMQlPC3UbMoRs0vTAFAYdzFQ+gpMb8A+9znae1c43q8Mab9iVsgTcg/4PNiLGGn3SlDIa8uvK1FIQ== + morgan@^1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7" @@ -11433,6 +11462,11 @@ open@^7.0.0: is-docker "^2.0.0" is-wsl "^2.1.1" +opencascade.js@^0.1.15: + version "0.1.19" + resolved "https://registry.yarnpkg.com/opencascade.js/-/opencascade.js-0.1.19.tgz#32d545ca4add213d168eb6e6973dceba1bcab35b" + integrity sha512-7q8LNihtU7BzsIXXoqTHq2/7ASfDdK5OycuI1oscc/9Opmew8OXjcv/oTSF+w5U+0dwUt8LewdG/xYSIkkf8Ig== + opener@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" @@ -14166,6 +14200,11 @@ text-table@0.2.0, text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +three@^0.118.3: + version "0.118.3" + resolved "https://registry.yarnpkg.com/three/-/three-0.118.3.tgz#c0bf8c10a68155478f12f4ccac2ff979526a4a0a" + integrity sha512-ijECXrNzDkHieoeh2H69kgawTGH8DiamhR4uBN8jEM7VHSKvfTdEvOoHsA8Aq7dh7PHAxhlqBsN5arBI3KixSw== + throat@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" From f1dc6c28e4a674b3b7c2f5855ab819919b4afc25 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 11 Oct 2020 14:56:28 +1100 Subject: [PATCH 5/9] share state with react component --- web/src/cascade | 2 +- web/src/index.html | 1 + web/src/pages/HomePage/HomePage.js | 35 +++++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/web/src/cascade b/web/src/cascade index 73da6e1..b536e6a 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit 73da6e1c64ab563d2a26dcf6733697ada550ac37 +Subproject commit b536e6a09a261650161b284fbef9c125c0e464be diff --git a/web/src/index.html b/web/src/index.html index d5ef6a7..bec0953 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -11,6 +11,7 @@ var messageHandlers = {}; var cascadeStudioWorker var workerWorking = false + var galleryProject = undefined function coolGuy() { if ('serviceWorker' in navigator) { navigator.serviceWorker.register('service-worker.js').then(function(registration) { diff --git a/web/src/pages/HomePage/HomePage.js b/web/src/pages/HomePage/HomePage.js index 2663ddb..0f9d2c7 100644 --- a/web/src/pages/HomePage/HomePage.js +++ b/web/src/pages/HomePage/HomePage.js @@ -1,18 +1,42 @@ import BlogLayout from 'src/layouts/BlogLayout' import BlogPostsCell from 'src/components/BlogPostsCell' import { initialize } from 'src/cascade/js/MainPage/CascadeMain' -import { useEffect } from 'react' +import { useEffect, useState } from 'react' +const starterCode = +`// Welcome to Cascade Studio! Here are some useful functions: +// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection() +// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon() +// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(), +// FilletEdges(), ChamferEdges(), +// Slider(), Button(), Checkbox() + +// Uncomment and hover over them to see their apis + +let holeRadius = Slider("Radius", 30 , 20 , 40); + +let sphere = Sphere(50); +let cylinderZ = Cylinder(holeRadius, 200, true); +let cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true)); +let cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true)); + +Translate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ])); + +Translate([-100, 0, 100], Text3D("cadhub.xyz")); + +// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace! +`; const HomePage = () => { + const [code, setCode] = useState(starterCode) useEffect(() => { - new initialize() - // TODO currently you need to press f5 to get the first render to work and for the evaluate menu to show up - // figure out why it's not initializing properly + const sickCallback = (code) => setCode(code) + new initialize(sickCallback, starterCode) }, []) return ( +
current code {code}

@@ -42,8 +66,9 @@ const HomePage = () => { window.history.replaceState({}, 'Cascade Studio','?') }}>Reset Project
-
+
+
footer
) From b3456860d20e25ebfe187a83a413f4d0e49d23f6 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 11 Oct 2020 19:41:48 +1100 Subject: [PATCH 6/9] add parts data --- .../20201011043647-create-parts/README.md | 52 +++++++++ .../20201011043647-create-parts/schema.prisma | 28 +++++ .../20201011043647-create-parts/steps.json | 105 +++++++++++++++++ .../20201011052155-add-code-to-part/README.md | 65 +++++++++++ .../schema.prisma | 29 +++++ .../steps.json | 37 ++++++ .../README.md | 69 +++++++++++ .../schema.prisma | 29 +++++ .../steps.json | 19 +++ api/prisma/migrations/migrate.lock | 5 +- api/prisma/schema.prisma | 11 ++ api/src/graphql/parts.sdl.js | 35 ++++++ api/src/services/parts/parts.js | 30 +++++ api/src/services/parts/parts.test.js | 9 ++ web/src/Routes.js | 6 +- web/src/cascade | 2 +- .../components/EditPartCell/EditPartCell.js | 51 ++++++++ web/src/components/NewPart/NewPart.js | 38 ++++++ web/src/components/Part/Part.js | 110 ++++++++++++++++++ web/src/components/PartCell/PartCell.js | 46 ++++++++ web/src/components/PartForm/PartForm.js | 100 ++++++++++++++++ web/src/components/Parts/Parts.js | 109 +++++++++++++++++ web/src/components/PartsCell/PartsCell.js | 33 ++++++ web/src/index.html | 2 +- web/src/layouts/MainLayout/MainLayout.js | 26 +++++ .../layouts/MainLayout/MainLayout.stories.js | 7 ++ web/src/layouts/MainLayout/MainLayout.test.js | 11 ++ web/src/layouts/PartsLayout/PartsLayout.js | 23 ++++ web/src/pages/EditPartPage/EditPartPage.js | 12 ++ web/src/pages/HomePage/HomePage.js | 7 +- web/src/pages/NewPartPage/NewPartPage.js | 12 ++ web/src/pages/PartPage/PartPage.js | 15 +++ web/src/pages/PartsPage/PartsPage.js | 15 +++ web/src/pages/PostsPage/PostsPage.js | 9 +- 34 files changed, 1146 insertions(+), 11 deletions(-) create mode 100644 api/prisma/migrations/20201011043647-create-parts/README.md create mode 100644 api/prisma/migrations/20201011043647-create-parts/schema.prisma create mode 100644 api/prisma/migrations/20201011043647-create-parts/steps.json create mode 100644 api/prisma/migrations/20201011052155-add-code-to-part/README.md create mode 100644 api/prisma/migrations/20201011052155-add-code-to-part/schema.prisma create mode 100644 api/prisma/migrations/20201011052155-add-code-to-part/steps.json create mode 100644 api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/README.md create mode 100644 api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/schema.prisma create mode 100644 api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/steps.json create mode 100644 api/src/graphql/parts.sdl.js create mode 100644 api/src/services/parts/parts.js create mode 100644 api/src/services/parts/parts.test.js create mode 100644 web/src/components/EditPartCell/EditPartCell.js create mode 100644 web/src/components/NewPart/NewPart.js create mode 100644 web/src/components/Part/Part.js create mode 100644 web/src/components/PartCell/PartCell.js create mode 100644 web/src/components/PartForm/PartForm.js create mode 100644 web/src/components/Parts/Parts.js create mode 100644 web/src/components/PartsCell/PartsCell.js create mode 100644 web/src/layouts/MainLayout/MainLayout.js create mode 100644 web/src/layouts/MainLayout/MainLayout.stories.js create mode 100644 web/src/layouts/MainLayout/MainLayout.test.js create mode 100644 web/src/layouts/PartsLayout/PartsLayout.js create mode 100644 web/src/pages/EditPartPage/EditPartPage.js create mode 100644 web/src/pages/NewPartPage/NewPartPage.js create mode 100644 web/src/pages/PartPage/PartPage.js create mode 100644 web/src/pages/PartsPage/PartsPage.js diff --git a/api/prisma/migrations/20201011043647-create-parts/README.md b/api/prisma/migrations/20201011043647-create-parts/README.md new file mode 100644 index 0000000..1def1c5 --- /dev/null +++ b/api/prisma/migrations/20201011043647-create-parts/README.md @@ -0,0 +1,52 @@ +# Migration `20201011043647-create-parts` + +This migration has been generated by Kurt Hutten at 10/11/2020, 3:36:47 PM. +You can check out the [state of the schema](./schema.prisma) after the migration. + +## Database Steps + +```sql +CREATE TABLE "Part" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "description" TEXT NOT NULL, + "mainImage" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +) +``` + +## Changes + +```diff +diff --git schema.prisma schema.prisma +migration 20201009213512-create-posts..20201011043647-create-parts +--- datamodel.dml ++++ datamodel.dml +@@ -1,9 +1,9 @@ + datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" +- url = "***" ++ url = "***" + } + generator client { + provider = "prisma-client-js" +@@ -15,4 +15,14 @@ + title String + body String + createdAt DateTime @default(now()) + } ++ ++model Part { ++ id Int @id @default(autoincrement()) ++ title String ++ description String // markdown string ++ mainImage String // link to cloudinary ++ createdAt DateTime @default(now()) ++ // userId ++ //likes, comments, reactions ++} +``` + + diff --git a/api/prisma/migrations/20201011043647-create-parts/schema.prisma b/api/prisma/migrations/20201011043647-create-parts/schema.prisma new file mode 100644 index 0000000..6d2b834 --- /dev/null +++ b/api/prisma/migrations/20201011043647-create-parts/schema.prisma @@ -0,0 +1,28 @@ +datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" + url = "***" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = "native" +} + +model Post { + id Int @id @default(autoincrement()) + title String + body String + createdAt DateTime @default(now()) +} + +model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +} diff --git a/api/prisma/migrations/20201011043647-create-parts/steps.json b/api/prisma/migrations/20201011043647-create-parts/steps.json new file mode 100644 index 0000000..3328ce6 --- /dev/null +++ b/api/prisma/migrations/20201011043647-create-parts/steps.json @@ -0,0 +1,105 @@ +{ + "version": "0.3.14-fixed", + "steps": [ + { + "tag": "CreateModel", + "model": "Part" + }, + { + "tag": "CreateField", + "model": "Part", + "field": "id", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Part", + "field": "id" + }, + "directive": "id" + } + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Part", + "field": "id" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Part", + "field": "id" + }, + "directive": "default" + }, + "argument": "", + "value": "autoincrement()" + }, + { + "tag": "CreateField", + "model": "Part", + "field": "title", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Part", + "field": "description", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Part", + "field": "mainImage", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Part", + "field": "createdAt", + "type": "DateTime", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Part", + "field": "createdAt" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Part", + "field": "createdAt" + }, + "directive": "default" + }, + "argument": "", + "value": "now()" + } + ] +} \ No newline at end of file diff --git a/api/prisma/migrations/20201011052155-add-code-to-part/README.md b/api/prisma/migrations/20201011052155-add-code-to-part/README.md new file mode 100644 index 0000000..ffbd7bc --- /dev/null +++ b/api/prisma/migrations/20201011052155-add-code-to-part/README.md @@ -0,0 +1,65 @@ +# Migration `20201011052155-add-code-to-part` + +This migration has been generated by Kurt Hutten at 10/11/2020, 4:21:55 PM. +You can check out the [state of the schema](./schema.prisma) after the migration. + +## Database Steps + +```sql +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Part" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "description" TEXT NOT NULL, + "code" TEXT NOT NULL DEFAULT '// Welcome to Cascade Studio! Here are some useful functions: +// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection() +// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon() +// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(), +// FilletEdges(), ChamferEdges(), +// Slider(), Button(), Checkbox() +let holeRadius = Slider("Radius", 30 , 20 , 40); +let sphere = Sphere(50); +let cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true)); +let cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ])); + +Translate([-25, 0, 40], Text3D("Hi!"));/n// Don''t forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!', + "mainImage" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); +INSERT INTO "new_Part" ("id", "title", "description", "mainImage", "createdAt") SELECT "id", "title", "description", "mainImage", "createdAt" FROM "Part"; +DROP TABLE "Part"; +ALTER TABLE "new_Part" RENAME TO "Part"; +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON +``` + +## Changes + +```diff +diff --git schema.prisma schema.prisma +migration 20201011043647-create-parts..20201011052155-add-code-to-part +--- datamodel.dml ++++ datamodel.dml +@@ -1,9 +1,9 @@ + datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" +- url = "***" ++ url = "***" + } + generator client { + provider = "prisma-client-js" +@@ -20,8 +20,9 @@ + model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string ++ code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));/n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +``` + + diff --git a/api/prisma/migrations/20201011052155-add-code-to-part/schema.prisma b/api/prisma/migrations/20201011052155-add-code-to-part/schema.prisma new file mode 100644 index 0000000..41ca83b --- /dev/null +++ b/api/prisma/migrations/20201011052155-add-code-to-part/schema.prisma @@ -0,0 +1,29 @@ +datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" + url = "***" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = "native" +} + +model Post { + id Int @id @default(autoincrement()) + title String + body String + createdAt DateTime @default(now()) +} + +model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string + code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));/n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +} diff --git a/api/prisma/migrations/20201011052155-add-code-to-part/steps.json b/api/prisma/migrations/20201011052155-add-code-to-part/steps.json new file mode 100644 index 0000000..0c8bd6f --- /dev/null +++ b/api/prisma/migrations/20201011052155-add-code-to-part/steps.json @@ -0,0 +1,37 @@ +{ + "version": "0.3.14-fixed", + "steps": [ + { + "tag": "CreateField", + "model": "Part", + "field": "code", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Part", + "field": "code" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Part", + "field": "code" + }, + "directive": "default" + }, + "argument": "", + "value": "\"// Welcome to Cascade Studio! Here are some useful functions:\\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\\n// FilletEdges(), ChamferEdges(),\\n// Slider(), Button(), Checkbox()\\nlet holeRadius = Slider(\\\"Radius\\\", 30 , 20 , 40);\\nlet sphere = Sphere(50);\\nlet cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\\n\\nTranslate([-25, 0, 40], Text3D(\\\"Hi!\\\"));/n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!\"" + } + ] +} \ No newline at end of file diff --git a/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/README.md b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/README.md new file mode 100644 index 0000000..1e30c97 --- /dev/null +++ b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/README.md @@ -0,0 +1,69 @@ +# Migration `20201011082558-add-code-not-needed-upon-create` + +This migration has been generated by Kurt Hutten at 10/11/2020, 7:25:58 PM. +You can check out the [state of the schema](./schema.prisma) after the migration. + +## Database Steps + +```sql +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Part" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "title" TEXT NOT NULL, + "description" TEXT NOT NULL, + "code" TEXT NOT NULL DEFAULT '// Welcome to Cascade Studio! Here are some useful functions: +// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection() +// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon() +// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(), +// FilletEdges(), ChamferEdges(), +// Slider(), Button(), Checkbox() +let holeRadius = Slider("Radius", 30 , 20 , 40); +let sphere = Sphere(50); +let cylinderZ = Cylinder(holeRadius, 200, true); +let cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true)); +let cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true)); +Translate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ])); + +Translate([-25, 0, 40], Text3D("Hi!")); +// Don''t forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!', + "mainImage" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); +INSERT INTO "new_Part" ("id", "title", "description", "mainImage", "createdAt", "code") SELECT "id", "title", "description", "mainImage", "createdAt", "code" FROM "Part"; +DROP TABLE "Part"; +ALTER TABLE "new_Part" RENAME TO "Part"; +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON +``` + +## Changes + +```diff +diff --git schema.prisma schema.prisma +migration 20201011052155-add-code-to-part..20201011082558-add-code-not-needed-upon-create +--- datamodel.dml ++++ datamodel.dml +@@ -1,9 +1,9 @@ + datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" +- url = "***" ++ url = "***" + } + generator client { + provider = "prisma-client-js" +@@ -20,9 +20,9 @@ + model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string +- code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);/nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));/nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));/n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") ++ code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);\nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));\nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));\n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +``` + + diff --git a/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/schema.prisma b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/schema.prisma new file mode 100644 index 0000000..f22b4b7 --- /dev/null +++ b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/schema.prisma @@ -0,0 +1,29 @@ +datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" + url = "***" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = "native" +} + +model Post { + id Int @id @default(autoincrement()) + title String + body String + createdAt DateTime @default(now()) +} + +model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string + code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);\nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));\nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));\n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +} diff --git a/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/steps.json b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/steps.json new file mode 100644 index 0000000..8c127a5 --- /dev/null +++ b/api/prisma/migrations/20201011082558-add-code-not-needed-upon-create/steps.json @@ -0,0 +1,19 @@ +{ + "version": "0.3.14-fixed", + "steps": [ + { + "tag": "UpdateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Part", + "field": "code" + }, + "directive": "default" + }, + "argument": "", + "newValue": "\"// Welcome to Cascade Studio! Here are some useful functions:\\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\\n// FilletEdges(), ChamferEdges(),\\n// Slider(), Button(), Checkbox()\\nlet holeRadius = Slider(\\\"Radius\\\", 30 , 20 , 40);\\nlet sphere = Sphere(50);\\nlet cylinderZ = Cylinder(holeRadius, 200, true);\\nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));\\nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\\n\\nTranslate([-25, 0, 40], Text3D(\\\"Hi!\\\"));\\n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!\"" + } + ] +} \ No newline at end of file diff --git a/api/prisma/migrations/migrate.lock b/api/prisma/migrations/migrate.lock index a23e9cb..299515f 100644 --- a/api/prisma/migrations/migrate.lock +++ b/api/prisma/migrations/migrate.lock @@ -1,3 +1,6 @@ # Prisma Migrate lockfile v1 -20201009213512-create-posts \ No newline at end of file +20201009213512-create-posts +20201011043647-create-parts +20201011052155-add-code-to-part +20201011082558-add-code-not-needed-upon-create \ No newline at end of file diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index 929fed4..449c8ad 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -16,3 +16,14 @@ model Post { body String createdAt DateTime @default(now()) } + +model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string + code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);\nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));\nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));\n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +} diff --git a/api/src/graphql/parts.sdl.js b/api/src/graphql/parts.sdl.js new file mode 100644 index 0000000..bec69fa --- /dev/null +++ b/api/src/graphql/parts.sdl.js @@ -0,0 +1,35 @@ +export const schema = gql` + type Part { + id: Int! + title: String! + description: String! + code: String! + mainImage: String! + createdAt: DateTime! + } + + type Query { + parts: [Part!]! + part(id: Int!): Part + } + + input CreatePartInput { + title: String! + description: String! + code: String + mainImage: String + } + + input UpdatePartInput { + title: String + description: String + code: String + mainImage: String + } + + type Mutation { + createPart(input: CreatePartInput!): Part! + updatePart(id: Int!, input: UpdatePartInput!): Part! + deletePart(id: Int!): Part! + } +` diff --git a/api/src/services/parts/parts.js b/api/src/services/parts/parts.js new file mode 100644 index 0000000..98c6243 --- /dev/null +++ b/api/src/services/parts/parts.js @@ -0,0 +1,30 @@ +import { db } from 'src/lib/db' + +export const parts = () => { + return db.part.findMany() +} + +export const part = ({ id }) => { + return db.part.findOne({ + where: { id }, + }) +} + +export const createPart = ({ input }) => { + return db.part.create({ + data: input, + }) +} + +export const updatePart = ({ id, input }) => { + return db.part.update({ + data: input, + where: { id }, + }) +} + +export const deletePart = ({ id }) => { + return db.part.delete({ + where: { id }, + }) +} diff --git a/api/src/services/parts/parts.test.js b/api/src/services/parts/parts.test.js new file mode 100644 index 0000000..e8b80ce --- /dev/null +++ b/api/src/services/parts/parts.test.js @@ -0,0 +1,9 @@ +/* +import { parts } from './parts' +*/ + +describe('parts', () => { + it('returns true', () => { + expect(true).toBe(true) + }) +}) diff --git a/web/src/Routes.js b/web/src/Routes.js index 4b19643..0245da0 100644 --- a/web/src/Routes.js +++ b/web/src/Routes.js @@ -12,13 +12,17 @@ import { Router, Route } from '@redwoodjs/router' const Routes = () => { return ( + + + + - + ) diff --git a/web/src/cascade b/web/src/cascade index b536e6a..e634591 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit b536e6a09a261650161b284fbef9c125c0e464be +Subproject commit e634591e27dd41fec1638b278be3c298c6ab4b5a diff --git a/web/src/components/EditPartCell/EditPartCell.js b/web/src/components/EditPartCell/EditPartCell.js new file mode 100644 index 0000000..ca617e4 --- /dev/null +++ b/web/src/components/EditPartCell/EditPartCell.js @@ -0,0 +1,51 @@ +import { useMutation, useFlash } from '@redwoodjs/web' +import { navigate, routes } from '@redwoodjs/router' +import PartForm from 'src/components/PartForm' + +export const QUERY = gql` + query FIND_PART_BY_ID($id: Int!) { + part: part(id: $id) { + id + title + description + code + mainImage + createdAt + } + } +` +const UPDATE_PART_MUTATION = gql` + mutation UpdatePartMutation($id: Int!, $input: UpdatePartInput!) { + updatePart(id: $id, input: $input) { + id + code + } + } +` + +export const Loading = () =>
Loading...
+ +export const Success = ({ part }) => { + const { addMessage } = useFlash() + const [updatePart, { loading, error }] = useMutation(UPDATE_PART_MUTATION, { + onCompleted: () => { + navigate(routes.parts()) + addMessage('Part updated.', { classes: 'rw-flash-success' }) + }, + }) + + const onSave = (input, id) => { + updatePart({ variables: { id, input } }) + } + + return ( +
+
+

Edit Part {part.id}

+
+
+ +
+
+ ) +} diff --git a/web/src/components/NewPart/NewPart.js b/web/src/components/NewPart/NewPart.js new file mode 100644 index 0000000..3b7e5ed --- /dev/null +++ b/web/src/components/NewPart/NewPart.js @@ -0,0 +1,38 @@ +import { useMutation, useFlash } from '@redwoodjs/web' +import { navigate, routes } from '@redwoodjs/router' +import PartForm from 'src/components/PartForm' + +const CREATE_PART_MUTATION = gql` + mutation CreatePartMutation($input: CreatePartInput!) { + createPart(input: $input) { + id + } + } +` + +const NewPart = () => { + const { addMessage } = useFlash() + const [createPart, { loading, error }] = useMutation(CREATE_PART_MUTATION, { + onCompleted: () => { + navigate(routes.parts()) + addMessage('Part created.', { classes: 'rw-flash-success' }) + }, + }) + + const onSave = (input) => { + createPart({ variables: { input } }) + } + + return ( +
+
+

New Part

+
+
+ +
+
+ ) +} + +export default NewPart diff --git a/web/src/components/Part/Part.js b/web/src/components/Part/Part.js new file mode 100644 index 0000000..b132dbc --- /dev/null +++ b/web/src/components/Part/Part.js @@ -0,0 +1,110 @@ +import { useMutation, useFlash } from '@redwoodjs/web' +import { Link, routes, navigate } from '@redwoodjs/router' +import { initialize } from 'src/cascade/js/MainPage/CascadeMain' +import { useEffect, useState } from 'react' + +const DELETE_PART_MUTATION = gql` + mutation DeletePartMutation($id: Int!) { + deletePart(id: $id) { + id + } + } +` + +const Part = ({ part, saveCode, loading, error}) => { + const [code, setCode] = useState(part.code) + useEffect(() => { + const sickCallback = (code) => setCode(code) + initialize(sickCallback, part.code) + }, []) + const hasChanges = code !== part.code + const { addMessage } = useFlash() + const [deletePart] = useMutation(DELETE_PART_MUTATION, { + onCompleted: () => { + navigate(routes.parts()) + addMessage('Part deleted.', { classes: 'rw-flash-success' }) + }, + }) + + const onDeleteClick = (id) => { + if (confirm('Are you sure you want to delete part ' + id + '?')) { + deletePart({ variables: { id } }) + } + } + + return ( + <> +
+
+

+ Part {part.id} Detail +

+
+ + + + + + + + + + + {/* + + + */} + {/* + + + */} + {/* + + + */} + +
Title{part.title}
Description{part.description}
Code{part.code}
Main image{part.mainImage}
Created at{timeTag(part.createdAt)}
+ +
+ + + + ) +} + +export default Part diff --git a/web/src/components/PartCell/PartCell.js b/web/src/components/PartCell/PartCell.js new file mode 100644 index 0000000..3b95c0b --- /dev/null +++ b/web/src/components/PartCell/PartCell.js @@ -0,0 +1,46 @@ +import { useMutation, useFlash } from '@redwoodjs/web' +import { navigate, routes } from '@redwoodjs/router' +import Part from 'src/components/Part' + +export const QUERY = gql` + query FIND_PART_BY_ID($id: Int!) { + part: part(id: $id) { + id + title + description + code + mainImage + createdAt + } + } +` + +const UPDATE_PART_MUTATION = gql` + mutation UpdatePartMutation($id: Int!, $input: UpdatePartInput!) { + updatePart(id: $id, input: $input) { + id + } + } +` + +export const Loading = () =>
Loading...
+ +export const Empty = () =>
Part not found
+ +export const Success = ({ part }) => { + const { addMessage } = useFlash() + const [updatePart, { loading, error }] = useMutation(UPDATE_PART_MUTATION, { + onCompleted: () => { + // navigate(routes.part({id: updatePart.id})) + addMessage('Part updated.', { classes: 'rw-flash-success' }) + }, + }) + console.log({updatePart}) + + + const saveCode = (input, id) => { + console.log(id, input, 'wowow') + updatePart({ variables: { id, input } }) + } + return +} diff --git a/web/src/components/PartForm/PartForm.js b/web/src/components/PartForm/PartForm.js new file mode 100644 index 0000000..433987b --- /dev/null +++ b/web/src/components/PartForm/PartForm.js @@ -0,0 +1,100 @@ +import { + Form, + FormError, + FieldError, + Label, + TextField, + TextAreaField, + Submit, +} from '@redwoodjs/forms' + +const PartForm = (props) => { + const onSubmit = (data) => { + props.onSave(data, props?.part?.id) + } + + return ( +
+
+ + + + + + + + + + + + + + + + + + +
+ + Save + +
+ +
+ ) +} + +export default PartForm diff --git a/web/src/components/Parts/Parts.js b/web/src/components/Parts/Parts.js new file mode 100644 index 0000000..c868554 --- /dev/null +++ b/web/src/components/Parts/Parts.js @@ -0,0 +1,109 @@ +import { useMutation, useFlash } from '@redwoodjs/web' +import { Link, routes } from '@redwoodjs/router' + +const DELETE_PART_MUTATION = gql` + mutation DeletePartMutation($id: Int!) { + deletePart(id: $id) { + id + } + } +` + +const MAX_STRING_LENGTH = 150 + +const truncate = (text) => { + let output = text + if (text && text.length > MAX_STRING_LENGTH) { + output = output.substring(0, MAX_STRING_LENGTH) + '...' + } + return output +} + +const jsonTruncate = (obj) => { + return truncate(JSON.stringify(obj, null, 2)) +} + +const timeTag = (datetime) => { + return ( + + ) +} + +const checkboxInputTag = (checked) => { + return +} + +const PartsList = ({ parts }) => { + const { addMessage } = useFlash() + const [deletePart] = useMutation(DELETE_PART_MUTATION, { + onCompleted: () => { + addMessage('Part deleted.', { classes: 'rw-flash-success' }) + }, + }) + + const onDeleteClick = (id) => { + if (confirm('Are you sure you want to delete part ' + id + '?')) { + deletePart({ variables: { id }, refetchQueries: ['PARTS'] }) + } + } + + return ( +
+ + + + + + + + + + + + + + {parts.map((part) => ( + + + + + + + + + + ))} + +
IdTitleDescriptionCodeMain imageCreated at 
{truncate(part.id)}{truncate(part.title)}{truncate(part.description)}{truncate(part.code)}{truncate(part.mainImage)}{timeTag(part.createdAt)} + +
+
+ ) +} + +export default PartsList diff --git a/web/src/components/PartsCell/PartsCell.js b/web/src/components/PartsCell/PartsCell.js new file mode 100644 index 0000000..98380e8 --- /dev/null +++ b/web/src/components/PartsCell/PartsCell.js @@ -0,0 +1,33 @@ +import { Link, routes } from '@redwoodjs/router' + +import Parts from 'src/components/Parts' + +export const QUERY = gql` + query PARTS { + parts { + id + title + description + code + mainImage + createdAt + } + } +` + +export const Loading = () =>
Loading...
+ +export const Empty = () => { + return ( +
+ {'No parts yet. '} + + {'Create one?'} + +
+ ) +} + +export const Success = ({ parts }) => { + return +} diff --git a/web/src/index.html b/web/src/index.html index bec0953..a8fa947 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -25,7 +25,7 @@ // Begins loading the CAD Kernel Web Worker if (window.Worker) { - cascadeStudioWorker = new Worker('./src/cascade/js/CADWorker/CascadeStudioMainWorker.js'); + cascadeStudioWorker = new Worker('/src/cascade/js/CADWorker/CascadeStudioMainWorker.js'); // Ping Pong Messages Back and Forth based on their registration in messageHandlers // var messageHandlers = {}; cascadeStudioWorker.onmessage = function (e) { diff --git a/web/src/layouts/MainLayout/MainLayout.js b/web/src/layouts/MainLayout/MainLayout.js new file mode 100644 index 0000000..8412653 --- /dev/null +++ b/web/src/layouts/MainLayout/MainLayout.js @@ -0,0 +1,26 @@ +import { Link, routes } from '@redwoodjs/router' + +const MainLayout = ({ children }) => { + return ( + <> +
+ +
+
{children}
+ + ) +} + +export default MainLayout diff --git a/web/src/layouts/MainLayout/MainLayout.stories.js b/web/src/layouts/MainLayout/MainLayout.stories.js new file mode 100644 index 0000000..44eb671 --- /dev/null +++ b/web/src/layouts/MainLayout/MainLayout.stories.js @@ -0,0 +1,7 @@ +import MainLayout from './MainLayout' + +export const generated = () => { + return +} + +export default { title: 'Layouts/MainLayout' } diff --git a/web/src/layouts/MainLayout/MainLayout.test.js b/web/src/layouts/MainLayout/MainLayout.test.js new file mode 100644 index 0000000..eb404a9 --- /dev/null +++ b/web/src/layouts/MainLayout/MainLayout.test.js @@ -0,0 +1,11 @@ +import { render } from '@redwoodjs/testing' + +import MainLayout from './MainLayout' + +describe('MainLayout', () => { + it('renders successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) +}) diff --git a/web/src/layouts/PartsLayout/PartsLayout.js b/web/src/layouts/PartsLayout/PartsLayout.js new file mode 100644 index 0000000..f0ecd0c --- /dev/null +++ b/web/src/layouts/PartsLayout/PartsLayout.js @@ -0,0 +1,23 @@ +import { Link, routes } from '@redwoodjs/router' +import { Flash } from '@redwoodjs/web' + +const PartsLayout = (props) => { + return ( +
+ +
+

+ + Parts + +

+ +
+
New Part + +
+
{props.children}
+
+ ) +} + +export default PartsLayout diff --git a/web/src/pages/EditPartPage/EditPartPage.js b/web/src/pages/EditPartPage/EditPartPage.js new file mode 100644 index 0000000..3634709 --- /dev/null +++ b/web/src/pages/EditPartPage/EditPartPage.js @@ -0,0 +1,12 @@ +import PartsLayout from 'src/layouts/PartsLayout' +import EditPartCell from 'src/components/EditPartCell' + +const EditPartPage = ({ id }) => { + return ( + + + + ) +} + +export default EditPartPage diff --git a/web/src/pages/HomePage/HomePage.js b/web/src/pages/HomePage/HomePage.js index 0f9d2c7..94f1f89 100644 --- a/web/src/pages/HomePage/HomePage.js +++ b/web/src/pages/HomePage/HomePage.js @@ -1,4 +1,4 @@ -import BlogLayout from 'src/layouts/BlogLayout' +import MainLayout from 'src/layouts/MainLayout' import BlogPostsCell from 'src/components/BlogPostsCell' import { initialize } from 'src/cascade/js/MainPage/CascadeMain' import { useEffect, useState } from 'react' @@ -35,11 +35,10 @@ const HomePage = () => { }, []) return ( - +
current code {code}
-

Cascade Studio 0.0.6 makeMainProject()}>Make Main Project @@ -70,7 +69,7 @@ const HomePage = () => {
footer
-
+
) } diff --git a/web/src/pages/NewPartPage/NewPartPage.js b/web/src/pages/NewPartPage/NewPartPage.js new file mode 100644 index 0000000..4f39148 --- /dev/null +++ b/web/src/pages/NewPartPage/NewPartPage.js @@ -0,0 +1,12 @@ +import PartsLayout from 'src/layouts/PartsLayout' +import NewPart from 'src/components/NewPart' + +const NewPartPage = () => { + return ( + + + + ) +} + +export default NewPartPage diff --git a/web/src/pages/PartPage/PartPage.js b/web/src/pages/PartPage/PartPage.js new file mode 100644 index 0000000..b9bcd31 --- /dev/null +++ b/web/src/pages/PartPage/PartPage.js @@ -0,0 +1,15 @@ +import PartsLayout from 'src/layouts/PartsLayout' +import MainLayout from 'src/layouts/MainLayout' +import PartCell from 'src/components/PartCell' + +const PartPage = ({ id }) => { + return ( + + + + + + ) +} + +export default PartPage diff --git a/web/src/pages/PartsPage/PartsPage.js b/web/src/pages/PartsPage/PartsPage.js new file mode 100644 index 0000000..ae36f11 --- /dev/null +++ b/web/src/pages/PartsPage/PartsPage.js @@ -0,0 +1,15 @@ +import MainLayout from 'src/layouts/MainLayout' +import PartsLayout from 'src/layouts/PartsLayout' +import PartsCell from 'src/components/PartsCell' + +const PartsPage = () => { + return ( + + + + + + ) +} + +export default PartsPage diff --git a/web/src/pages/PostsPage/PostsPage.js b/web/src/pages/PostsPage/PostsPage.js index 7318d9b..b5392dc 100644 --- a/web/src/pages/PostsPage/PostsPage.js +++ b/web/src/pages/PostsPage/PostsPage.js @@ -1,11 +1,14 @@ +import MainLayout from 'src/layouts/MainLayout' import PostsLayout from 'src/layouts/PostsLayout' import PostsCell from 'src/components/PostsCell' const PostsPage = () => { return ( - - - + + + + + ) } From 6a957957600fa51117dd91a974208881672339d9 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Mon, 12 Oct 2020 19:19:27 +1100 Subject: [PATCH 7/9] add contact page --- .../20201011095227-create-contact/README.md | 50 +++++++++ .../schema.prisma | 37 ++++++ .../20201011095227-create-contact/steps.json | 105 ++++++++++++++++++ api/prisma/migrations/migrate.lock | 3 +- api/prisma/schema.prisma | 8 ++ api/src/graphql/contacts.sdl.js | 29 +++++ api/src/services/contacts/contacts.js | 24 ++++ api/src/services/contacts/contacts.test.js | 9 ++ web/src/Routes.js | 1 + web/src/index.css | 17 +++ web/src/index.js | 2 +- web/src/layouts/MainLayout/MainLayout.js | 3 + web/src/pages/ContactPage/ContactPage.js | 59 ++++++++++ .../pages/ContactPage/ContactPage.stories.js | 7 ++ web/src/pages/ContactPage/ContactPage.test.js | 11 ++ 15 files changed, 363 insertions(+), 2 deletions(-) create mode 100644 api/prisma/migrations/20201011095227-create-contact/README.md create mode 100644 api/prisma/migrations/20201011095227-create-contact/schema.prisma create mode 100644 api/prisma/migrations/20201011095227-create-contact/steps.json create mode 100644 api/src/graphql/contacts.sdl.js create mode 100644 api/src/services/contacts/contacts.js create mode 100644 api/src/services/contacts/contacts.test.js create mode 100644 web/src/pages/ContactPage/ContactPage.js create mode 100644 web/src/pages/ContactPage/ContactPage.stories.js create mode 100644 web/src/pages/ContactPage/ContactPage.test.js diff --git a/api/prisma/migrations/20201011095227-create-contact/README.md b/api/prisma/migrations/20201011095227-create-contact/README.md new file mode 100644 index 0000000..5748d5e --- /dev/null +++ b/api/prisma/migrations/20201011095227-create-contact/README.md @@ -0,0 +1,50 @@ +# Migration `20201011095227-create-contact` + +This migration has been generated by Kurt Hutten at 10/11/2020, 8:52:27 PM. +You can check out the [state of the schema](./schema.prisma) after the migration. + +## Database Steps + +```sql +CREATE TABLE "Contact" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT NOT NULL, + "email" TEXT NOT NULL, + "message" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +) +``` + +## Changes + +```diff +diff --git schema.prisma schema.prisma +migration 20201011082558-add-code-not-needed-upon-create..20201011095227-create-contact +--- datamodel.dml ++++ datamodel.dml +@@ -1,9 +1,9 @@ + datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" +- url = "***" ++ url = "***" + } + generator client { + provider = "prisma-client-js" +@@ -26,4 +26,12 @@ + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions + } ++ ++model Contact { ++ id Int @id @default(autoincrement()) ++ name String ++ email String ++ message String ++ createdAt DateTime @default(now()) ++} +``` + + diff --git a/api/prisma/migrations/20201011095227-create-contact/schema.prisma b/api/prisma/migrations/20201011095227-create-contact/schema.prisma new file mode 100644 index 0000000..03189f2 --- /dev/null +++ b/api/prisma/migrations/20201011095227-create-contact/schema.prisma @@ -0,0 +1,37 @@ +datasource DS { + // optionally set multiple providers + // example: provider = ["sqlite", "postgresql"] + provider = "sqlite" + url = "***" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = "native" +} + +model Post { + id Int @id @default(autoincrement()) + title String + body String + createdAt DateTime @default(now()) +} + +model Part { + id Int @id @default(autoincrement()) + title String + description String // markdown string + code String @default("// Welcome to Cascade Studio! Here are some useful functions:\n// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()\n// Box(), Sphere(), Cylinder(), Cone(), Text3D(), Polygon()\n// Offset(), Extrude(), RotatedExtrude(), Revolve(), Pipe(), Loft(),\n// FilletEdges(), ChamferEdges(),\n// Slider(), Button(), Checkbox()\nlet holeRadius = Slider(\"Radius\", 30 , 20 , 40);\nlet sphere = Sphere(50);\nlet cylinderZ = Cylinder(holeRadius, 200, true);\nlet cylinderY = Rotate([0,1,0], 90, Cylinder(holeRadius, 200, true));\nlet cylinderX = Rotate([1,0,0], 90, Cylinder(holeRadius, 200, true));\nTranslate([0, 0, 50], Difference(sphere, [cylinderX, cylinderY, cylinderZ]));\n\nTranslate([-25, 0, 40], Text3D(\"Hi!\"));\n// Don't forget to push imported or oc-defined shapes into sceneShapes to add them to the workspace!") + mainImage String // link to cloudinary + createdAt DateTime @default(now()) + // userId + //likes, comments, reactions +} + +model Contact { + id Int @id @default(autoincrement()) + name String + email String + message String + createdAt DateTime @default(now()) +} diff --git a/api/prisma/migrations/20201011095227-create-contact/steps.json b/api/prisma/migrations/20201011095227-create-contact/steps.json new file mode 100644 index 0000000..0ca4b72 --- /dev/null +++ b/api/prisma/migrations/20201011095227-create-contact/steps.json @@ -0,0 +1,105 @@ +{ + "version": "0.3.14-fixed", + "steps": [ + { + "tag": "CreateModel", + "model": "Contact" + }, + { + "tag": "CreateField", + "model": "Contact", + "field": "id", + "type": "Int", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Contact", + "field": "id" + }, + "directive": "id" + } + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Contact", + "field": "id" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Contact", + "field": "id" + }, + "directive": "default" + }, + "argument": "", + "value": "autoincrement()" + }, + { + "tag": "CreateField", + "model": "Contact", + "field": "name", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Contact", + "field": "email", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Contact", + "field": "message", + "type": "String", + "arity": "Required" + }, + { + "tag": "CreateField", + "model": "Contact", + "field": "createdAt", + "type": "DateTime", + "arity": "Required" + }, + { + "tag": "CreateDirective", + "location": { + "path": { + "tag": "Field", + "model": "Contact", + "field": "createdAt" + }, + "directive": "default" + } + }, + { + "tag": "CreateArgument", + "location": { + "tag": "Directive", + "path": { + "tag": "Field", + "model": "Contact", + "field": "createdAt" + }, + "directive": "default" + }, + "argument": "", + "value": "now()" + } + ] +} \ No newline at end of file diff --git a/api/prisma/migrations/migrate.lock b/api/prisma/migrations/migrate.lock index 299515f..086c06b 100644 --- a/api/prisma/migrations/migrate.lock +++ b/api/prisma/migrations/migrate.lock @@ -3,4 +3,5 @@ 20201009213512-create-posts 20201011043647-create-parts 20201011052155-add-code-to-part -20201011082558-add-code-not-needed-upon-create \ No newline at end of file +20201011082558-add-code-not-needed-upon-create +20201011095227-create-contact \ No newline at end of file diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index 449c8ad..7f4deba 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -27,3 +27,11 @@ model Part { // userId //likes, comments, reactions } + +model Contact { + id Int @id @default(autoincrement()) + name String + email String + message String + createdAt DateTime @default(now()) +} diff --git a/api/src/graphql/contacts.sdl.js b/api/src/graphql/contacts.sdl.js new file mode 100644 index 0000000..c4153b6 --- /dev/null +++ b/api/src/graphql/contacts.sdl.js @@ -0,0 +1,29 @@ +export const schema = gql` + type Contact { + id: Int! + name: String! + email: String! + message: String! + createdAt: DateTime! + } + + type Query { + contacts: [Contact!]! + } + + input CreateContactInput { + name: String! + email: String! + message: String! + } + + input UpdateContactInput { + name: String + email: String + message: String + } + + type Mutation { + createContact(input: CreateContactInput!): Contact + } +` diff --git a/api/src/services/contacts/contacts.js b/api/src/services/contacts/contacts.js new file mode 100644 index 0000000..3481975 --- /dev/null +++ b/api/src/services/contacts/contacts.js @@ -0,0 +1,24 @@ +import { UserInputError } from '@redwoodjs/api' + +import { db } from 'src/lib/db' + + +const validate = (input) => { + if (input.email && !input.email.match(/[^@]+@[^.]+\..+/)) { + throw new UserInputError("Can't create new contact", { + messages: { + email: ['is not formatted like an email address'], + }, + }) + } +} + +export const contacts = () => { + return db.contact.findMany() +} + +export const createContact = ({ input }) => { + + validate(input) + return db.contact.create({ data: input }) +} diff --git a/api/src/services/contacts/contacts.test.js b/api/src/services/contacts/contacts.test.js new file mode 100644 index 0000000..fbbbc1e --- /dev/null +++ b/api/src/services/contacts/contacts.test.js @@ -0,0 +1,9 @@ +/* +import { contacts } from './contacts' +*/ + +describe('contacts', () => { + it('returns true', () => { + expect(true).toBe(true) + }) +}) diff --git a/web/src/Routes.js b/web/src/Routes.js index 0245da0..189095b 100644 --- a/web/src/Routes.js +++ b/web/src/Routes.js @@ -12,6 +12,7 @@ import { Router, Route } from '@redwoodjs/router' const Routes = () => { return ( + diff --git a/web/src/index.css b/web/src/index.css index e69de29..d32ad66 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -0,0 +1,17 @@ + +button, input, label, textarea { + display: block; + outline: none; +} + +label { + margin-top: 1rem; +} + +.error { + color: red; +} + +input.error, textarea.error { + border: 1px solid red; +} diff --git a/web/src/index.js b/web/src/index.js index bc813e8..66c7d22 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -5,11 +5,11 @@ import FatalErrorPage from 'src/pages/FatalErrorPage' import Routes from 'src/Routes' import './scaffold.css' -import './index.css' import 'golden-layout/src/css/goldenlayout-base.css' import 'golden-layout/src/css/goldenlayout-dark-theme.css' import './cascade/css/main.css' import 'monaco-editor/min/vs/editor/editor.main.css' +import './index.css' ReactDOM.render( diff --git a/web/src/layouts/MainLayout/MainLayout.js b/web/src/layouts/MainLayout/MainLayout.js index 8412653..2782e2c 100644 --- a/web/src/layouts/MainLayout/MainLayout.js +++ b/web/src/layouts/MainLayout/MainLayout.js @@ -15,6 +15,9 @@ const MainLayout = ({ children }) => {
  • Parts
  • +
  • + Contact +
  • diff --git a/web/src/pages/ContactPage/ContactPage.js b/web/src/pages/ContactPage/ContactPage.js new file mode 100644 index 0000000..088f0b6 --- /dev/null +++ b/web/src/pages/ContactPage/ContactPage.js @@ -0,0 +1,59 @@ +import { Form, TextField, Submit, TextAreaField, FieldError, FormError } from '@redwoodjs/forms' +import { useMutation, Flash, useFlash } from '@redwoodjs/web' +import MainLayout from 'src/layouts/MainLayout' +import { useForm } from 'react-hook-form' + +const CREATE_CONTACT = gql` + mutation CreateContactMutation($input: CreateContactInput!) { + createContact(input: $input) { + id + } + } +` + +const ContactPage = () => { + const formMethods = useForm() + const { addMessage } = useFlash() + const [create, {loading, error}] = useMutation(CREATE_CONTACT, { + onCompleted: () => { + addMessage('Thank you for your submission!', { + style: { backgroundColor: 'green', color: 'white', padding: '1rem' } + }) + formMethods.reset() + }, + }) + const onSubmit = async (data) => { + try { + await create({ variables: { input: data } }) + } catch (error) { + console.log(error) + } + } + + return ( + + +
    + + + + + + + + + + + + + + Save + +
    + ) +} + +export default ContactPage diff --git a/web/src/pages/ContactPage/ContactPage.stories.js b/web/src/pages/ContactPage/ContactPage.stories.js new file mode 100644 index 0000000..0894c0b --- /dev/null +++ b/web/src/pages/ContactPage/ContactPage.stories.js @@ -0,0 +1,7 @@ +import ContactPage from './ContactPage' + +export const generated = () => { + return +} + +export default { title: 'Pages/ContactPage' } diff --git a/web/src/pages/ContactPage/ContactPage.test.js b/web/src/pages/ContactPage/ContactPage.test.js new file mode 100644 index 0000000..d31f442 --- /dev/null +++ b/web/src/pages/ContactPage/ContactPage.test.js @@ -0,0 +1,11 @@ +import { render } from '@redwoodjs/testing' + +import ContactPage from './ContactPage' + +describe('ContactPage', () => { + it('renders successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) +}) From c16e1c7d8994531fdba0f7727771ce3ae648fa14 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Mon, 12 Oct 2020 19:21:38 +1100 Subject: [PATCH 8/9] move posts into admin route --- web/src/Routes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/Routes.js b/web/src/Routes.js index 189095b..caa1a27 100644 --- a/web/src/Routes.js +++ b/web/src/Routes.js @@ -18,10 +18,10 @@ const Routes = () => { - - - - + + + + From e8f694587c154e9ae1adbf1f3f50fc1c2f8db5b6 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Mon, 12 Oct 2020 19:26:12 +1100 Subject: [PATCH 9/9] deploy changes for netlify --- netlify.toml | 12 ++++++++++++ redwood.toml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 netlify.toml diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..a16d760 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,12 @@ +[build] +command = "yarn rw build && yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up" +publish = "web/dist" +functions = "api/dist/functions" + +[dev] + command = "yarn rw dev" + +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 diff --git a/redwood.toml b/redwood.toml index 1001684..4022418 100644 --- a/redwood.toml +++ b/redwood.toml @@ -7,7 +7,7 @@ [web] port = 8910 - apiProxyPath = "/.redwood/functions" + apiProxyPath = "/.netlify/functions" [api] port = 8911 [browser]