Hello Guest it is March 02, 2021, 03:35:29 AM

Author Topic: Unknown Word starting with a , Block  (Read 480 times)

0 Members and 1 Guest are viewing this topic.

Unknown Word starting with a , Block
« on: November 01, 2020, 02:02:58 PM »
Hi all

Please Help.
I get the above error while posting code generated by a Wizard Script that I am working on.
I do not get errors in the Script editor but only while posting to Mach3.

Full error Message:

Unknown Word starting with a , Block G1X [Tan[Ang / 2]]*[R*[1 - Cos[#203]]]  A#203 on line 11

Been trying all afternoon to find the problem but no luck.

A nudge in the right direction will be appreciated.

Thanks
Deon

Full code to follow.

%
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
G0 Z95
G0 A0.000 X0.000  F6
M98 P01 L72
G0
G92 X
M98 P02 L180
M30
o01
M8
G1X [Tan[Ang / 2]]*[R*[1 - Cos[#203]]]  A#203
#203=#207+#203
M99
%
« Last Edit: November 01, 2020, 02:07:57 PM by Deon Gerber »
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.

Offline Graham Waterworth

*
  • *
  •  2,274 2,274
  • Yorkshire Dales, England
    • View Profile
Re: Unknown Word starting with a , Block
« Reply #1 on: November 01, 2020, 07:24:56 PM »
Where is it getting 'R' from?

Split it down and try to see where the fault is.

G1X [Tan[Ang / 2]]*[R*[1 - Cos[#203]]]  A#203

Without engineers the world stops
Re: Unknown Word starting with a , Block
« Reply #2 on: November 02, 2020, 12:53:08 AM »
Thx for the reply. Now that you mentioned R...........Mabe I must also declare R and Ang as variables(setVar). I had .a problem with my normal naming syntax of variables whate I used an A as Angle........it did not like that. Interfered with A Axis. Will try it when I get home. Thanks
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.

Offline Graham Waterworth

*
  • *
  •  2,274 2,274
  • Yorkshire Dales, England
    • View Profile
Re: Unknown Word starting with a , Block
« Reply #3 on: November 02, 2020, 03:42:37 PM »
You need to put every variable into a #number and then use them for the maths.

e.g.
G21 G40 G00 G90
G00 X0 Y0
#100 = 45 (Angle)
#101 = 2.5 (length)
#102 = [SIN[[#100 / 2]]]
#103 = [#102 * #101]
#104 = [COS[[#100 / 2]]]
#105 = [#104 * #101]
G00 X#103 Y#105
M30


Etc.
Without engineers the world stops
Re: Unknown Word starting with a , Block
« Reply #4 on: November 03, 2020, 06:13:57 AM »
Hi Graham
Thanks for the tip. I have done the following.
' G1X [Tan[Ang / 2]]*[R*[1 - Cos[#203]]]  A#203
'*******************************


Setvar(101,  tan(Ang/2))
Setvar(102,   R)
Setvar(103,   D)
Setvar(104,   Num)
Setvar(105,   ADiv)

Code "G1 X [#101*[#102 *[1-cos[#104]]]] A#104"
Code "#104=[#105+#104]"

It seems to not be happy with the 1-cos[#104] part of the macro.

Not sure how to reduce this into a single Var because with the line just after that #104 gets update by an increment each time for the rest of the cycles the sub is running.

Thanks for your help in advance.
Regards
Deon.
« Last Edit: November 03, 2020, 06:17:12 AM by Deon Gerber »
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.

Offline Graham Waterworth

*
  • *
  •  2,274 2,274
  • Yorkshire Dales, England
    • View Profile
Re: Unknown Word starting with a , Block
« Reply #5 on: November 03, 2020, 05:21:42 PM »
I am confused now, are you wanting to do this in VB or in Gcode you have given examples of both.
« Last Edit: November 03, 2020, 05:27:00 PM by Graham Waterworth »
Without engineers the world stops
Re: Unknown Word starting with a , Block
« Reply #6 on: November 04, 2020, 05:54:37 AM »
Hi

Sorry for the confusion. You are correct. The last post I showed the VBscript that runs to output the GCode in the first post.
The VBscript runs with out any errors showing up in Mach3's VB editor. But the toolpath do not display in the toolpath window. When you exit the Wizard then Mach3 is complaining about a bad carracter in the gcode. (The line I mentioned in the first post)
If I remove the [1-Cos[#104]] then Mach3 do not complain about the code anymore. Telling me that the format in that part of the equation is the problem.
Obviously the output gcode is then not what I need, thats why I asked if there was a way to simplify that part of the equation in the VBscript.
Hope all will make better sense now.
Thanks for trying to help.
Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.

Offline Graham Waterworth

*
  • *
  •  2,274 2,274
  • Yorkshire Dales, England
    • View Profile
Re: Unknown Word starting with a , Block
« Reply #7 on: November 04, 2020, 06:53:51 PM »
Replace the 1 with a # var

g00 g90 x0 y0
#106 =1
#104 = 30
#107 =  [#106 - [Cos[#104]]]
g00 x#107
m30
« Last Edit: November 04, 2020, 06:59:26 PM by Graham Waterworth »
Without engineers the world stops

Offline TPS

*
  •  2,005 2,005
    • View Profile
Re: Unknown Word starting with a , Block
« Reply #8 on: November 05, 2020, 01:29:43 AM »
can you explain what you want to do.
might be easier to get a solution.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Unknown Word starting with a , Block
« Reply #9 on: November 05, 2020, 02:40:42 AM »
Hi Graham

Thx. That looks like its been solved. Am I safe to assume that it does not like the numerical value of 1.

Thanks for the help.

Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.