Hello Guest it is April 18, 2024, 09:25:05 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - stirling

891
VB and the development of wizards / Re: Mach3 script editor bug?
« on: February 09, 2013, 06:26:46 AM »
Yes, print 10/3 displays 3.3333333333333 but that does NOT mean 10/3 EQUALS 3.3333333333333. It means 10/3 equals 3.3333333333333 TO 13 DECIMAL PLACES. There's a world of difference - yes/no?.

Moving on, some questions you might want to ask yourself.

What initial values of BaseX are valid in YOUR program? For that set of valid numbers what does the round function do through your loop? as the numbers are processed, does it round up or down? What does it do if the number at some point ends up as EVEN with a decimal part that is exactly 0.5? what does it do when it's ODD with a 0.5 decimal part?. What does it do if the number goes negetive? Does it matter to YOUR overall program - not just that example fragment with those example numbers?

Sorry - I know you just want a one shot answer but hopefully you'll see why I think I would be wrong to give you one. Maybe someone will come along and explain it better.

and now a pause for thought... ta.twi.tudelft.nl/users/vuik/wi211/disasters.html

Ian


892
VB and the development of wizards / Re: Mach3 script editor bug?
« on: February 08, 2013, 12:31:25 PM »
as I said - this is not JUST binary - this is the world of real numbers. Did you try the 10/3 thing? ;D

anyway... with ref to print and what I said above try this...

Print 0.099999999999999
Print 0.0999999999999999

There are many ways to deal with reals of which rounding is one - whether that's good enough for what you want your program to achieve can only be answered by you. Personally I would always handle > = and < so I KNOW what my prog will do and not assume anything.

Ian

893
VB and the development of wizards / Re: Mach3 script editor bug?
« on: February 08, 2013, 11:14:21 AM »
I have used VB5 and never seen anything like this.
Then you need to look again ;D because this WILL happen in VB5/6/.NET C, C++ and (sooner or later) on every other programming language on any DIGITAL computer this side of Alpha Centauri.

The problem is that REAL numbers will sometimres have an EXACT representation in BINARY (in whatever given format is being used to represent them on any given system) but SOMETIMES the binary format will be a CLOSE but not EXACT representation. It's physically IMPOSSIBLE to represent ALL real numbers in BINARY or any other numeric base for that matter - try writing down the EXACT result of 10/3 in DECIMAL!

You see your prinout saying BaseX = 0.01 BUT it's more likely something like 0.0099999999999999999999999999999999999.

You end up in an endless loop because you've fallen for the trap of NOT testing for the other possibility i.e. is it LESS than 0.01? Tap it into your code and see.

FWIW - many moons (sic) back - I heard the possibly apocryphal story that Apollo 13 actually went tits up because some NASA rookie programmer made the same mistake with real numbers and put a "burn" into an endless loop.  :o

Ian

894
Hiya BR549, Had a bit of a play....

Try this

Code "G1 X1" (any distance that takes longer than the following sleep)
sleep 1000 (any time that's enough to let you FH before it wakes up)
Code "G1 Y1"

If you FH BEFORE a second it quits the first move, DOESN'T FH and immediately executes the second move.
If you FH AFTER a second it correctly FH the first move. If you then hit cycle start it correctly finishes the first move and then correctly does the second move.

Like I said - this is just plain bad. Like you said - it is what it is.

And I wonder why it's proving darn near impossible to release an ABSOLUTELY RELIABLE dynamic probing routine.

Cheers

Stirling

895
(;-) IF you look on the diagnostic page when running the macro then Feedhold you will see WHY it does as it does. When you press feedhold it dumps the buffer and empties the current QUE.
Yo just beat me to it Terry - atta boy! but I came to the same conclusion by experiment.

AS it should really, I do not recall ANY OTHER controller allowing feedhold during MACROs or Canned cycles. But in this case it should have just locked out the FH function.
Well you've got far more experience of other controllers Terry so I'll bow to you on that one - but I can't see any valid reason WHY that should be the case.

HOWEVER - There's an inconsistency here. Feedhold works fine IN A MACRO - IF you buffer but not if you don't - that's just cra*p logic.

Mixing Gcode motion and CB code has ALWAYS been a problem and should be avoided if possible.
Steady there big fella - you'll have the myth police on yo ass!

Cheers

Ian

896
I have not seen any info that has said before that you dont need this loop, would you mind posting some info about where you can omit it

AFAIK there is no such information. I've just spent a lot of time over the years figuring out MY rules of when to use isMoving and when not to. If you look back at the (many) threads discussing isMoving you'll find there isn't even agreement of what it actually DOES never mind when it should be used. All I know is that when I simulated YOUR problem HERE I got the same results as you, but taking out the "isMoving loops" caused Feedhold to work as expected HERE. I have a vague idea of WHY but I'd like to look at it more before offering my throat up to the wolves ;).

Cheers

Ian

897
This appears to be another one of several problems with Feedhold. (There's a bit of a history with bugs in Feedhold).

Mach changed at some point and is now able to queue "some number" of Code statements and execute them in order correctly WITHOUT while isMoving. Usually it doesn't matter though if you still put a while isMoving construct after each Code statement EXCEPT as you've found if you want to be able to feedhold. Taking out the while isMoving constructs should solve your problem.

Just to be clear, I am NOT saying you NEVER need a while isMoving, quite the opposite - it's just that a lot more thought has to be given to when to use them. i.e. they should NOT just be sprinkled about with a wing and a prayer.

Hope this helps

Ian

898
VB and the development of wizards / Re: XML file reader
« on: January 29, 2013, 03:48:06 AM »
 ;D

899
VB and the development of wizards / Re: XML file reader
« on: January 28, 2013, 09:10:01 AM »
Your XML is not particularly well structured (it way over uses attributes and unneccessarily uses different names for otherwise common elements) but here is a quicky example of iterating through each child (Row1, Row2 etc.) of the root node (Tabelle) and printing out the value of the "CNC_Speed" attribute of those child nodes.

Just copy it into the Mach CB editor, CHANGE the variable xmlFile TO THE FULL PATH/FILENAME OF YOUR XML and run. The values will display each second in the message DRO.

I've made no attempt at catching any errors so what you see is what you get  :o.

Code: [Select]
Option Explicit

Dim xmlDoc, xmlFile, xmlRows, i

'create a DOM
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = "false"

'load the xml
xmlFile = "Plasma_Data.xml"
xmlDoc.load (xmlFile)

'get all the children of the Tabelle element i.e. all the Row1, Row2 etc. etc.
Set xmlRows = xmldoc.selectSingleNode("Tabelle").childNodes

'loop through them displaying the CNC_Speed attribute
For i=0 To xmlRows.length - 1
  message xmlRows(i).getAttribute("CNC_Speed")
  sleep 1000 'so we can see them displayed
Next

'tidy up
Set xmlRows = Nothing
Set xmlDoc = Nothing

To season to taste google "XML DOM using VBScript" or similar.

Cheers

Ian

900
VB and the development of wizards / Re: XML file reader
« on: January 27, 2013, 09:20:54 AM »
Can't give you an example without seeing the structure of the xml you want to parse - post it and I'll do you a starter.

Ian