Hello Alex, See the OBDotNet documentation for information on casting OB data types. BTW, questions about development with OB are better sent to the openbabel-scripting list.
Hope this helps.... - Noel 2010/1/22 Demiurg HG <[email protected]>: > Hello, > > I`m trying to retrive charge density (OBGridData) from Gaussuan Cube using > OBDotNet (latest version). > My code looks like this: > > conv = new OBConversion(); > mol = new OBMol(); > > if (!conv.SetInFormat("CUBE")) { > throw new Exception("cann`t set input format"); > } > > if (!conv.ReadFile(mol, "test3.cube")) { > throw new Exception("cann`t open \"test3.cube\" file"); > } > > VectorpData data_set = mol.GetAllData(openbabelcsharp.GridData); > > for (int i=0; i<data_set.Count; i++) { > OBGenericData data = data_set[i]; > Debug.WriteLine("Data #" + i + " : " + data.GetAttribute() + ", > type="+data.GetDataType() + data.ToString()); > > OBGridData grid = (OBGridData)data; // <-- InvalidCastException > } > > Molecule is loaded successfully. > data.GetDataType() returns 24 (openbabelcsharp.GridData) > An exception on type casting is occurs. > > What is a right way get OBGridData? > > Thanks before hand. > Alex. > > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for > Conference > attendees to learn about information security's most important issues > through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > OpenBabel-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > > ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ OpenBabel-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
