Open lucas-vitrus opened 10 months ago
import { FontLoader } from "three/examples/jsm/loaders/FontLoader";
//@ts-ignore
import { DXFLoader } from "three-dxf-loader";
interface DFXObjectProps {
url: string;
}
const fontLoader = new FontLoader();
const DFXObject = (props: DFXObjectProps) => {
const group = new THREE.Group();
fontLoader.load("/fonts/helvetiker_regular.typeface.json", (font) => {
const loader = new DXFLoader();
loader.setFont(font); //<< Solved one of the issues related to Text
const onLoad = (data: any) => {
if (data && data.entities) {
data.entities.forEach((ent: any) => group.add(ent));
}
};
const onError = (error: any) => {
console.error(error);
};
const onProgress = (xhr: any) => {
console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
};
loader.load(props.url, onLoad, onProgress, onError);
});
return <primitive object={group} />;
};
I'm still having other types of errors:
I'm getting this error
⚠ ../../node_modules/.pnpm/three-dxf-loader@5.0.0_three@0.163.0/node_modules/three-dxf-loader/dist/three-dxf-loader.js
Attempted import error: 'TextGeometry' is not exported from 'three' (imported as 'e').
Import trace for requested module:
../../node_modules/.pnpm/three-dxf-loader@5.0.0_three@0.163.0/node_modules/three-dxf-loader/dist/three-dxf-loader.js
using
i have this problem
it is breaking my next.js build when i upgrade this lib from v5 to v5.1 The error is about not finding the import font-loader. I think it is because now the FontLoader is in another path within threejs
https://threejs.org/docs/index.html?q=fontlo#examples/en/loaders/FontLoader
import { FontLoader } from 'three/addons/loaders/FontLoader.js';
Hey i also have the "Unsupported Entity Type: ATTDEF" problem did anyone find a solution or a work around for it?
@yskills i haven't upgraded yet. Waiting for a fix
I got these errors repetitively when using with r3f, while loading the sample .dxf file on this repo: