Giter VIP home page Giter VIP logo

opencascade.js-examples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

opencascade.js-examples's Issues

why using "async" before openCascade

Hello! In all of those examples, I found an "async" keywords before some functions like below:

async openCascade => {...}

So. Why are you doing this? To make sure the return value is a Promise ?

VisualStudioCode debugging

Hi, I am trying to debug this repo when opened in the Visual Studio Code.
I cannot get the VS code debugger to attach to the running examples in the browser.
Here is my launch.json:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "pwa-chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:9000", "webRoot": "${workspaceFolder}" } ] }

Could anyone point me into the direction that would enable debugging of this repo ?
Thanks in advance ! :)

Errors in

Hello!
I try to test you example exactly how it is in this example (the same file structure) and generate the following errors message:

PS D:\OpenCascade.js_teste\00> npm start

[email protected] start
webpack serve

i 「wds」: Project is running at http://localhost:9000/
i 「wds」: webpack output is served from undefined
i 「wds」: Content not from webpack is served from D:\OpenCascade.js_teste\00\src
i 「wdm」: wait until bundle finished: /
× 「wdm」: assets by status 65.5 MiB [cached] 5 assets
orphan modules 1.51 MiB [orphan] 9 modules
runtime modules 1.26 KiB 9 modules
modules by path ./node_modules/ 330 KiB
  modules by path ./node_modules/webpack-dev-server/client/ 20.9 KiB 10 modules
  modules by path ./node_modules/html-entities/lib/*.js 58.1 KiB 4 modules
  modules by path ./node_modules/webpack/hot/ 1.58 KiB 3 modules
  modules by path ./node_modules/url/ 37.4 KiB 3 modules
  modules by path ./node_modules/querystring/*.js 4.51 KiB
    ./node_modules/querystring/index.js 127 bytes [built] [code generated]
    ./node_modules/querystring/decode.js 2.34 KiB [built] [code generated]
    ./node_modules/querystring/encode.js 2.04 KiB [built] [code generated]
modules by path ./src/demos/ 4.51 MiB
  ./src/demos/bottle - basic/index.js + 7 modules 1.5 MiB [built] [code generated]
  ./src/demos/bottle - visualize/index.js + 8 modules 1.51 MiB [built] [code generated]
  ./src/demos/polygon/index.js + 8 modules 1.5 MiB [built] [code generated]

WARNING in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:59916-59933
Module not found: Error: Can't resolve 'crypto' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

ERROR in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:1147-1170
Module not found: Error: Can't resolve 'path' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

ERROR in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:1288-1301
Module not found: Error: Can't resolve 'fs' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

webpack 5.10.3 compiled with 2 errors and 1 warning in 9041 ms
i 「wdm」: Failed to compile.

As you can see from above , it seems that

"scripts": {
    "start": "webpack-dev-server",
...
} 

is not actual anymore, I must use webpack serve as below:

"scripts": {
    "start": "webpack serve",
..
}

It is possible to update the examples with the latest updated npm packages?
Also, loading your live example posted here, with the last version of Microsoft Edge, I can not import a STEP file - no 3d part is loading. Any help is welcome!!
Thank you very much!

`Face` has been removed from ThreeJS in R125

See this post.

The openCascadeHelper.js would need to refactored to account for this, so that upgrading to recent ThreeJS versions becomes possible again.

Alternatively, we could eliminate openCascadeHelper.js alltogether and instead utilize OpenCascade's RWGltf_CafWriter to export a GLB file, which could then be loaded without having to worry about low-level tessellation extraction code.

It might be good to have example code for both approaches, though.

the memory issues

  1. From my system monitor, I find the memory usage by the browser will keep increasing everytime after I refresh the page when running the 'bottle example' .
  2. The tesselate function doesn't release memory. for example, adding the code below to a bottle example:
  let i = 0
  while(i < 10000){
    scene.remove(scene.getObjectByName("shape"));
    await addShapeToScene(openCascade, bottle, scene);
    i ++
    console.log('i=', i)
  }

On my compute, after added those code, the memory usage will keep increasing in both of the bottle example. And the page will throw a error when the values of the i is around 1440.

unable to run beta version in chrome when close the dev-tool

hello ! It's very strange in my situation.
When I keep the dev-tool window of chrome closing, and the bottle example didn't work. After that, I can find these message in the console if I open (press F12) the dev-tool again:

Uncaught (in promise) RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (webpack://opencascade.js-examples/./node_modules/opencascade.js/dist/opencascade.js?:15:17694)
    at _abort (webpack://opencascade.js-examples/./node_modules/opencascade.js/dist/opencascade.js?:15:187306)
    at _Znwm (http://localhost:9000/wasm/044249d6ecbb27731cad7e42d6ecf0f4.wasm:wasm-function[9813]:0x41a075)
    at _Znam (http://localhost:9000/wasm/044249d6ecbb27731cad7e42d6ecf0f4.wasm:wasm-function[9814]:0x41a081)
    at _ZN12ChFiDS_Spine4LoadEv (<anonymous>:wasm-function[27506]:0x1bc5fe4)
    at _ZN17ChFi3d_FilBuilder3AddERK11TopoDS_Edge (<anonymous>:wasm-function[27837]:0x1c2846f)
    at _ZN24BRepFilletAPI_MakeFillet3AddEdRK11TopoDS_Edge (<anonymous>:wasm-function[28691]:0x1cf59b7)
    at _ZN10emscripten8internal13MethodInvokerIM20BlendFunc_CSCircularFvdiEvPS2_JdiEE6invokeERKS4_S5_di (<anonymous>:wasm-function[2946]:0x122b53b)
    at BRepFilletAPI_MakeFillet$Add_2 [as Add_2] (eval at new_ (webpack://opencascade.js-examples/./node_modules/opencascade.js/dist/opencascade.js?), <anonymous>:11:1)
    at makeBottle (webpack://opencascade.js-examples/./src/demos/bottle_-_basic/library.js?:146:14)

Or some times, I saw these message:

RuntimeError: memory access out of bounds
    at _ZNK12BRep_Builder5RangeERK11TopoDS_Edgeddb (<anonymous>:wasm-function[16678]:0xe2dad2)
    at _ZN16BRepLib_MakeEdge4InitERKN11opencascade6handleI10Geom_CurveEERK13TopoDS_VertexS8_dd (<anonymous>:wasm-function[18874]:0x16290b5)
    at _ZN16BRepLib_MakeEdge4InitERKN11opencascade6handleI10Geom_CurveEEdd (<anonymous>:wasm-function[18878]:0x16296bb)
    at _ZN16BRepLib_MakeEdgeC2ERKN11opencascade6handleI10Geom_CurveEE (<anonymous>:wasm-function[18902]:0x162ac2a)
    at _ZN23BRepBuilderAPI_MakeEdgeC2ERKN11opencascade6handleI10Geom_CurveEE (<anonymous>:wasm-function[19445]:0x165b62a)
    at <anonymous>:wasm-function[3213]:0x122de9f
    at _ZN10emscripten8internal7InvokerIP27BOPAlgo_AlertBadPositioningJRK12TopoDS_ShapeEE6invokeEPFS3_S6_EPS4_ (<anonymous>:wasm-function[1951]:0x1220aa2)
    at BRepBuilderAPI_MakeEdge_24.constructor_body (http://localhost:3005/occScript.worker.worker.js:10703:31)
    at BRepBuilderAPI_MakeEdge_24.<anonymous> (http://localhost:3005/occScript.worker.worker.js:10490:23)
    at new BRepBuilderAPI_MakeEdge_24 (eval at createNamedFunction (http://localhost:3005/occScript.worker.worker.js:9516:14), <anonymous>:4:34)

But! if I run the bottle examples and keep the dev-tools openning of chrome, then everythings just works fine.
And, in my firefox browser, everythings just works fine in any situation.

I am using a fedora 30 system and my chrome version is 89.0.4389.90 (Official Build) (64-bit)

opencascade.js version: 2.0.0-beta.2b27f74

And there is no problem when using opencascade.js 1.1.1 on my fedora.

beta branch error

hello ! when I am trying to run this example in beta branch, it shows a error:
"mainJS is not a constructor"

What is the "mainJS" supposed to be in beta version ?

BRepTools, read a brep file

Hello.
I'm doing some test in the java script wrapper and I'd like to open a brep file that I've created in the python wrapper. I can open it in python and CAD Assistant so i think that the file is ok.
In js I'm trying to:

      const stepShape = new oc.TopoDS_Shape();
      const builder = new oc.BRep_Builder();
      const reader = oc.BRepTools.Read_2(stepShape,"myShape.brep",new oc.BRep_Builder(),new oc.Message_ProgressRange_1());

But my stepShape always is empty. What I'm doing wrong?
Thanks

Casting Handle_Geom_BSplineCurve down to Handle_Geom_Curve

Hey guys, amazing effort, thanks a lot for making this happen, it's groundbreaking for web based CAD ecosystem!

I've started adding some experimental features to my platform based on OCC by following your examples and got stuck with something super basic, or so I thought...

I'm using v1.1.4 of opencascade.js and so far everything worked fine, I have basic solids drawn in our babylonjs based app, but I began implementing BSpline method, this is an excerpt from the code:

const geomCurveHandle = new occ.GeomAPI_PointsToBSpline_2(ptList, 3, 8, occ.GeomAbs_Shape.GeomAbs_C2, 1.0e-3).Curve();
const edge = new occ.BRepBuilderAPI_MakeEdge_24(geomCurveHandle).Edge();
return new occ.BRepBuilderAPI_MakeWire_1(edge).Wire();

and I get the following exception

Expected null or instance of Handle_Geom_Curve, got an instance of Handle_Geom_BSplineCurve

How do I DownCast the handle type in javascript from BSplineCurve to Curve? Any tip would be appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.