Grasshopper

algorithmic modeling for Rhino

I am trying to make a component with three additional Menu Items. It works well when I change options and do nothing. But I found a problem, that if I run some command(like flip or something) in Rhino, and after I change the Component's options, the result goes empty. I don't know why this happens. Can I do anything to fix it?

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Grasshopper.Kernel.Types.GH_Surface srf=null;

            if (!DA.GetData<Grasshopper.Kernel.Types.GH_Surface>(0, ref srf))
            {
                return;
            }
           
            Rhino.Geometry.Brep b= null;
            b = srf.Value.DuplicateBrep();
            Rhino.Geometry.Surface s = b.Faces[0];
            if (this.rv_u)
            {
                s=s.Reverse(0,false);
            }
            if (this.rv_v)
            {
                s=s.Reverse(1, false); ;
            }
            DA.SetData(0, s);
        }

Views: 418

Replies to This Discussion

Did you test your s variable before the SetData call to see if it is null or not?

Thanks David. I didn't call ExpireSolution. But  I called ClearData CollectData and ComputeData, one by one instead, and it does not work.

1.I think value rv_u and rv_v keep false!

2.When menu_item clicked, you forgot to ExpireSolution;

Thank you very much Panda, That's the problem. D

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service