wangerzi / 3d-model-convert-to-gltf

Convert 3d model (STL/IGES/STEP/OBJ/FBX) to gltf and compression
Apache License 2.0
247 stars 48 forks source link

Error when trying out the docker image or the `convert.sh` script #10

Open maxime1992 opened 2 years ago

maxime1992 commented 2 years ago

I just tried running the following:

./convert.sh stp ./assets/test.stp outputpath.gltf

and I get the following error:

ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['python', '/opt/3d-model-convert-to-gltf/server/convert.py', 'stp', '/home/maxime/Downloads/step/3d-model-convert-to-gltf/assets/test.stp', '/home/maxime/Downloads/step/3d-model-convert-to-gltf/outputpath.gltf']' command failed.  (See above for error)
Traceback (most recent call last):
  File "/opt/3d-model-convert-to-gltf/server/convert.py", line 33, in <module>
    main()
  File "/opt/3d-model-convert-to-gltf/server/convert.py", line 20, in main
    out_convert_gltf_path = Convert.convert_by_type(sys.argv[1], os.path.abspath(sys.argv[2]), is_bin)
  File "/opt/3d-model-convert-to-gltf/server/service/Convert.py", line 219, in convert_by_type
    result = model.handler(file_path, is_bin)
TypeError: handler() missing 1 required positional argument: 'need_draco'

Am I missing something?

paul-sudo commented 2 years ago

I noticed while testing that docker pull wj2015/3d-model-convert-to-gltf:latest is not using the latest version, but an older one. I was able to fix the problem by copying the latest version from the repository (master branch) to the Docker container.

stellar-creator commented 2 years ago

I have the same problem - I get "TypeError: handler() missing 1 required positional argument: 'need_draco'" in the terminal

HorizonsQT commented 1 year ago

The bug was fixed https://github.com/wangerzi/3d-model-convert-to-gltf/issues/12, but the bug free verison docker image yet been uploaded.

In my case, I use command mode.

I fix this problem by changing the content of the convert.sh file, and it works well for me:

  1. Download the updated Convert.py file in the local path (keep it in the same dir with convert.sh)
  2. Update the convert.sh file with the content below:

inputPath=$( cd "$(dirname "$2")" pwd ) inputFile=$inputPath/`basename $2` outPath=$( cd "$(dirname "$3")" pwd ) outFile=$outPath/`basename $3` docker run -v $inputPath:$inputPath -v $outPath:$outPath --name stp-to-gltf wj2015/3d-model-convert-to-gltf:v1.6 docker cp Convert.py stp-to-gltf:/opt/3d-model-convert-to-gltf/server/service/Convert.py docker exec -it stp-to-gltf /bin/bash -c "cd $inputPath && conda run -n pythonocc python /opt/3d-model-convert-to-gltf/server/convert.py $1 $inputFile $outFile $4"

  1. Make sure to set the convert.sh permission , then launch the file by using (in my case MacOS) sh convert.sh stp test.stp test.gltf
  2. Enjoy !
xianshun163 commented 1 year ago

I follow this method, transfer the test.stp to test.gltf . But when I use the tree.js to open the test.gltf,It can not get the model.

goggle555 commented 1 year ago

I had the same problem, but I was able to fix it by changing the container' tag in convert.sh.

Before: https://github.com/wangerzi/3d-model-convert-to-gltf/blob/93c421d4f34620258f47c2cd46920418a717a9c9/convert.sh#L14

After:

docker run -v $inputPath:$inputPath -v $outPath:$outPath wj2015/3d-model-convert-to-gltf:v1.7 /bin/bash -c "cd $inputPath && conda run -n pythonocc python /opt/3d-model-convert-to-gltf/server/convert.py $1 $inputFile $outFile $4"

Changing container's tag from v1.6 to v1.7. v1.7 is available on docker hub :) https://hub.docker.com/r/wj2015/3d-model-convert-to-gltf/tags