Custom block library

Just newbie on Diagram Studio. It looks like an awesome product. Question:

What is the best approach to build a custom library of blocks (custom shapes) and add it to a DiagramButtons component for end user to build a network... The custom shapes also need a link to an external class that needs to be instantiated and communicate with the block for identifying objects linked to connected blocks.
If I add my own categories and buttons to the TDiagramButtons component, it seems to override and give me the standard categories.

thanks, Wilfried 
To be more clear: what is the best approach: derive new block classes inheriting form a standard block for every type in the library?
Or take the same block class and draw it with differents shapes depending on some ID propery?

regards, Wilfried 

There is not best approach in this case. Both options are valid: creating inherited block classes, or doing custom drawing. In Diagram Studio itself there are both cases, it really depends on how you want your blocks work. I'd in general go with creating a class for each different block.

Thanks. Creating classes indeed provides more flexibility.
I am working on a GUI for system simulation where the block represent component models somehow connected together. The component simulation code needs to be run in a sequence. There will be forks and joins, so the system has to decide which leg of the fork to run first and then wait with continuing at joins until both incoming input paths have been calculated.
I think it is then best to derive from TCustomLiveState to have functions to control execution of code behing the blocks and also to allow multi-threading of parallel path calculation execution.

Would you agree with this approach?

regards, thanks, Wilfried 

Hi Wilfried

I have a similar approach: I programmed a simulation system for urban hydrology with elements (rainfall, catchments, overflows, channels, unions, receiving waters etc.). Calculation is top-down for each time step, so I don't need to solve a system of differential equations.
Now, I use Diagram Studio to visualize the network.
I think I used ElectricBlocks.pas as an example to see how to define own blocks.
I can send you my unit HydrologicBlocks.pas as an example. Most of my blocks use icons saved as metafiles or bitmaps.

Did you have a look at OpenModelica? That's a free simulation framework using the Modelica language (comparable with Matlab/Simulink). You need to define your elements with the Modelica language. But you don't need solvers, they are included. There is also a GUI tool to build up a network, so you don't need to develop this.

Regards, Rolf

Thanks Rolf,

I know Modelica. Simulink/Matlab and similar tools. The idea here is to go beyond Modelica, using a framework of complex component models for energy systems. Around it will be a case/config management function for more industrial approach simulation work.  The component models and the solver is already there. Now with increased complexity in the relations among system model elements, we need a new GUI. Btw: I am the 'father' of the GSP gas turbine system simulation tool ( and this experience will be for new concept. Read for more information.

I have played a little with Diagram Studio and have come to the conclusion to adapt the TLiveDiagram class (inherit does not give me enough freedom) to allow/give me:
- multiple starting blocks (so the livediagram itself must start multiple threads (as de LiveFork does)
- multiple end blocks (the livediagram itself will act as the end block)
- a Tlivefork derivative that also executes itself (to model an element splitting a flow into 2 exits, like a fan compressor in a turbofan engine  for example).

I wonder if the newer multi-threading functions in Delphi XE7 (Parallel Threading Library) could help to streamline the multi-threading code. I will have to see....

It is in interesting exercise and the Diagram Studio code is certainly cool, I will keep you updated.
regards, Wilfried