
rz90208
I need some help with a plugin I am working on. I am new to C# and OOP.
Have went thru the Tutorial and the SDK Tutorials also.
How do I get the values from the form in to my C# code?Code:
public enum LocationType
{
Wall = 255,
Empty = 0,
Destination = 254,
Source = 1
}
public struct Location
{
instead of Wall = 255, how do I get Wall = textBox1.Text. textBox1 being the Textbox name.
Thanks
RichardZ
Code:
If you're collecting input from a user, I'd go with option #1
I have decided to leave the values for Robot, Empty, Wall and Goal as set values.
Having them as part of an enumeration is my problem there I think.
In the picture I posted, Map Variable is $MyMap. This is a string of 6400 characters. Each character represents a 1'x1' block. How do I get this variable from ARC into my C#? I plan to use 2 for loops to move the data from the $MyMap variable to a 2 dimension array in the plugin.
Code:
If your wall value is an enum you should use a ComboBox to capture the user input.
To load the ComboBox LocationTypeComboBox:
Code:
To get the enum from the ComboBox:
Code:
The "Standard" for a Label and Input is:
Label TextBox
Label ComboBox
...
I believe this is what I was missing.
I have picked up a few books on C# and going thru the lessons. catching on to the syntax easy enough but some of the concepts are a bit tough to get my head around. It is a bit different from TRS-80 Basic.
An exception of type 'System.Exception' occurred in ARC.exe but was not handled in user code
Additional information: Variable is an array: $MyMap
Makes sense to me. in ARC $MyMap is an array of 6400
the line of code reads:
Code:
You mentioned a string.
if your variable is an Array:
Code:
EZ-Script doesn't have typed types, GetVariable always returns a string.
My method will convert the string or array of strings to the type specified in the invocation.
Examples:
Code:
although is your responsibility to store the correct data type when using EZ-Script.
Code:
I am working on a wavefront navigation plugin and $MyMap is the flat array of the house (80x80). I have written it in EZ-Script but it was extremely slow. So I decided to make a plugin. I have sense discovered that it I get rid of the variable monitor, the array initializes in less the a second instead of 20 min. I have thought of going back to the EZ-Script version but It is about time I learned C# anyway. My son if fluent in C# OOP, but he is so busy with his work and his 2 autistic children. I will read thru the code and get back with you soon. I could attach my C# project and the EZ-Script for that matter if you like.
Thanks again
RichardZ
Sounds like you have a pretty interesting and fun project over there! I bet everyone is excited to see and hear more - I sure am!
Is this valid?
It does not give me an error but it does not seem to work ether.
Code:
Check the previously mentioned tutorial for creating arrays: http://www.ez-robot.com/Tutorials/UserTutorials/146/18
Ended up with this:
Code:
Digging thru the Object Browser and a lot of trial & even more error, I am getting close.
I will have a write up on it soon.
For now, you give the plugin a map of your home.
$MyMap
255 = Wall
254 = The Robot
1 = The Goal
0 = Open Space
Call the plugin and it will Return an Array named $MyRoute.
With in the Array Starting from the Robots position a "-" indicates the next location to move towards the goal.
So if you have an 80x80 map, $MyRoute[0 - 79] is column 0, [80 - 159] is column 1and so on.
On my map North and West are 0,0
To move east on the map +1 to current position, to move south +80 to current position. - 80 for north, -1 west.
Now to add movement and object avoidance. My plan is.. if an object is detected, mark the position on the map and resubmit it to the plugin to get a new solution.
Thank you both for your help.
Hope to have it public soon.
RichardZ
Or since you know the size of the array, you can do this...
Code: