Jump to content
OMRON Forums

Format of {list}


daves
 Share

Recommended Posts

Is it only possible to have literals in {list} ?

 

Is it to be expected that I cannot have the following in script:

 

#define MAXMOTOR1 27
#define MAXMOTOR 28

kill 1..MAXMOTOR-1;
kill 1..MAXMOTOR1;
kill 1..Sys.MaxMotors-1;
L0=MAXMOTOR1;
kill 1..L0;

 

I have to do

 

kill 1..27;

 

and if I change the numbering of the motors I have to remember to find and change this code?

 

I couldn't find the formal specification for {list} {constant} etc...

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

In the Command Syntax Summary, "list" is defined as a set of integer constants, which means literal numeric integer values.

 

Apologies, that explains everything very well. Another example of me searching the manuals for the wrong phrases and giving up too soon.

 

However don't you think a #define is equivalent to a constant in one of those cases? Or are #defines implemented differently to a substitution in script? Maybe it is simply a parsing error on a valid command, I would really like to be able to do this.

Link to comment
Share on other sites

The "#define" text substitutions do work in this context, with a couple of provisos:

 

1. The #define is done in the project manager

2. The substitution is for an integer constant

 

So I defined in my globaldefinitions.pmh:

 

#define MyMaxMotor 27

 

Then I could do in a program:

 

kill 1..MyMaxMotor

 

I could not do:

 

kill 1..MyMaxMotor-1

Link to comment
Share on other sites

Trying this as you describe in a new project it fails to download with

 

C:\Users\daves.ABD\Documents\PowerPmacSuite\PowerPmac11\PowerPmac11\PMAC Script Language\Motion Programs\prog1.pmc(7,1) : Error : ( error #31) invalid code : kill 1..MyMaxMotor

 

PS not sure what you meant by "project manager" but I followed the subsequent description.

 

IDE 1.6.0.109 FW 1.6.0.30

Link to comment
Share on other sites

Ahh, I see. In that syntax, the project manager needs a space before the defined name to recognize it as a separate entity to substitute for. So

 

kill 1 .. MyMaxMotor

 

will work, but

 

kill 1..MyMaxMotor

 

will not.

 

Interestingly, if you do this from the terminal command line after downloading the project,

 

cx kill 1..MyMaxMotor

 

is accepted as legal syntax and works. I'm not sure why the difference.

Link to comment
Share on other sites

Great, thanks for figuring it out, this works for me!

 

Looks like a parser error protecting structure elements being substituted out maybe? Anyway, I would probably suggest entering a bug report to fix it as there is no real reason for it to be this way.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...