MeshWriter integration in Angular+Babylon project

Hi @TheLeftover,

I’ve tested it and it’s tiptop! :ok_hand:

I’ve pushed the new version of our app to our dev environment so you can see the result, you’re powering the compass cardinal points at The Iveria, 3bedroom, D9, 2020. Thank you!

For others who may want to do this, you could save them a bit of research by sharing the tree shakable imports needed in the README. They go as below:

import { Vector3, Vector2, Path2, Curve3, Color3 } from '@babylonjs/core/Maths/math'
import { Mesh } from '@babylonjs/core/Meshes/mesh'
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial'
import { SolidParticleSystem } from '@babylonjs/core/Particles/solidParticleSystem'
import { PolygonMeshBuilder } from '@babylonjs/core/Meshes/polygonMesh'
import { CSG } from '@babylonjs/core/Meshes/csg'
import MeshWriter from 'meshwriter'

const babylonMethods = {
  Vector2,
  Vector3,
  Path2,
  Curve3,
  Color3,
  SolidParticleSystem,
  PolygonMeshBuilder,
  CSG,
  StandardMaterial,
  Mesh
}

const Writer = MeshWriter(scene, { methods: babylonMethods })

Thanks again and cheers.

2 Likes

Very good looking site! Loaded fast too.

Thanks for doing the testing. I will poke at it a bit more, for sanity tests, the do all the back end documenting and publishing.

2 Likes

Thanks :slight_smile:. Feel free to ping me here if you want to test some further changes.

Thank you all for this.
Unfortunatly, I found a new error on BabylonJs v5.29.0 when calling MeshWriter with methodsObj specified as mentioned @tibotiber above.

SOLUTION : I solved the problem by editing line 64 of meshwriter.js

return csgShape.toMesh("Net-"+letter+i+"-"+weeid(), null, scene)
//just add 2 more params: null and scene

The error I got before :
image

I’m using BabylonJs with es6 classes, so for those it could be usefull :slight_smile:

2 Likes

Darius, thank you. I have incorporated that change into the repositories at Babylon Extensions and also at briantbutton/meshwriter. I updated the NPM module to boot.

It might be worth loading it from one of those sources and checking to see if my changes matched yours.

Thank you for a very complete remedy.

2 Likes

I just got the new version from ‘‘npm i meshwriter’’, and it works fine.

Some may be confuse by error saying Mesh is required, just be aware of adding ‘‘Mesh’’ in ‘‘methodsObj’’ and not ‘‘Meshbuilder’’ in the required methods. I made same error :grin:

Well done @TheLeftover

2 Likes