--- In kicad-users@..., "generalizt" <erik.sundkvist@i...>
wrote:
Anyway, while working towards a complete embedded product, there is
always mechanics design to consider, and a nice feature would be to
export the 3D view of the populated PCB in a format that can be
imported into a 3D CAD package like SolidWorks or Pro-Engineer. For
this purpose I think a VRML export would do just fine. Since VRML is
already used for importing 3D models of components, and all the vertex
data is already present in the 3D view, exporting to VRML should be
quite quick to implement. Is anybody else having similar thoughts?
I have looked into the code to see how this could be done. I see a few
ways forward.
Either way we need to somehow traverse the data structures and
generate the VRML (or other format) output. This traversal is of
course already implemented in the 3D viewer and could be re-used.
A: One way to do this is to copy the code already in 3D viewer and
replace the calls to OpenGL with calls to generate the file output.
This has the drawback that we will have two separate pieces of code
that need to be maintained in parallel.
B: Another way is then of course to do the same thing but embed the
file output code in the existing code, and use an attribute to choose
between OpenGL and the file output. This could result in quite messy
code though.
C: Yet another way is to abstract the calls to OpenGL with an
additional layer that will choose between the original OpenGL calls
and the file output.
I would prefer the C solution because it is less intrusive, and in
fact, if we are lucky, much of the work is already done. I found an
interesting project (the OpenGL Grabber), which could be largely re-used:
The author of the OpenGL grabber chose to implement it as a DLL that
replaces the original OpenGL DLL on the Windows platform. This makes
it usable for any Windows application written for OpenGL, but the
mult-platform support does not exist. For Kicad I don't think this
approach is the best one, but rather the grabber could be
re-structured into a layer that is compiled into an application like
Kicad. There are probably some cross-platform issues to address, but
overall I think it looks like an interesting possibility.
If Jean-Pierre Charras or another active Kicad developer is on the
list, I would be interested in their thoughts on this topic.
Regards,
Erik Sundkvist