prolincur / three-dxf-loader

Cross platform DXF file loader for THREE.js and react-three-fiber
https://www.npmjs.com/package/three-dxf-loader
MIT License
40 stars 9 forks source link

Loading Errors #23

Open lucas-vitrus opened 7 months ago

lucas-vitrus commented 7 months ago

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
lucas-vitrus commented 7 months ago

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} />;
};
lucas-vitrus commented 7 months ago

I'm still having other types of errors:

image
vasco3 commented 5 months ago

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

Hastu004 commented 4 months ago

i have this problem

image image
vasco3 commented 4 months ago

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

yskills commented 1 month ago

Hey i also have the "Unsupported Entity Type: ATTDEF" problem did anyone find a solution or a work around for it?

vasco3 commented 1 month ago

@yskills i haven't upgraded yet. Waiting for a fix