Skip to content

Commit ee77bf8

Browse files
update to v0.9.16 bitbybit-core to latest version for laptop react example
1 parent 20330e0 commit ee77bf8

File tree

10 files changed

+116
-41
lines changed

10 files changed

+116
-41
lines changed

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
1-
# app-examples
2-
App examples that use bitbybit-core npm package to build custom CAD websites.
1+
# Bit By Bit Developers App Examples
2+
These app examples are meant to show how bitbybit-core and bitbybit-occt npm packages can be used to create 3D models on the browser and on the server.
3+
bitbybit-core library works only on the browser and is dependant on many great 3D libraries. bitbybit-occt library is much more versatile and can be used both on the nodejs and browser applications.
4+
5+
Visit https://bitbybit.dev to use our full cloud platform.
6+
7+
# App Example Frameworks
8+
For browser based applications we provide few examples using bitbybit-core library by using most popular frameworks such as React and Angular. For Node based applications we provide express server app example and a simple node example.
9+
10+
# Github
11+
https://github.com/bitbybit-dev/app-examples
12+
13+
# NPM
14+
CORE
15+
https://www.npmjs.com/package/bitbybit-core
16+
OCCT
17+
https://www.npmjs.com/package/bitbybit-occt
18+
19+
# Example Applications
20+
Laptop Holder
21+
https://app-store.bitbybit.dev/laptop-holder
22+
Github Source Code Angular - https://github.com/bitbybit-dev/app-examples/tree/main/angular/laptop-holder
23+
Github Source Code React - https://github.com/bitbybit-dev/app-examples/tree/main/react/laptop-holder
24+
25+
Cup Configurator
26+
https://app-store.bitbybit.dev/cup
27+
Github Source Code - https://github.com/bitbybit-dev/app-examples/tree/main/react/cup
28+
29+
Other Closed Source Apps We Built
30+
Terrace Furniture
31+
https://app-store.bitbybit.dev/terrace-furniture
32+
33+
# Build package
34+
tsc -p tsconfig.bitbybit.json
35+
36+
# Media Channels
37+
Discord: https://discord.gg/GSe3VMe
38+
Youtube: https://www.youtube.com/channel/UCWM0VODRsLYOjB2IAaFHBSQ
39+
Instagram: https://www.instagram.com/bitbybit.dev
40+
Twitter: https://twitter.com/bitbybit_dev
41+
LinkedIn: https://lnkd.in/gQjEQA2
42+
Facebook: https://www.facebook.com/bitbybitdev
43+
Medium: https://bitbybit-dev.medium.com/
44+
45+
# Principles
46+
Bit By Bit Developers company will keep these core algorithms that you can find in this repository free and opensource for its users. These algorithms are based on other open-source projects, run and are deployed on the browser, thus there is no point of closing them down from public.
47+
48+
# About Bit By Bit Developers platform
49+
Bit By Bit Developers web platform allows creators to program geometry through simple visual programming language or choose monaco typescript editor with full intellisense of bitbybit API. This cloud platform can fulfil many practical, educational and artistic needs of its users. Through familiar programming interface used in tools such as Scratch and Blockly.Games we expose powerful 3D algorithms that make it easier to implement various parametric tasks. Our goal is to make it very simple for users to share their ideas and designs. We want to encourage everyone to engage in the future of this tool.
50+
51+
# Major Dependencies
52+
BabylonJS, Blockly, OpenCascade, JSCAD, Verbnurbs

angular/laptop-holder/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular/laptop-holder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@angular/platform-browser": "13.3.0",
2020
"@angular/platform-browser-dynamic": "13.3.0",
2121
"@angular/router": "13.3.0",
22-
"bitbybit-core": "0.9.12",
22+
"bitbybit-core": "0.9.16",
2323
"rxjs": "7.5.5",
2424
"tslib": "2.3.1",
2525
"zone.js": "0.11.5"

react/cup/package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react/cup/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react-scripts": "5.0.1",
1717
"typescript": "^4.6.2",
1818
"web-vitals": "^2.1.4",
19-
"bitbybit-core": "0.9.15",
19+
"bitbybit-core": "0.9.16",
2020
"file-loader": "6.2.0",
2121
"@mui/icons-material": "5.6.2",
2222
"@mui/material": "5.6.4",

react/laptop-holder/config-overrides.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@ module.exports = {
2020
crypto: false,
2121
stream: false
2222
}
23-
23+
//this is needed for the bitbybit-occt modules
24+
config.module.rules.push({
25+
test: /\.m?js/,
26+
type: "javascript/auto",
27+
})
28+
config.module.rules.push({
29+
test: /\.m?js/,
30+
resolve: {
31+
fullySpecified: false,
32+
},
33+
})
2434
return config;
2535
},
2636
};

