33
4 Apr/11

agMathParser: Math expression –> ICE

[Version 1.1 reuse bug fix added]

I want to share this small tool. It is a math expression to ICE compound converter. (Softimage 2011)

Donwload agMathParser 1.1 (Right click – SaveAs or drag and drop into softimage)

Supported functions:

  • +, -, *, /, ^,  %
  • sin, cos, tan, asin, acos, atan
  • sqrt, abs, min, max, floor, log, ln
  • PI, E

Install the addon, and execute it at Ice Tree View\User Tools\agMath Parser.
If you find any error, please tell me and indicate the expression taht cause the error.

Any comments or ideas are welcome too. :)

 

Share

No related posts.

You can leave a response, or trackback from your own site.

33 Responses to “agMathParser: Math expression –> ICE”

  1. alex says:

    SI 2011.5
    Encountered an error:
    # ERROR : 2000-EDIT-ConnectICENodes – The nodes you are trying to connect are not in the same container
    as well as
    # ERROR : 2000 – Argument 0 (Port) is invalid
    # ERROR : 2001-EDIT-AddPortToICENode – Argument 0 is invalid
    # ERROR : 2000 – Argument 0 (InputObj) is invalid
    # ERROR : 2006-SIMU-CreateICECompoundNode – Unexpected failure.
     
    first compound is executed without problems but all the subsequent ones get an error.
     
    Great and time saving idea, btw. Thanks for sharing.

  2. agedito says:

    Hello Alex, what expression cause the error?

    • alex says:

      Hi Angel, just about any expression except the first one executed on a given ice tree causes an error. Sometimes, it will just fail to connect nodes properly. Heres a screenshot:
      http://img195.imageshack.us/img195/9575/16804212.png
       
      Dont think this could be excursively a problem on my machine, but i would wait for more people to report it.

      • agedito says:

        Thanks Alex, I found the bug and now it’s fixed.

        I not detected it becouse before upload the addon I delete a souce line that I think that not was needed buy it’s seem that is essential.

  3. César says:

    Nice idea!

    Does it have some kind of support to add new functions by users?

    • agedito says:

      Hi Cesar, yes and no.

      You can add a lot of new ICE nodes in the config.py file.
      But others nodes are not so trivial to modify, for example cos node. Is the same node that sin one, but you must change the configuration. Other example is ln (Neper logarithm) becouse is not dafault ice supported, internally add the E constant node.

      In a second version I add new config possibilities, and rewrite the code. That addon was my first experience with the ast module (a wondefurll python parser module) and I have some source code changes in mind.

       

  4. Robi says:

    GREAT Tool, man, Many Thanks for sharing!!!!!!

  5. Great idea! And thanks for sharing.

  6. Malcolm says:

    Hi Angel.

    It´s fantastic,  i have 2 ideas for features right now.

    1.Add ability to get back expression to editor (just get compound expression comment!?) 
    2.Add PHI (Phibonacci) constant. 

    Thanks, and continue good work!  ;)

  7. Malcolm says:

    Hi Angel, i found a error in parse order in comment of compound created.

    Note the order of execution parenthesis.

    If formula is (1 + sqrt(5) )/ 2  the result comment of compound is wrong missing parenthesis : “1 + sqrt(5) / 2″ but the result in formula is correct 1.618 (PHI constant formula)

    it´s a problem because if i use the wrong comment “1 + sqrt(5) / 2″ result to rebuild formula the result is wrong order of execution formula resulting in erroneous PHI contant of 2.118 !

    Malcolm.

    • agedito says:

      Hello Malcom, you are right. There is a bug writting the comment.  I’ll solve it as soon as possible.

      Phi constant is a good candidate to add to the parser. I’ll released soon a new version with more customization possibilities. But phi will be a default constant in the new version ;)

      What do you mean with your first idea? Writhe the parsed expression to the script editor.

       

      If you have any new suggernce tell me :)

      Thanks for the report.

  8. [...] math node generator translating expressions to an ICE Compound. Nifty! You can download it here agedito.com/?blog/??p=134 (new version 1.1 [...]

  9. Victor says:

    All data is scalar. It is not very convenient.

  10. Fabricio says:

    Hi Angel,
    one thing I noticed is you define all your variables with constants right inside the compound. I tend to avoid it because then you can’t use arrays on the expressions… just an idea.
    Either way, nice addon!
    thanks.

  11. Chris says:

    Thanks for making this for everyone. :)

  12. peters says:

    just brilliant
    Something similare would make sense also for the render tree .I’d released a second version fixing a bug.
    Finally if you have time,please must visit <a href=”http://www.flyermilescard.com/”>my blog</a>.I want more and more people visit my blog.Therefore i need your attention and give me some advice. and I’m looking forward for your next post.

  13. Ramon says:

    Hi I have no buttons Parse and refresh, just 2 lines
    # ImportError: No module named modules.Views
    #  – [line 60 in \\...\Workgroup_XSI_2011_64\Addons\agMathParser\Application\Plugins\agMathParserPlugin.py]

  14. Ramon says:

    is it possible to math like this

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:”Обычная таблица”;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:”";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin-top:0cm;
    mso-para-margin-right:0cm;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0cm;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:”Calibri”,”sans-serif”;
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:”Times New Roman”;
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:”Times New Roman”;
    mso-bidi-theme-font:minor-bidi;}

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:”Обычная таблица”;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:”";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin-top:0cm;
    mso-para-margin-right:0cm;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0cm;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:”Calibri”,”sans-serif”;
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:”Times New Roman”;
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:”Times New Roman”;
    mso-bidi-theme-font:minor-bidi;}

    X3*y4*y1-x2*y2*y4

    • Ramon says:

      Sorry!
      INFO : 4034 – Loaded scene was created with build number: 10.1.62.0 – compatibility version: 1000
      ‘ ERROR : Traceback (most recent call last):
      ‘   File “<Script Block 2>”, line 84, in agMathParser_Property_DefineLayout
      ‘     draw(oLayout, None)
      ‘   File “<Script Block 2>”, line 61, in draw
      ‘     from modules.Views import GetIceContainersComboData
      ‘ ImportError: No module named modules.Views
      ‘  – [line 60 in C:\Users\RoN43\Autodesk\Softimage_2012_SP1\Addons\agMathParser\Application\Plugins\agMathParserPlugin.py]

  15. Ramon says:

    Find problem: not work in my custom layout! work in default

  16. merci pour l’information

  17. merci pour l’information

  18. je pense que votre article est assez complet

  19. votre contribution m’aide beaucoup, merci pour cette information

  20. premastop says:

    merci pour la contribution

Leave a Reply