Showing posts with label Molecules. Show all posts
Showing posts with label Molecules. Show all posts

Monday, 2 May 2011

Tuesday, 9 February 2010

Parsing and drawing molecular structures with delphi part II

Today I've released the last version of my program with several changes into the graph script implementation. This new version has a little windows with a simple syntax highlighting system with the usually tokens that I use in my script. The scripting language is very easy to use and very intuitive instead of only writing numbers with no sense. Now we can create and manipulate the way the graphs are created by simple commands. I'm working on the syntax checker that will tell you the error line and a little description of the problem.

Now we can write:


layout.node(x).ToNode(y).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];


where:

layout, is the canvas where we need to create our node or to look for our node. node(x) is the first node to need to be created and this will be connected to toNode(y). We can finish this sentence here (with a semicolon mark ";") or going on calling the parameters. Where we have, the EdgeType, SizeBox, LineColor and PenWidth parameters. On the EdgeType parameter, we can use this list:
  • SimpleEdge
  • SimpleArrowEdge
  • SimpleDoubleArrowEdge
  • SimpleDoubleLinkedArrowEdge
  • DottedEdge
  • DottedArrowEdge
  • DottedDoubleArrowEdge
  • DottedDoubleLinkedArrowEdge
Each of one of these edges, will draw a different kind of component into the layout. For the SizeBox we can specify an integer number in pixels to build or resize the length of every box inside the command. The line colour is a typical delphi constant like clRed, clBlue, clYellow, etc. and the last property as an integer number as well as the SizeBox, PenWidth, that will change the width of the line drawn.

This script will generate the next diagram:

I'll try to finish all the things that I have in mind this week in order to focus on other parts of the application. Due to the last petitions into the post "Automation Object Library for Vijeo Citect", I'm being forced to show you (willingly) my last achievements into this field. I'm still merging my last application "Thundax Box Manager" with the last version of my "Canvas test Framework", and I'm very keen on releasing the new application "Thundax P-zaggy" that will contain all the modules to work with graphs.

You can now download the last released version from SourceForge:
I hope you enjoy!.

Friday, 5 February 2010

Parsing and drawing molecular structures with delphi part I

After being very busy in several projects that I'm enrolled. I've managed to get some time extra to go on in my little project. This week I've been working on a little scripting language that let me build different structures by using it. I still have to fix some bugs and I have a very long list of new features. By using this little structure, we can modify the different nodes and edges that we are building. For example if we have this:


node(1).ToNode(2).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];
node(2).ToNode(3).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];
node(3).ToNode(4).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];
node(4).ToNode(5).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];
node(5).ToNode(6).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];
node(6).ToNode(1).parameters := [EdgeType = SimpleArrowEdge, SizeBox = 20, LineColor = clRed, PenWidth = 2];


The application will build the next structure:

Well, at this point, how can we manage molecular structures? In this case, we only need the adjacent list and parse it to let the application force the position by using its force-directed graph layout. It's amazing the all kind of structures that the system can process and work with.

Monday, 10 August 2009

Dibujando moléculas con Delphi

Hoy os traigo una aplicación muy interesante de la mano de Jean Yves Quéinec, que nos deleita con una aplicación que es capaz de dibujar una serie de moléculas predefinidas. Solo hay unas cuantas pero a partir de ahí, podemos añadir y programar todas las que queramos. En el enlace que os adjunto encontraréis el código fuente de la aplicación. Se hizo con una versión bastante antigua de Delphi, así que puede ser que os encontréis con algún error al hacer la migración (nada complicado). La aplicación está bastante lograda, mostrando en un TPaintBox la molécula en 3D y permitiendo realizar la inspección de ésta mediante el ratón. También muestra una pequeña leyenda con los tipos de componentes que utiliza: Carbón, Hidrógeno, Oxígeno, Nitrógeno, etc.

Aquí os dejo unas cuantas imágenes de la aplicación:


En el siguiente enlace podréis descargar la aplicación: Molecules.zip.
  • Enlaces de Interés:
Delphi Miscellany.
How to draw organic molecules.