You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
4.1 KiB

  1. This directory will contain headers for the various types of
  2. KiCad dynamic plugins and associated APIs.
  3. In a typical implementation a dynamic plugin will provide a simple interface to
  4. provide KiCad with a list of functions which can be invoked to provide the
  5. desired feature. For example the 3D plugins provide a function to list the
  6. file types supported by the plugin, the associated filters required for browsing
  7. files, and a Load() function to process a 3D file and return a data structure
  8. which KiCad can use in the 3D rendering process. The set of functions provided
  9. by a plugin shall be referred to here as the Plugin Interface. Every plugin
  10. must be a derived class of at least one type of plugin declared in the header
  11. files in this directory. All implementations of a plugin interface constitute
  12. an actual plugin; the various KiCad tools such as pcbnew and eeschema contain
  13. no actual implementation of the plugin interface.
  14. Plugins also need to interact with KiCad and its internal data while knowing
  15. essentially nothing of the complex structures within KiCad. To make this possible
  16. each type of dynamic plugin must interact with at least one type of API which
  17. provides functions to create, inspect, and manipulate the complex data structures
  18. within KiCad. These APIs shall be declared in the api subdirectory and must be
  19. implemented within each KiCad tool which services the related plugin type. For
  20. example the 3D plugins must produce the intermediate scene graph data for use
  21. by the 3D renderer; to accomplish this an API is required to provide each 3D
  22. plugin with a method for creating the data structures required by pcbnew and
  23. cvpcb. In the implementation detail the API may be implemented once in the common
  24. static library of pcbnew or it can be implemented as a runtime shared library
  25. which can then be linked to by pcbnew. cvpcb, or even eeschema.
  26. Plugin specialization: To keep APIs and plugin interfaces as simple as possible
  27. it is necessary for plugins to be specialized (have different types). While it
  28. is possible to define only one plugin interface and one API for any and all
  29. plugins to use, this would result in a very large API which is difficult to
  30. maintain. Having specialized plugins and APIs ensures better maintainability
  31. of the code; a specific plugin may implement multiple plugin interfaces or
  32. interact with multiple APIs if it makes sense to do so. At least two plugin
  33. interfaces have been identified for implementation at this point: the 3D
  34. Plugin Interface and the PCBExport interface. The 3D Plugin Interface shall
  35. provide a method for processing supported 3D model types and returning an
  36. intermediate scene graph representation which a renderer can use to create a
  37. visual representation of the model. The PCBExport interface shall provide a
  38. means of exporting PCB data to a variety of formats such as Specctra DSN for
  39. the consumption of autorouters, GenCAD, VRML for visualization of the board
  40. using external tools, and IDF and IGES for interacting with mechanical designers
  41. and MCAD software. Other exporters such as netlist exporters or even BoM
  42. exporters should be possible. A PCBImport Interface is also a possibility but
  43. is currently a low priority item since there are currently only two import
  44. functions implemented (Specctra result import and DXF import) and a significant
  45. amount of work is required to implement the PCBImport API.
  46. Plugin management: Since plugins are specialized, each type should also be
  47. loaded and managed by a specialized plugin manager which has responsibilities
  48. for ensuring integration of the plugin with KiCad. For example the
  49. 3d_plugin_manager searches a list of paths to identify and load plugins which
  50. implement the 3D Plugin Interface. The 3D manager extracts information from
  51. each 3D plugin such as the types of 3D formats supported and the associated
  52. file extensions; the manager also responds to a Load() request by activating
  53. the appropriate 3D plugin and executing that plugin's Load() function. In the
  54. case of the Export Plugin Interface, a specific exporter would enumerate the
  55. plugins, add a menu item to the File->Export list, load and invoke a plugin's
  56. Export() function at the user's request, and unload the plugin when the
  57. Export() function completes.