Hello Guest it is April 19, 2024, 04:35:35 PM

Author Topic: Need help with new macro or wizard  (Read 10875 times)

0 Members and 1 Guest are viewing this topic.

Offline Scott

*
  •  139 139
    • View Profile
Need help with new macro or wizard
« on: November 15, 2006, 01:27:15 PM »
I'm new to Mach and VB and having come from a situation that used plain basic, I have need for a macro or a wizard to replace one that I used with my old controller.

Basically what I need to do is this.  I make a lot of plaques in varying sizes that need to have hangslots cut with a keyhole bit for hanging the plaque on a wall.  Some of these plaques need to have a vertical and horizontal slot, some need only one slot, and some may need two vertical slots.  Most are centered one inch in from the edge and two inches long and some are one inch in from each edge and one inch or less long.  I would input the various information and how many need to be cut.  The tool needs to park clear of the fixture and wait until I get the next plaque locked in, then with the push of a momentary button on the gantry, it would do the next one and so on until the count is met.  At that time the tool will again go to the clear position and turn off the router.

A macro that can ask for all the info and then execute would be fine, but I'm not experienced enough to know the proper syntax for everything that would be needed.

A wizard may be nice, but that's beyond my limits at the moment  ;)  Any help would be appreciated!     
Scott
Re: Need help with new macro or wizard
« Reply #1 on: November 17, 2006, 09:38:48 AM »
Open up any of the wizards that I did in the past (other then the NFS set) and you can use the code in it for a base to start from :)

Hope that helps
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline Scott

*
  •  139 139
    • View Profile
Re: Need help with new macro or wizard
« Reply #2 on: November 17, 2006, 02:15:26 PM »
Thanks Brian,

I didn't know that all of those had screen sets also.  I've got it figured out how to make the screen and have it show up in the list, but I'm going to need some help with parts of it if you don't mind.  ;)  I noticed that Screen4 won't show some of the objects in the layout.  Image buttons, images, and some leds aren't shown as they should be.

I'd like to make a graphic that I could choose one or more locations to be applied to the final code.  How do you make multiple selections?

I would also like to have the machine park at a specified distance away from the fixture and wait for me to push a momentary switch located on the gantry (you may recall talking about this at the Kansas camp).  The switch is currently set to limit/home A, port 1 pin 13.  How would I make it wait and monitor the condition of that switch and then step back into the loop once pressed?

Thanks
Scott
Re: Need help with new macro or wizard
« Reply #3 on: November 17, 2006, 10:02:06 PM »
Benny is the one that can help you with Screen4

And the best thing is to play with the wizards and if you see something that you think you would like to do... look at the code under the button :) That is the best way to learn...
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline Scott

*
  •  139 139
    • View Profile
Re: Need help with new macro or wizard
« Reply #4 on: November 28, 2006, 01:02:58 AM »
Well, I've just about got my "Hanglsot" wizard finished.  I've got one script problem that I can't seem to get to work though.  If you look at the screen shot, you can see that I have six positional leds (two pairs and two singles).  I have all the different combinations working for "good" combinations and all but one for the bad combinations.  I can't get a "If Not - And Not - And Not - And Not - Then -  warning message" to work for when all leds are off.  It wants to always drop through.  All other "If Not" or "And" four ways work fine, but that one doesn't.  I guess it's not necessary, but I have all the other "bad combinations" working to throw up a warning so it would be nice to have the all off scenario work too.  Any ideas?

Thanks
Scott

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Need help with new macro or wizard
« Reply #5 on: November 28, 2006, 05:39:38 AM »
Give each LED a number then add them up and if number is zero show warning, you can check any combination of led's then.

E.G.

led1=1
led2=2
led3=4
led4=8
led5=16
led6=32

ledcount=0
if led1 is on ledcount=ledcount+led1
if led2 is on ledcount=ledcount+led2
etc.......

if ledcount=0 "warning"

case ledcount

when 3 "led 1 and 2 are on"
when 12 "led 3 and 4 are on"
.....
end case

Graham.
« Last Edit: November 28, 2006, 05:45:10 AM by Graham Waterworth »
Without engineers the world stops

Offline Scott

*
  •  139 139
    • View Profile
Re: Need help with new macro or wizard
« Reply #6 on: November 28, 2006, 01:43:16 PM »
Thanks Graham!

That works great!  :)  Much better than a bunch of "If, If And, and If Not's".  I would've never come up with that solution on my own, but then again, I'm just learning all this VB script stuff.  Thanks for todays lesson.  ;)

If it would be of any use to anyone else, I'll post it here when completed.  No warranty expressed or implied!  :P 


I didn't see your "Case Select" addition there before I posted.  It works well without it, but that's another way to skin it.

Thanks
« Last Edit: November 28, 2006, 01:47:18 PM by Scott »
Scott

Offline ART

*
  • *
  •  1,702 1,702
  • Tough as soggy paper.
    • View Profile
Re: Need help with new macro or wizard
« Reply #7 on: December 01, 2006, 09:27:43 AM »
Scott:

 Very Clever.. Very nice wizard, I love to see the cooperation shown on this. Its what its all about, my thx to all involved..

Art

Offline Scott

*
  •  139 139
    • View Profile
Re: Need help with new macro or wizard
« Reply #8 on: December 02, 2006, 02:23:30 AM »
 :o Wow, thanks Art!  Coming from the master coder, that's a treasured complement.  ;)

I've just about got it finished, but I've got so much other stuff to do that it'll have to wait just a bit more.  I've actually used it for about fifty plaques so far and it works great.

Now if I could just get my other problems worked out.....(as he slowly turns and heads off for the CV thread)..... :(
Scott

Offline Scott

*
  •  139 139
    • View Profile
Re: Need help with new macro or wizard
« Reply #9 on: December 10, 2006, 03:30:58 PM »
Once a wizard is finished, what's the accepted method for distribution?  Just a zip file here for anyone who wants to give it a try or something else?

Just wanted to know before I zip one up here.

Thanks,
Scott