User bb2ba884f2
22-03-2011 08:27:40
Hi !
I need to check in MarvinSketch (web development) if was drawned moleculas without conections
I found function "fragmentCount" here - https://www.chemaxon.com/marvin/help/chemicalterms/EvaluatorFunctions.html#geometry_functions.
I try to call it in JavaScript. But it don't returns any results. See the code that i use -
function FCount()
{
alert(document.MSketch.fragmentCount());
}
<input TYPE=BUTTON VALUE="FragmentCount" onClick="FCount()">
==========
Is this the right function for my scope? if yes how to use it correctly in JS?
See the attached mol file.
Best regards.
ChemAxon 5433b8e56b
22-03-2011 13:41:52
Hi,
you may found a useful excpetion for your case in section 4 on our applet examples page.
I hope that helps, if it is not, then do not hesitate to ask further.
Regards,
Istvan
User bb2ba884f2
22-03-2011 15:34:50
ifajth wrote: |
Hi,
you may found a useful excpetion for your case in section 4 on our applet examples page.
I hope that helps, if it is not, then do not hesitate to ask further.
Regards, Istvan
|
Hi Istvan!
I saw this examples and I implemented it with success.
But my question refer to fragmentCount function. The problem (as I think) that fragmentCount() function don't work with document.MSketch. Maybe it use another class ? I need an example how to call this function in Javascript.
Thanks.
ChemAxon 5433b8e56b
22-03-2011 19:49:09
Hi,
yes that is true, document.MSketch does not have a fragmentCount() method. You can evaluate chemical terms expressions by document.MSketch.evaluateChemicalterms(String expression) method that returns the calculated value of a chemical terms as String.
You also can check if the chemical terms expression is valid or contains some error, by document.MSketch.isChemicalTermsExpressionSyntaxError() method that returns a boolean.
So, to get the fragment count, you should call document.MSketch.evaluateChemicalTerms("fragmentCount()").
That should work.
Regards,
Istvan
document.MSketch.isChemicalTermsExpressionSyntaxError()
User bb2ba884f2
23-03-2011 07:11:51
ifajth wrote: |
Hi,
yes that is true, document.MSketch does not have a fragmentCount() method. You can evaluate chemical terms expressions by document.MSketch.evaluateChemicalterms(String expression) method that returns the calculated value of a chemical terms as String.
You also can check if the chemical terms expression is valid or contains some error, by document.MSketch.isChemicalTermsExpressionSyntaxError() method that returns a boolean.
So, to get the fragment count, you should call document.MSketch.evaluateChemicalTerms("fragmentCount()").
That should work.
Regards, Istvan
document.MSketch.isChemicalTermsExpressionSyntaxError()
|
Hi Istvan!
SOLVED. It work! Thanks.
I have another question - How to detect if formula contain Carbon atom or not ?
P.S.
If is necessary to post another topic with this question, please tell me and i will do.
ChemAxon 5433b8e56b
24-03-2011 15:47:21