can not color bond using EMFExporter

User 37df300f74

07-05-2014 13:40:14

Hello,


I am using your EMFExporter to generate structure image (ExportToEMFBinary) and it works great most of times.


However when I try to color a bond using the following format: "emf:transbg,w200,h200,setcolors:b1:red", no bond is colored. If I use molecule.exportToBinFormat with same format, the bond is colored. I attached the dummy mrv file for your review. I am using Marvin 6.2.2 for this test.


<?xml version="1.0" encoding="windows-1252"?><cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/help/formats/schema/mrvSchema_6_2_0.xsd" version="ChemAxon file format v6.2, generated by v6.2.2">
<MDocument atomSetRGB="2:#000000" bondSetRGB="0:N,1:N"><MChemicalStruct><molecule molID="m1"><atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14" elementType="O C C C C C C C C C C C C C" mrvSetSeq="2 2 2 2 2 2 2 2 2 2 2 2 2 2" x2="2.66735824365608 4.001037365484114 4.001037365484113 5.334716487312152 5.334716487312148 4.0010373654841125 2.667358243656078 2.6673582436560777 5.334716487312151 5.334716487312153 6.668395609140189 8.002074730968225 8.002074730968221 6.668395609140187" y2="2.220446049250313E-15 -0.769999999999998 -2.309999999999998 -3.080000000000002 -4.620000000000002 -5.390000000000001 -4.619999999999997 -3.0799999999999983 2.220446049250313E-16 1.5400000000000043 2.3100000000000023 1.5400000000000007 6.661338147750939E-16 -0.7699999999999994"></atomArray><bondArray><bond atomRefs2="a1 a2" order="2"></bond><bond atomRefs2="a2 a3" order="1" mrvSetSeq="1"></bond><bond atomRefs2="a3 a4" order="2"></bond><bond atomRefs2="a4 a5" order="1"></bond><bond atomRefs2="a5 a6" order="2"></bond><bond atomRefs2="a6 a7" order="1"></bond><bond atomRefs2="a7 a8" order="2"></bond><bond atomRefs2="a3 a8" order="1"></bond><bond atomRefs2="a2 a9" order="1"></bond><bond atomRefs2="a9 a10" order="2"></bond><bond atomRefs2="a10 a11" order="1"></bond><bond atomRefs2="a11 a12" order="2"></bond><bond atomRefs2="a12 a13" order="1"></bond><bond atomRefs2="a13 a14" order="2"></bond><bond atomRefs2="a9 a14" order="1"></bond></bondArray></molecule></MChemicalStruct></MDocument>
</cml>


Thanks for your help,


Hongzhou


 

ChemAxon 2c555f5717

09-05-2014 09:44:51

Dear Hongzhou,


   The object that you use is not part of our public API, for this purpose you should use MolExporter.exportToBinFormat(MDocument, formatString). Please take care to use it with an MDocument (and not with a bare Molecule), otherwise your bond set settings might be lost.


Regards:
Balázs 

User 37df300f74

12-05-2014 13:58:34

Thanks for your reply. exportToBinFormat() from MolExporter or Molecule colored the bond as expected, but the image quality is not good. That is the reason we go with EMFExporter.

ChemAxon 5433b8e56b

16-05-2014 14:00:28

Dear Hongzhou,


it seems this issue needs some more clarification to be answered.


Can you please provide us how you are using the EMFExporter class? The relevant source code would be perfect, just as a small example code that mimics your usage workflow and produces the issue.


We are also interested in wether you are calling the COM API, the .Net API, or the Java API to generate the emf files?


If you do not want to share these information publicly please contact me in e-mail.


Thanks and best regards,
István 

User 37df300f74

16-05-2014 19:30:43

I am generating emf image from .net api but quality is not good, so in .net code, I am using COM API for final emf image.


Hongzhou


 

ChemAxon 5433b8e56b

19-05-2014 12:43:06

Hi Hongzhou,


we have identified a bug in the image export parameter handling code finally, based on the information provided.


Currently we are working on a fix, and I am almost sure that it can be included in the next patch release the 6.3.1 version.


In the mean time you can use the following as a workaround:


Before exporting the structure to mrv, clone it (if you need it with this setup elsewhere), and use setBondSetRGB(int, int) method in the MDocument of the Molecule to set the bond set coloring, and then export it to mrv and pass to imageexport without the setcolors:b1:red parameter.


Methods that you can find useful to create the workaround:


chemaxon.struc.Molecule.clone();
chemaxon.struc.MoleculeGraph.getDocument();
chemaxon.struc.MDocument.setBondSetRGB(int, int);
chemaxon.formats.MolImporter.importDocument(byte[]);
chemaxon.formats.MolExporter.exportToFormat(MDocument, String);


I hope this helps for you, these methods has their own .Net counterparts as well.


Regards,
Istvan 

User 37df300f74

20-05-2014 14:08:13

excellent, I am looking forward to the new patch release. Thanks a lot

ChemAxon 5433b8e56b

26-05-2014 09:17:33

Hi,


the fix will be included in 6.3.1, and any version above it.


You can expect the release probably early-mid June.


Thank you for your report, and best regards,
Istvan