[Ipe-discuss] Symbols (and libraries)

Otfried Cheong otfried at ipe.airpost.net
Mon Sep 28 09:13:09 CEST 2015


A symbol is an Ipe object defined in a style sheet.   I normally make
such a style sheet in a text editor.   You could start with a file
"circuits.isy" containing this template:

<ipestyle name="circuits">
<symbol name="battery" transformation="translation">
</symbol>
</ipestyle>

Then paste the object you want inside the <symbol></symbol> tags - the
easiest way to do that is to draw the object in Ipe, select it, and
press Ctrl+C.  Then just paste into the text editor.  I did this with
Nathaniel's file: I selected the battery symbol, and moved it to the
origin (the origin will become the "hot spot" of the symbol):

<ipestyle name="circuits">
<symbol name="battery" transformation="translation">
<ipeselection pos="-16 -32">
<path matrix="0 1 -1 0 592 -228" stroke="black" pen="1" join="0">
228 600 m
228 584 l
236 616 m
236 568 l
208 592 m
228 592 l
236 592 m
256 592 l
</path>
</ipeselection>
</symbol>
</ipestyle>

Now just delete the <ipeselection> lines to obtain the final result:

<ipestyle name="circuits">
<symbol name="battery" transformation="translation">
<path matrix="0 1 -1 0 592 -228" stroke="black" pen="1" join="0">
228 600 m
228 584 l
236 616 m
236 568 l
208 592 m
228 592 l
236 592 m
256 592 l
</path>
</symbol>
</ipestyle>

Save the style sheet as "circuits.isy", and add it to an Ipe document
(Shift+Ctrl+S, then "Add").

You can now make use of the new symbol called "battery" by using Ipelets
-> Symbols -> Use symbol.  Select "battery", and you can now place the
object with the cursor.

When you want to place many copies of the same object, it's convenient
to select it with "Set current symbol", and then it can be places with a
single mouse press (press Alt+Y for Use current symbol).

The remaining functions are for editing the style sheet itself, but as I
said it actually seems to work better if you edit the sheet in an
editor.   You could create a new symbol by selecting it, and using
"Create new symbol (in top stylesheet)" - this will add the new symbol
to the circuits.isy sheet.   Currently this doesn't allow you to set the
"transformations" option, which is a drawback.  "Clone symbol" makes a
copy of the symbol definition into your current document - you can edit
it then and put it back into the style sheet by using "create symbol"
(it will warn you that you are overwriting the current definition).  
Note that immediately all occurrences of the symbol on your page will
change to reflect the new object - an occurrence is really just a
reference to the name of the symbol.

I'm not sure if this mechanism is really useful for circuit components,
because the internal features of symbols are not active for snapping. 
It seems to me that you probably want to be able to snap to all the
connection points of a circuit component.  So you might be better off
making an Ipe file with the components and copying them from there as
you use them, as Nathaniel suggested. 

Alternatively one might add a system for specifying snap points to
symbols, if this is actually useful.  (I don't think many Ipe users are
using symbols yet.)

Cheers,
 Otfried


On Sun, Sep 27, 2015, at 02:59, Benoit Bidoggia wrote:
> Hi Nathaniel,
> 
> Thank you very much for your email and for the attachment. It was indeed
> helpful, and I will follow your example, if I don't come up with a
> solution
> with the symbols.
> In the meanwhile, though, I hope somebody will explain how to use the
> symbol ipelets... :-)
> 
> All the best,
> Benoît
> 
> 
> On Sat, Sep 26, 2015 at 12:51 AM, Nathaniel Cunningham <
> nathaniel.cunningham at gmail.com> wrote:
> 
> > Hello Benoit,
> >
> > I have put together a minimal "library" of circuit diagram elements; but
> > not as symbols.  I know that doesn't answer your question directly, but in
> > case it's any help: attached.
> >
> > -- Nathaniel
> >
> >
> >
> >
> >
> > On Fri, Sep 25, 2015 at 3:21 PM, Benoit Bidoggia <
> > benoit.bidoggia at gmail.com> wrote:
> >
> >> Hi everybody,
> >>
> >> I've recently discovered Ipe and it's fantastic. It does exactly what I
> >> would like, except for one thing that I cannot figure out how to do (or if
> >> it's possible at all).
> >>
> >> I would like to use Ipe for - among other things - drawing electric
> >> circuits, and therefore I would like to create a library of symbols which I
> >> could reuse among different drawings (.ipe files).
> >>
> >> Is this possible?
> >>
> >> I've played a bit around with the "Symbols" iplet, but without success.
> >> Do you have some hints? The manual and the information I could find don't
> >> seem very detailed on how to use this feature.
> >>
> >> Thank you very much, best regards.
> >> Benoît
> >>
> >>
> >> _______________________________________________
> >> Ipe-discuss mailing list
> >> Ipe-discuss at lists.science.uu.nl
> >> http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
> >>
> >>
> >
> _______________________________________________
> Ipe-discuss mailing list
> Ipe-discuss at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/ipe-discuss


More information about the Ipe-discuss mailing list