Code Monkey home page Code Monkey logo

Comments (17)

jmwright avatar jmwright commented on September 26, 2024

I forgot to check the JavaScript console. Let me do that before you spend any time on this issue.

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

It actually watches a directory for any changes to .py files, so ./server -d working_directory , also if you run a script with display(object) in it the server will display it.

Still very much pre-alpha , but keep the issues coming if you are using it.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

Ah, ok. I didn't realize it had to be run against a directory.

Still very much pre-alpha

Understood. Thanks for putting this out there. Multiple CadQuery community members have hacked together their own variations enabling this type of workflow. I was curious how it works.

but keep the issues coming if you are using it.

This is the first time I've ever touched Go, so filing issues is probably all I'm good for. Probably won't be able to do any code contributions.

There are sections of the viewer in cadquery-gui that you might want to take a look at to see if they can be reused.

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

thanks @jmwright will investigate and pilfer code as needed. :)

My intent is to have a development helper and a catalogue explorer to start and going into the future a cache proxy for cqparts (and friends).

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

@jmwright also check out https://github.com/zignig/cqparts-bucket for some of the messing about I have done with cqparts ( and the awesome of CadQuery ) , looking forward to the pythonOCC transmogrification. Willing to assist on that, we should get @tpaviot on board for the transition.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

It actually watches a directory for any changes to .py files, so ./server -d working_directory , also if you run a script with display(object) in it the server will display it.

Hmm, still not working for me. I have my environment(s) set up in weird ways because of the FreeCAD module development, so that's probably the issue. However, due to #2 I can't seem to figure out what the errors are.

also check out https://github.com/zignig/cqparts-bucket for some of the messing about I have done with cqparts ( and the awesome of CadQuery )

Cool. I noticed your pizero script. I'm assuming that's a Raspberry Pi Zero?

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

It is a Rasberry Pi Zero and a basic arduino , I'm making a case that will alter itself based on the board.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

There's an issue when the FreeCAD module is installed and this server is used. When FreeCAD starts up it runs Init.py for each of the workbenches it finds. The CadQuery module manipulates sys.path to load its libs, and so when a file is saved and cqparts-server loads FreeCAD, the server starts looking at the module's embedded version of cqparts. The module doesn't include the web rendering templates or anything else related to the web view because it doesn't need it. I can add those components in, but then the user may not be aware of which version of cqparts they're running. I may just have to move the sys.path manipulation into InitGui.py, which isn't called until someone actually selects the CadQuery workbench.

Anyway, I still get this error after doing pip install cqparts in the terminal, even after I uninstall the CadQuery module.

/home/jwright/Downloads/cqparts_demo/ /home/jwright/Downloads/cqparts_demo/test.py
FreeCAD 0.17, Libs: 0.17R13522 (Git)
Traceback (most recent call last):
  File "/home/jwright/Downloads/cqparts_demo/test.py", line 2, in <module>
    from cqparts.display import display
ImportError: No module named cqparts.display
 exit status 1

If I fire up a Python console and try that import in the virtual environment, it works fine. The FreeCAD module can also use display just fine.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

If I strip the /usr/bin from this line I get further, but I still get an error.

/home/jwright/Downloads/cqparts_demo/ /home/jwright/Downloads/cqparts_demo/test.py
FreeCAD 0.17, Libs: 0.17R13522 (Git)
host temp folder: /tmp/tmpCOoCED/html
Traceback (most recent call last):
  File "/home/jwright/Downloads/cqparts_demo/test.py", line 14, in <module>
    display(cube)
  File "/home/jwright/Downloads/cqparts-server/src/server/cqpartsenv/local/lib/python2.7/site-packages/cqparts/display/__init__.py", line 31, in display
    web_display(component)
  File "/home/jwright/Downloads/cqparts-server/src/server/cqpartsenv/local/lib/python2.7/site-packages/cqparts/display/web.py", line 94, in web_display
    shutil.copytree(TEMPLATE_CONTENT_DIR, host_dir)
  File "/usr/lib/python2.7/shutil.py", line 185, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/home/jwright/Downloads/cqparts-server/src/server/cqpartsenv/local/lib/python2.7/site-packages/cqparts/display/web-template'
 exit status 1

I don't see a separate package for the web display in cqparts. What am I missing?

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

I've copied the web-template directory into the virtual environment, and I've filed an issue on cqparts proper about the missing directory.

I still have to modify the python2.7 line in build.go, and I still don't have anything displayed when I save the file. I see the grid in the browser, and there are no errors in the terminal. However, I do see the following in the console on Firefox in Ubuntu 17.10.

THREE.WebGLShader: gl.getShaderInfoLog() vertex 0:2(12): warning: extension `GL_ARB_gpu_shader5' unsupported in vertex shader
 1: precision highp float;
2: precision highp int;
3: #define SHADER_NAME LineBasicMaterial
4: #define VERTEX_TEXTURES
5: #define GAMMA_FACTOR 2
6: #define MAX_BONES 0
7: #define USE_COLOR
8: #define BONE_TEXTURE
9: uniform mat4 modelMatrix;
10: uniform mat4 modelViewMatrix;
11: uniform mat4 projectionMatrix;
12: uniform mat4 viewMatrix;
13: uniform mat3 normalMatrix;
14: uniform vec3 cameraPosition;
15: attribute vec3 position;
16: attribute vec3 normal;
17: attribute vec2 uv;
18: #ifdef USE_COLOR
19: 	attribute vec3 color;
20: #endif
21: #ifdef USE_MORPHTARGETS
22: 	attribute vec3 morphTarget0;
23: 	attribute vec3 morphTarget1;
24: 	attribute vec3 morphTarget2;
25: 	attribute vec3 morphTarget3;
26: 	#ifdef USE_MORPHNORMALS
27: 		attribute vec3 morphNormal0;
28: 		attribute vec3 morphNormal1;
29: 		attribute vec3 morphNormal2;
30: 		attribute vec3 morphNormal3;
31: 	#else
32: 		attribute vec3 morphTarget4;
33: 		attribute vec3 morphTarget5;
34: 		attribute vec3 morphTarget6;
35: 		attr… three.min.js:49:299

And this in the console on Chrome in 17.10:

three.min.js:168 THREE.WebGLRenderer 92
:8080/model/Case/out.gltf:1 Failed to load resource: the server responded with a status of 404 (Not Found)

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

Ok, the server looks for the Case file so it can display on start up. I think that you will need the new release from @fragmuffin of cqparts for this to work correctly. The new display() works with cqserver.

The web pages are baked into the cqparts-server binary so there should be no need to copy them.

Once the new release of cqparts is out , this should actually work.... ;)

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

The rendering does work with the new release of cqparts. However, I'm not sure what to do about having to change the python line in build.go.

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

Can you post the change you had to make and I will investigate.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

I changed this line to this:

cmd := exec.Command("python2.7", file)

I'm not really sure why that would fix it. If I do which python2.7, it shows /usr/bin/python2.7

from cqparts-server.

zignig avatar zignig commented on September 26, 2024

very weird. But it's working otherwise ?

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

Yeah, it's rendering now. I think this issue can be closed since the original problem has been solved.

from cqparts-server.

jmwright avatar jmwright commented on September 26, 2024

Thanks for the help.

from cqparts-server.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.