Here is a NEW and upcoming feature for UCcnc macros. You will be able to build a conversational Macro WIZARD (;-). This is an example of a Bolt Circle Wizard built as a macro and can be called as a Mcode or a button code.
(;-) TP
Here is a NEW and upcoming feature for UCcnc macros. You will be able to build a conversational Macro WIZARD (;-). This is an example of a Bolt Circle Wizard built as a macro and can be called as a Mcode or a button code.
(;-) TP
That looks a nice feature. Thanks for sharing.
These can be really useful, nice to be able to stay within the software to build up a program as you go.
Mark
TP,
Has this Macro Wizard come from here? or rather using this type of macro call?
The macro text typed into the macro file is inside a function of a class and therefor defining other functions and global variables directly inside the macro is not possible.
Defining global variables and functions is possible only at the end of the macro text file with writting the #Events text into the macro, this text will let the UCCNC know that the remaining text of the macro has to be compiled outside of the function, but still inside the macro class.
The following example shows a simple macro which creates a Windows Form and adding a button to it and assigning an event handler to the button's click event.
The example also declares a function which is then called from inside the macro.
Button MyButton = new Button();
MyButton.Size = new System.Drawing.Size(80, 40);
MyButton.Location = new System.Drawing.Point(110, 130);
MyButton.Text = "Press me";
MyButton.Click += new EventHandler(MyButton_Click);
MyForm = new Form();
MyForm.Size = new System.Drawing.Size(300, 300);
MyForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n;
MyForm.Controls.Add(MyButton);
MyForm.ShowDialog();
MyFunction();
#Events
Form MyForm; //This is a global variable, a Windows Form
void MyButton_Click(object sender, EventArgs e)
{
MessageBox.Show("Mybutton was clicked!");
MyForm.Close();
}
void MyFunction()
{
exec.Code("G0 X10");
}
Does this mean that these form methods will become available?
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
Thanks
Rob
HI Robert YES it came from that type of macro using the #events feature. NOW exactly what else it can use I have no idea I used it to teh point of creating a wizard and have not done any more exploring . I used Sharp Develope to create the form design and graphed the script code into the macro. I then had to juggle a few things around to make it all work. One of the major thing I had to figure out with Balazs help is you HAVE to define the Form variables(textBox) in teh event section. There they become gobal and the form can see them AND teh #event side can use them. IF they are defined on the form side then teh Event side cannot see them. SO if you needed to used the variable to do a function it would not work.
I can send you the script of that wizard if you want to see it. It aint pretty but it does work.
(;-) TP
(;-) TP
TP,
Thanks for the heads up on Sharp Develop (never heard of it before, taking a look at present).
Yes I'd like to have a look, the "prettiness" of the script doesn't matter, its just nice to see more examples, so you can get an idea of what others have done that worked, what it looks like, and give ideas of what to try.
Thanks again,
Rob
HI Robert you may want top consider Visual Studio 2010 express for building teh Macro Wizard elements.
(;-) TP