0

bool ベイク値を 1 つのクラス (属性クラス) からソルブ インスタンス (buttonTest クラス) に渡そうとします。私はすでにGetメソッドとしていくつかのことを試し、成功せずにプロパティを書きました。

namespace buttonTest
{
   public class buttonTestComponent : GH_Component
   {      
     public override void CreateAttributes()
     {
       m_attributes = new Attributes_Custom(this);
     }

   protected override void SolveInstance(IGH_DataAccess DA)
   {
       Circle circle = new Circle(2.00);
      //here I want to bake       
   }

   public class Attributes_Custom : GH_ComponentAttributes
   {
       public Attributes_Custom(GH_Component owner) : base(owner) { }
       protected override void Layout()


        bool bake;


       public bool Bake
       {
           get { return bake; }
       }



       public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
       {
           if (e.Button == MouseButtons.Left)
           {
               RectangleF rec = ButtonBounds;
               if (rec.Contains(e.CanvasLocation))
               {
                   bool bake = true;
                   MessageBox.Show("Hello World", "Hello World", MessageBoxButtons.OK);

                   return GH_ObjectResponse.Handled;
               }
           }
           return base.RespondToMouseDown(sender, e);
       }
}

}

初心者ですのでご理解いただけると幸いです。

みんなに感謝

m_attributes.Bake を使用しようとすると、次のエラー メッセージ が表示されます。

4

1 に答える 1

0

質問を正しく理解していれば、次のようなものが必要です。

buttonTestComponentクラス:

public class buttonTestComponent : GH_Component
{    
     private Attributes_Custom m_attributes;

     public override void CreateAttributes()
     {
          m_attributes = new Attributes_Custom(this);
     }

     protected override void SolveInstance(IGH_DataAccess DA)
     {
         Circle circle = new Circle(2.00);
         //use m_attributes.Bake here
     }
}

Attributes_Customクラスはそのままにします。

于 2019-02-26T19:26:50.193 に答える