prolincur/three-dxf-loader

Loading Errors

Opened this issue · 5 comments

I got these errors repetitively when using with r3f, while loading the sample .dxf file on this repo:

image
three-dxf-loader.js?v=c58e8641:4786 Text is not supported without a Three.js font loaded with THREE.FontLoader! Load a font of your choice and pass this into the constructor. See the sample for this repository or Three.js examples at http://threejs.org/examples/?q=text#webgl_geometry_text for more details.
Unsupported Entity Type: ATTDEF

Font problem solved (based on documentation)

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:

image

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

  • pnpm 8.15.7
  • "three-dxf-loader": "^5.0.0",
  • "three-stdlib": "^2.29.6",
  • "three": "^0.163.0",
  • "react": "18.2.0",
  • "next": "14.2.1", // seems like it started happening in this next.js version

i have this problem
image

image

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';