react/laptop-holder/package-lock.json

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react/laptop-holder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react-scripts": "5.0.1",
1717
"typescript": "^4.6.2",
1818
"web-vitals": "^2.1.4",
19-
"bitbybit-core": "0.9.12",
19+
"bitbybit-core": "0.9.16",
2020
"file-loader": "6.2.0",
2121
"@mui/icons-material": "5.6.2",
2222
"@mui/material": "5.6.4",

react/laptop-holder/src/laptop.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { BitByBitBase, Base, BabylonScene, Draw } from "bitbybit-core";
2-
import { OCCT } from "bitbybit-core/lib/api/inputs/occ-inputs";
2+
import * as Inputs from "bitbybit-core/lib/api/inputs";
3+
import { OCCT } from "bitbybit-core/lib/api/bitbybit/occt/occt";
34
export class LaptopLogic {
45

56
private bitbybit: BitByBitBase;
7+
private occt;
68

79
private laptops: Laptop[] = [
810
{
@@ -34,6 +36,7 @@ export class LaptopLogic {
3436

3537
constructor(bitbybit: BitByBitBase) {
3638
this.bitbybit = bitbybit;
39+
this.occt = bitbybit.occt as OCCT;
3740
}
3841

3942
async renderLaptops(laptops) {
@@ -68,27 +71,27 @@ export class LaptopLogic {
6871
const laptopVisFillet = await this.bitbybit.occt.fillets.filletEdges({ shape: laptopVisModel, radius: 0.2 });
6972
laptopFillets.push(laptopFillet);
7073

71-
const di = new OCCT.DrawShapeDto(laptopVisFillet);
74+
const di = new Inputs.OCCT.DrawShapeDto(laptopVisFillet);
7275
di.faceOpacity = 0.2;
7376
di.edgeWidth = 5;
7477
di.edgeOpacity = 0.6;
7578
di.edgeColour = this.whiteColor;
7679
di.faceColour = this.whiteColor;
77-
const laptopFilletMesh = await this.bitbybit.occt.drawShape(di);
80+
const laptopFilletMesh = await this.occt.drawShape(di);
7881
this.laptopsFilletsMesh.push(laptopFilletMesh);
7982
})
8083

81-
const polygonWire = await this.bitbybit.occt.shapes.wire.createPolygonWire({
84+
const polygonWire = await this.occt.shapes.wire.createPolygonWire({
8285
points: this.controlPoints
8386
});
84-
const extrusion = await this.bitbybit.occt.operations.extrude({
87+
const extrusion = await this.occt.operations.extrude({
8588
shape: polygonWire, direction: [0, 0, totalDistance += this.distanceBetweenLaptops + previousLaptopLength / 2]
8689
});
87-
const laptopStandFillet = await this.bitbybit.occt.fillets.filletEdges({ shape: extrusion, radius: 1 });
88-
const laptopStandThick = await this.bitbybit.occt.operations.makeThickSolidSimple({ shape: laptopStandFillet, offset: -0.5 });
90+
const laptopStandFillet = await this.occt.fillets.filletEdges({ shape: extrusion, radius: 1 });
91+
const laptopStandThick = await this.occt.operations.makeThickSolidSimple({ shape: laptopStandFillet, offset: -0.5 });
8992

90-
this.laptopStand = await this.bitbybit.occt.booleans.difference({ shape: laptopStandThick, shapes: laptopFillets, keepEdges: false });
91-
const li = new OCCT.DrawShapeDto(this.laptopStand);
93+
this.laptopStand = await this.occt.booleans.difference({ shape: laptopStandThick, shapes: laptopFillets, keepEdges: false });
94+
const li = new Inputs.OCCT.DrawShapeDto(this.laptopStand);
9295
li.faceOpacity = 1;
9396
li.faceColour = this.holderColor;
9497
li.edgeColour = this.whiteColor;
@@ -129,7 +132,7 @@ export class LaptopLogic {
129132
}
130133

131134
downloadStl() {
132-
this.bitbybit.occt.io.saveShapeStl({ shape: this.laptopStand, filename: 'laptop-stand', precision: 0.001, adjustYtoZ: false });
135+
this.occt.io.saveShapeStl({ shape: this.laptopStand, filename: 'laptop-stand', precision: 0.001, adjustYtoZ: false });
133136
}
134137

135138
async render(laptops: Laptop[]) {

react/laptop-holder/src/occ.worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference lib="webworker" />
22
/*eslint no-restricted-globals: 0*/
3-
import initOpenCascade from 'bitbybit-core/bitbybit-dev-occt';
4-
import { OpenCascadeInstance } from 'bitbybit-core/bitbybit-dev-occt/bitbybit-dev-occt.js';
3+
import initOpenCascade from 'bitbybit-occt/bitbybit-dev-occt';
4+
import { OpenCascadeInstance } from 'bitbybit-occt/bitbybit-dev-occt/bitbybit-dev-occt.js';
55
import { initializationComplete, onMessageInput } from 'bitbybit-core/lib/workers/occ/occ-worker';
66

77
initOpenCascade().then((occ: OpenCascadeInstance) => {

0 commit comments

Comments
 (0)