DEFINE_VAR can't put variable into DEFINE_LAYER_STYLE

I have a project where I need to change the size of custom squares on several layers relatively often. Since the task of going through each layer and making a new custom square is rather tedious, I thought I'd make a script. I wrote it basically like this:


GLOBAL_MAPPER_SCRIPT VERSION=1.00

DEFINE_VAR NAME="SIZE" PROMPT=YES PROMPT_TEXT="Enter size in pixels for TS squares"

DEFINE_LAYER_STYLE NAME="POINT_STYLE" TYPE="POINT"
LayerStyle=1
Type=2
PointStyleForAll=SQUARE_CUSTOM_%SIZE%_56_168_0
FontForAll=Calibri~43064~179212~0.000~0~0~16777215
END_DEFINE_LAYER_STYLE

SET_LAYER_OPTIONS FILENAME="115 KV TS.SHP" POINT_STYLE_NAME="POINT_STYLE"


...and so forth for each layer I have. The script works if the PointStyleForAll line is hard-coded with a pixel size but it can't seem to replace %SIZE% with the variable value. Is this a bug or am I doing something wrong? 

As a follow-up question, is it possible to change ONLY the PointStyleForAll field without overwriting anything else? I.e. can I write something like the following?

DEFINE_LAYER_STYLE NAME="POINT_STYLE" TYPE="POINT"
LayerStyle="UNCHANGED"
Type="UNCHANGED"
PointStyleForAll=SQUARE_CUSTOM_%SIZE%_56_168_0
FontForAll="UNCHANGED"
END_DEFINE_LAYER_STYLE

Thanks!
- first time GM script writer

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,233
    Answer ✓
    The script processor does not do variable substitution on the lines that make up the layer style definition.  You are not doing anything wrong; that is just not supported.  As for your follow-up, are you trying to update an existing layer style?  You can define a layer style with the same name as one that has gone before, but the new definition will replace the old one, not update it.
Sign In or Register to comment.