Re: Advanced options for custom shapes



Am 01.11.2014 um 09:54 schrieb Nico Rikken:
Dear Dia users and contributors,

I spend some bits of my time working on a sheet of power system symbols.
The supplied electrical sheets ('Electric 2') fall short on this topic,
and since I like using Dia, I thought I should make this contribution
for myself and others.

I started with a regular Dia sheet to get a sense of the task ahead, and
in parallel I've started an attempt to create a UI-design sheet, which
is currently way over ambitious due to the way elements need to respond
to transformation (so maybe in the future).

Having made these baby-steps, I have a couple of questions I'd like to
have sorted out to make sure I'll be doing it the right way:

1) Can I have custom elements with options? Just a transformer can have
several symbols distinguishing between the types. I'd like to just place
a transformer and use a dialogue box for selecting the type, thereby
reducing the complexity of the sheet for the regular user but providing
advanced options for the professional.

This would require some extension to the custom shape specification [1] and the custom shape module [2]. A simple solution could be to define an enum with the shape and use that for conditional rendering of subshapes. This wont give an extra dialog, but just another option with the standard properties.

2) There are several drawing standards associated with power systems
symbols. Of course I can just select one, but I was curious if it would
be possible to have a main selector to switch between a symbol standard
which just changes the appearance of all the power system shapes.

If I understand correctly this is a special case of 1)? But here one might consider to use the SVG switch element [3], which looks to be too limited for the generic case. But again some specification and implementation updated would be involved.

3) I have a particular question regarding drawing a busbar, which
connects the main conductor(s) to the conductors for distribution. Often
times the busbar is illustrated by a thick line, but should be drawn
differently depending on the level of abstraction. In the case of a
system with a double busbar round dots, either white or black, indicate
to which of the busbars the conductor is typically connected. But how to
cope with this flexibility?
  I see no issue in having two separate shapes for both 'types' of
busbar, but ideally I would be able to have a thick line element for the
bus bar, which has several connectors for the conductors to connect to,
and in the case of the double busbar indicate the state of the
connection by using dots. But how would I deal with such an element?
Especially since the length can vary and the number of connections can
vary, but of course these elements should be aligned properly in
accordance to other elements in the drawing.
This kind of flexibility is IMO out of scope for the custom shape mechanism. But an an object implementation in C could achieve something like that. See e.g. "Network - Bus" for an example [4].

  Another option would be to have elements for the connection nodes of
the busbar, but then the user would have to draw lines to continue the
busbar, which as far as I know would require the user to manually select
the thickness of these lines according to the busbar element, which
would present a hassle and can lead to errors.

4) Lastly I have a more trivial question regarding the normal size of
elements. I've now modelled the size to be 2x2 regular squares (normal
view when opening Dia) but I'm wondering if there are any handles on a
preferred regular size. Ideally I'd like to know beforehand, rather than
changing it afterwards.

Custom shapes are always scaled so the underlying size does not matter match. If you are creating your shapes with the help of Dia's shape exporter typical diagram sizes should be used.

I've added my initial drawing efforts in Dia to this e-mail for you to
better understand my questions.

That file produces errors on load with master and dia-0-97

 * Unknown types while reading diagram file CMOS - nmos_h
 => expected because of missing shape file

 * Error? trying to connect a non connectable handle.
   'Standard - Ellipse' -> 'Standard - Ellipse'
=> This might be a bug with Dia, so I'm curious how the diagram got created. Did you already modify the Dia source code? Which version did you use to create the file?

I have no problem with a some programming to get this working, although
that would increase the complexity of my effort.

If I've understood your requirments correctly some coding woud be inevitable. Don't hesitate to discuss the design on this list first ;-)

Thanks for reading this long explanation if you've come so far and
thanks in advance for replying.

HTH,
        Hans

[1] https://git.gnome.org/browse/dia/tree/doc/custom-shapes
[2] https://git.gnome.org/browse/dia/tree/objects/custom
[3] http://www.w3.org/TR/SVG/struct.html#SwitchElement
[4] https://git.gnome.org/browse/dia/tree/objects/network/bus.c

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]