Thanks very much. Problem solved.

As a point of interest (it is also noted in the wiki). I needed to use:
OBCommentData commentBack = openbabel_java.toCommentData(mol.GetData("cmt"));

instead of:
OBCommentData commentBack = (OBCommentData) mol.GetData("cmt");

Best,

Jon

On 17 September 2012 16:24, Noel O'Boyle <baoille...@gmail.com> wrote:
> Use CloneData instead of SetData.
>
> On 17 September 2012 15:16, Jon Fuller <jonathan.ful...@gmail.com> wrote:
>> Dear All,
>>
>> I had a question about the use of OBMol.SetData() through the Java
>> bindings. I would expect to be able to do something like this:
>>
>> OBCommentData comment = new OBCommentData()
>> comment.SetData("This is a comment");
>> comment.SetAttribute("cmt");
>> mol.SetData(comment);
>>
>> Then to read back something like this:
>> OBCommentData commentBack = (OBCommentData) mol.GetData("cmt");
>>
>>
>> However the SetData method does not exist in the OBMol class. As I
>> understand this differs to the C++ classes:
>> e.g. http://openbabel.org/dev-api/classOpenBabel_1_1OBGenericData.shtml
>> where I could use (here for the OBAtom):
>>          atom.SetData(label);
>>
>> Could anyone provide a suggestion as to how I should approach this problem?
>>
>> I am using the OpenBabel 2.3.1 jar file (and related install).
>>
>> Many thanks in advance,
>>
>> Jon Fuller
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to