← Back to team overview

kicad-developers team mailing list archive

Re: small fix to 3D export

 

Le 13/01/2013 10:49, Cirilo Bernardo a écrit :
Due to the combination of very large scale factors and very small scale factors in the exported VRML file, truncation errors in VRML viewers (whitedune and lookat) caused problems; for example whitedune would render correctly when exported in mm but gives bad results when exporting to inch or meter.  I have changed the code to scale the point coordinates rather than specifying a global scale + counteracting local scales and this appears to solve the problem.  When tested with the pic_programmer demo, the resulting file size was smaller by almost 2MB (~7.7MB rather than ~9.5MB) due to space saved in writing the text representation of coordinates.

Other changes made:
1. removed unnecessary translation/rotation/scale parameters within the VRML Transform block
2. corrected the URL file syntax

I am aware of at least one bug but it is one that requires some thought before deciding how to address it: if relative filenames are used, the URL points to invalid relative locations. I believe relative file URLs should only be allowed when the 3D models are copied to a directory (this allows people to give their board VRML model to others), and absolute file URLs should be used when the models are not being copied.

There is also a problem with thru-hole pads; for the resistors and diodes (in pic_programmer) it seems pads are rendered, but for the DILs only the first pad is rendered. I haven't had time yet to look into this.

Regards,
Cirilo
Thanks, Cirilo,

I added yours changes to my changes in export vrml files.
My changes are mainly related to Kicad coding style policy and file clean up.

Can you test it: I was not able to just apply your patch because the export_vrml.cpp file was already modified on my working copy.
So the patch was applied "by hand".

There is only one line I did not included from your patch (point 2):
-                 "  children [\n    Inline {\n      url \"%s\"\n } ]\n",
+ " children [\n Inline {\n url \"file://%s\"\n } ]\n", because "file://<filename>" does not work with FreeCAD and MeshLab (But I am thinking they have bugs).
And in vrml doc, I did not see it was requested.
Perhaps it needs more investigations...

Note about your remark:
< I believe relative file URLs should only be allowed when the 3D models are copied to a directory (this allows people to give their board VRML model to others), and absolute file URLs should be used when the models are not being copied >

Currently, this is the case (unless there is a bug).

--
Jean-Pierre CHARRAS



References