How to install MeshWriter with npm ?
@TheLeftover
NineCurrent, right now it is not an npm package. Sorry.
If your timeframe is more than a couple weeks I would be happy to set that up. I have thought about it before but I guess I needed a request to galvanize me.
Would that be valuable?
I can wait for any week and that would be really helpful.
I am very happy to galvanize you to do this.
NineCurrent, it is now available.
This is the first time I have done this, so please feel free to suggest improvements.
NOW IT WORKS!
Hey everyone, meshwriter-1.0.3 on NPM, did not work for me. Sorry for any inconvenience.
meshwriter-1.1.0 on NPM seems fine. Sorry for the inconvenience. Still learning.
Hey @TheLeftover thank you very much I will try it this week.
I try it but I donât no how to import.
I try import with "import âmeshwriterâ " and "import * as MeshWriter from âmeshwriterâ " but it doesnât work
I use webpack
Error : Uncaught TypeError: babylonjs__WEBPACK_IMPORTED_MODULE_0__.MeshWriter is not a function
NineCurrent,
Can you tell me a little bit more about your setup?
For most browser applications, I donât recommend using the whole NPM setup. You only need one file. If you use the NPM install, it is ânode_modules/meshwriter/dist/meshwriter.min.jsâ. You may find it easier just to grab the same file from âhttps://sanfrancisco.ca.illuminated.city/js/meshwriter.min.jsâ. That is the reference that all the playgrounds use. I commit to keeping those up to date and current with each other. The same file, BTW, is also in my meshwriter github repository. GitHub - briantbutton/meshwriter: Babylon Mesh Writer
That file, meshwriter.min.js, should be able to be imported using âimportâ, a direct link in the html code or other normal methods. If it isnât, please give me details of your setup.
This is a good time to remind you that you need âearcutâ too. Easy peasy. See the documentation under my github repo. The earcut file is there too, if you need it.
npm i meshwriter
and add earcut inindex.html
<script src="https://preview.babylonjs.com/earcut.min.js"></script>
Then you can use it like
import * as MeshWriter from "meshwriter";
let Writer = new MeshWriter(scene, { scale: 0.1, defaultFont: "Arial" });
let text1 = new Writer(
"Blah Blah",
{
"anchor": "center",
"letter-height": 100,
"color": "#1C3870",
"position": {
"x": 0,
"y":4,
"z":5
},
"letter-thickness":2,
}
);
As of today, a new version (1.2.3) is out that incorporates Earcut. So that should no longer be required.
I have problem integrating MeshWriter into Angular typescript project. I am doing it like @HiteshSahu, but i got following error:
BABYLON.StandardMaterial is not a constructor
at c (meshwriter.min.js:7)
at new MeshWriter (meshwriter.min.js:7)
I donât have BABYLON namespace at all.