reaction arrow length

User c23c5e9da4

20-03-2007 23:10:57

Is there a way to control the length of the reaction arrow when building up a RxnMolecule through the api? I need it to be longer than the default to fit some text above and below it.

User f359e526a1

21-03-2007 07:54:31

Hello, this feature is not available, I am working on it in the moment. Hopefully you will be able to treat reaction arrows as usual graphical arrows and paint multiple steps of reactions in the next major release.

User c23c5e9da4

21-05-2007 15:08:59

I noticed a bunch of new methods in RxnMolecule that seem to effect the arrow length but I can't figure them out. Do you have a code sample showing how to set the length of the reaction arrow?





Thanks,





Trevor

User f359e526a1

22-05-2007 09:06:20

If you set it by setReactionArrow() it should move the arrow also.





Code:
   String reactionStr = "CCCC>NN>CCCCNN";


   RxnMolecule reaction = (RxnMolecule) MolImporter.importMol(reactionStr);


   DPoint3[] arrowPoints = new DPoint3[2];


   arrowPoints[0] = new DPoint3(-0.924,1.0,0.0);


   arrowPoints[1] = new DPoint3(0.924,0.0,0.0);


   reaction.setReactionArrow(arrowPoints);


User c23c5e9da4

22-05-2007 15:10:22

This isn't working for me. I run this





DPoint3[] points = rxn.getReactionArrow();


System.err.println(Arrays.asList(points));





rxn.setReactionArrow(new DPoint3[]{new DPoint3(-6, 0.30400576655635264, 0), new DPoint3(-.1, 0.14216725806306707, 0)});





points = rxn.getReactionArrow();


System.err.println(Arrays.asList(points));





and it prints out this (and the reaction arrow doesn't get any longer)





[DPoint3(-3.4315592862281665, 0.30400576655635264, 0.0), DPoint3(-0.37725988175212066, 0.14216725806306707, 0.0)]





[DPoint3(0.0, 0.0, 0.0), DPoint3(1.54, 0.0, 0.0)]

User f359e526a1

23-05-2007 06:52:42

Hello, try the code in the attachment. Note, if you want to change the logic (i.e. the direction of the reaction) you have to call RxnMolecule.rebuildStructures() otherwise the arrow pointing to a misleading direction.

User c23c5e9da4

23-05-2007 16:56:28

Thanks - the problem I am running into is that calling arrangeComponents() resets the arrow back to it's original size and position. See attached example. We use arrangeComponents to clean a RxnMolecule we have constructed with addComponent calls without changing the orientations of the components.

User f359e526a1

24-05-2007 06:58:47

arrangeComponents() will reset the arrow, if you are going to change the arrow coordinates it is adviced to alter them after arrangeComponents() . Meanwhile we found a bug in arrangeComponent recently but as I checked in the CVS it is affecting the arrow placement marginally.

User c23c5e9da4

24-05-2007 14:37:09

But you can't lengthen the arrow if you call arrangeComponents before setting the arrow length as the arrow will be drawn on top of the other components. Do I need to manually translate the componets after a call to arrangeComponents()?

User f359e526a1

24-05-2007 16:55:02

You can change the order of graphical objects, the reaction arrow is "linked" to the RxnMolecule though. I attached a code that creates a document and adds a graphical rectangle besides the molecule. In the second step we are bringing this rectangle to the back. So it will be painted on top of the arrow in the first case and under the arrow in the second one. Is it something like this you need?

User c23c5e9da4

24-05-2007 16:58:22

I think I'm all set - If I do a CTransform3D translation after the arrangeComponents on the reactants and products by the amount I lengthened the arrow I get the result I want.





Thanks