Inkscape.org
Creating New Extensions Save components using extension
  1. #1
    HaroldTang HaroldTang @HaroldTang

    Hi all,

    First of all, this new forum is awesome and I love it!

    Here is the question. I have drawn some components using Inkscape tools like ellipse, path, rect for the electronic elements. Is it possible to record them into files so that I can redraw them later?

    I am thinking about grouping several objects into one group and let user input the group id like "#g100" and define a name for this group like "switch". But how can I retrieve the SVG information from the grouped components and somehow save them?

    By the way, I am using Inkscape 0.92.4, python 2.7 and operating system is Window 10.

    Thanks a lot!

  2. #2
    brynn brynn @brynn

    Welcome to the forum!

    Are you trying to make a template, which other users can access, which has certain elements already available for them?  Or else, I'm not clear exactly what you're asking.

    Of course you can save any Inkscape document as SVG, or any various file formats.  But I'm just not clear what you're asking.

    This tutorial is a bit dated, but it still covers the basics of using templates with Inkscape:  http://libregraphicsworld.org/blog/entry/using-templates-in-inkscape

    Or could you be wanting to make an extension?

    You can access the SVG info in the XML Editor.  But Inkscape automatically has that saved in the SVG file.  Or you could open the saved SVG file in a text editor, and see the XML code.

  3. #3
    HaroldTang HaroldTang @HaroldTang
    *

    Hi Brynn,

    Sorry I haven't mention that I am writing an extension to create some certain components.

    Let's say user already drawed a switch in the Inkscape canvas, and I want to save this user-defined component in the extension. If user wants to use this component again, he can simply click on the extension to redraw it. Is there any way to read the XML information to record this group of elements in the extension, even if I don't save the SVG file? Now I can get the group id for this component but I don't know how to retrieve the information from the group.

    Maybe I will check out the template method later, thanks!

    Edit:

    I have read the tutorial for templates and try it in the software, but the template tool will create a new file with pre-defined setting and layers rather than just append on the current file. So I guess it is not what I want. 

  4. #4
    brynn brynn @brynn

    I'm going to move this topic into a board that's dedicated to writing new extensions.  That will attract the attention of people who know how to help.  I don't know much about it.

    Hang in there!

  5. #5
    Patrick Storz Patrick Storz @Ede_123

    Are you aware of the Symbols dialog in Inkscape?

    It offers pretty much the functionality you're describing. Maybe you don't need an extension after all?

  6. #6
    HaroldTang HaroldTang @HaroldTang
    *
    Ede_123

    Are you aware of the Symbols dialog in Inkscape?

    Hi Patrick,

    I try this tool and this is very similar to what I want! There is still one question, can this saved symbol be used in another file? I notice that I can save the component in the current file symbol set, but when I open up a new file, the dialog will be erased.

    I will try to read the tutorial for this tool. Thank you again for the idea! It really helps me a lot.

    Edit:

    I found a solution. After adding the symbols, I can delete the original component, click the File/Document/Properties and use the metadata tab to add a title for the symbol set name, save the document as a user-defined file to the Inkscape/share/symbols/ folder, restart the software and then I can get a custom symbol set! This solution solves my problem perfectly! Thank you so much for your help!!

  7. #7
    Tyler Durden Tyler Durden @TylerDurden

    Just FYI, there are electronics schematic symbols files already available.

    Example (linked from the old forum):  http://www.inkscapeforum.com/download/file.php?id=6946

     

    Have a nice day.

    TD

  8. #8
    HaroldTang HaroldTang @HaroldTang
    TylerDurden

    Just FYI, there are electronics schematic symbols files already available. Example (linked from the old forum):  http://www.inkscapeforum.com/download/file.php?id=6946

    Thank you so much for your help!

  9. #9
    Tyler Durden Tyler Durden @TylerDurden

    Since the old forum is down here is the symbols file on launchpad: https://bugs.launchpad.net/inkscape/+bug/1686263/+attachment/5325927/+files/Electrical_symbols%20_library%20.svg

    The file is best placed in the user profile so it remains whe Inkscape is updated. (..\Users\yourname\AppData\roaming\inkscape\symbols\)

     

    Have a nice day.

    TD