DWG to SHP batch - don't ask user for projection

jamiefinneyjamiefinney Global Mapper UserPosts: 1
edited May 2015 in GM Script Language
Hi i'm trying to write a script to batch a folder of DWG's to SHP's

The script works with the exception that it asks the user to set the projection of the export.

How can i automate this step so there is no user intervention required.

thanks in advance :)

this is what i have so far - i couldn't see how to put this into a code block so here's hoping it does this automatically.

*********************

GLOBAL_MAPPER_SCRIPT VERSION=1.00

/Define Projection
DEFINE_PROJ PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
Projection GREATBRITAIN_GRID
Datum OSGB_1936
Zunits NO
Units METERS
Xshift 0.000000
Yshift 0.000000
Parameters
END_DEFINE_PROJ

/Setup directory to loop
DIR_LOOP_START DIRECTORY="G:\DWG To SHP\" FILENAME_MASKS="*.dwg" RECURSE_DIR=NO PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"

/Wildcard to keep file names
IMPORT FILENAME="%FNAME_W_DIR%"

/LOAD_PROJECTION PROJ_NAME="BRIT_GRD_OSGB36_BEST_TRANSFORM"
LOAD_PROJECTION PROJ="BRIT_GRD_OSGB36_BEST_TRANSFORM"

/Export Vector to SHP
EXPORT_VECTOR FILENAME="G:\DWG To SHP\SHP\%FNAME_WO_EXT%.shp" TYPE=SHAPEFILE GEN_PRJ_FILE=YES

/Unload all files
UNLOAD_ALL

/Finish loop and end script
DIR_LOOP_END

Comments

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,233
    edited May 2015
    Hi,

    What version of Global Mapper are you using? To wrap your script in a code block, use the # button in the editor.

    I see a couple of things:
    1) the DIR_LOOP_START command does not have a PROJ_NAME parameter.
    2) When you split a command over multiple lines, each line (except the last one) must end with "\<newline>". I don't see those in your script, but that might be due to the fact that you didn't use a code block.

    Can you tell which command is prompting for the projection?

    Cheers,

    Bob
Sign In or Register to comment.