2017년 3월 8일 수요일

App inventor Chemical Formula


I am trying to create formulas like  " NaAl3(SO4)2(OH)6" by tapping the buttons.

--
The Android SDK has features that help with custom keyboards.   If someone in the open source project wanted to interface these with App Inventor, that would be a good project.
But we don't have the resources at MIT to commit to this.

--
thanks for your interest

--
" NaAl3(SO4)2(OH)6"  is not possible, AI2 does not have the numerical subscripts.  However, NaAl3(SO4)2(OH)6 is possible.  What you are trying to do is create a type of calculator, probably keeping track of valance etc.  That is going to be very complicated.  If you only want the formula, just add some numeric buttons, then set each key to concat to a string, where you have a global formula string using the Text Join.  Use the blue icon to provide as many joins as necessary.  The sodiumaluminumsulfate ?? would require the Na join AL join 3 join ( join   etc.,    Something like that will do the display- it will not format the chemical symbols   To provide the proper number of atoms, you will need is a fancy algorithm to make this automatic.

Something you might do is use a Webviewer component to go to this url:  http://balance-equation.appspot.com/     and use the chemical equation builder.  If you do the chemical balancing using AI2, you need to replicate the algorithm  used to produce the results at that web page.

-- 
thank you so much.you are right.i want to provide this automatic. this is just small part of my project but ' the key point'.Everything depends on the formulas...i think i must give up

--
To be able to handle superscripts and subscripts you can use a string of Image components in a horizontal screen arrangement. then have images for all chemical symbols, superscripts and subscripts created with an image editor like GIMP (it supports typing text and can do superscripts and subscripts) and they can even be different sizes as long as they don't extend over or under other symbols. You would put the component name blocks for each Image component in a list and using an index, add symbols to the images using Image component advanced Image.Picture to blocks.

--

댓글 없음:

댓글 쓰기