I try to pass the bool bake value from one class(attribute class) to the solve instance(buttonTest class). I already tried several things as the Get Method and write a property without sucess.
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);
}
}
}
I am a beginner so I hope it is possible to understand.
Thanks to everybody
if I try to use m_attributes.Bake I get the following error message: error message
If I understood the question correctly, you need something like the following.
The buttonTestComponent class:
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
}
}
And you leave Attributes_Custom class as it is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.