[feature request] python support for vrml export


I’d like to be able to export a .wrl model of my board from a python script. I’ve had a look at the swig file that defines the python API: https://github.com/KiCad/kicad-source-mirror/blob/master/pcbnew/swig/pcbnew.i

It looks like the EXCELLON exporter is there but not the VRML one.

Is this an easy thing for a dev to add?


Well the thing with feature requests is that this might not be the correct platform. (There is a bugtracker to communicate with developers.)
But if the feature already exists maybe someone here knows how to use it. For vrml export maybe @maui knows something. For python api maybe @mmccoo or @pwuertz know an answer. (Or someone else has an answer. The only thing we mere mortals can do is wait.)

So know the standard answer for feature request:

  • Most forum members are mere KiCAD users who try to help each other with the software. (Most developers do not regularly visit this forum.)
  • Wishes for features need to be posted on the bugtracker with ‘wishlist’ as tag. (Please check first if something similar has already been requested and read the official how to.)
  • Pure wishes, without support by a Dev or a patch ready to go into the KiCAD code have a very small chance of ever being implemented.

Sorry & good luck.


unfortunately kicad python APIs are quite poor ATM: no support for exporting VRML by python AFAIK


Also the pre-release of 5.0 is appearing in the distance and the developers are trying to minmise the list of features yet to be added before the freeze, so that they can focus on bug fixing.
This was a recent post


looking at the code, the function you probably want is this one:

bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
                      bool aExport3DFiles, bool aUseRelativePaths,
                      bool aUsePlainPCB, const wxString & a3D_Subdir,
                      double aXRef, double aYRef );

unfortunately, it’s a method on PCB_EDIT_FRAME (defined in kicad/include/wxPcbStruct.h). This is a large class that should probably only be exposed selectively. (it’s got lots of event handling stuff that even most other c++ should likely stay away from)

Probably, a good place to expose it is in pcbnew/swig/pcbnew_scripting_helpers.cpp.

compiling kicad is not hard (I have an entry about it on my blog).

The refresh command in the scripting helpers file would be a good model.

I don’t use the 3d stuff myself, so I wouldn’t know how to test such a change.