Grasshopper

algorithmic modeling for Rhino

Guys,

 

I need to control some parameters in Grasshopper from an external tool, so I need to know how to make a batch file for the grasshopper? Does anyone know?

 

I do really have problem in my research. Any help would be appreciated a lot.

 

Thanks,

 

M

Views: 772

Replies to This Discussion

What about GHowl component ?
grasshopper is a very good platform to call the other apps ,and gh can edit and run batch file , so I wonder in which platform/tools you wanna call grasshopper.

 private void fire_grasshopper(string Address, Boolean reading_from_file)
        {
            string text_in;
            //read data
            if (reading_from_file)
            {
                text_in = read_file();
            }
            else
            { text_in = Address; }
            //open grasshopper
            Grasshopper.Plugin.GH_RhinoScriptInterface obj = Rhino.RhinoApp.GetPlugInObject("Grasshopper") as Grasshopper.Plugin.GH_RhinoScriptInterface;

            obj.DisableBanner();
            obj.CloseAllDocuments();
            obj.HideEditor();
            obj.DisableSolver();
            obj.OpenDocument(text_in);
            obj.EnableSolver();
            find_definition_grasshopper();
            execute_grasshopper();
           
           
            obj.CloseAllDocuments();
        }

        private void execute_grasshopper()
        {
            Grasshopper.Kernel.GH_DocumentServer docServer = Grasshopper.GH_InstanceServer.DocumentServer;
            Grasshopper.Kernel.GH_Document doc_grass = docServer[0];
            Grasshopper.Kernel.IGH_DocumentObject grass_node = find_node(doc_grass, "bake");
            if (grass_node != null)
            {
                Grasshopper.Kernel.Parameters.Param_GenericObject param_generic;
                try
                {
                    param_generic = (Grasshopper.Kernel.Parameters.Param_GenericObject)grass_node;
                    param_generic.CollectData();
                    if (param_generic.IsBakeCapable == true)
                    {
                        param_generic.BakeGeometry(doctoplevel, new List<Guid>());
                    }
                }
                catch (System.InvalidCastException)
                {
                    Rhino.UI.Dialogs.ShowMessageBox("please use generic data primitive", "ERROR");
                }
                finally { }
            }

 

this is an example how to call grasshopper and bake a component

Thanks a lot Micheal, It is VB or C# definition?
thats C#

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service