Some coding is needed.
First, try the plugin interface. have a look at the plugins/ folder in librecad source.
We may also add this feature directly to LibreCAD, as reported in this feature request:
http://sourceforge.net/p/librecad/feature-requests/150/