Using a script to set or move an entity to a sheet

Okay, I am trying to update my scripts from CC2 to CC3, and one of them is a script that creates a Border. The script works fine, but I want to add some code to ensure that the border is also added to the correct sheet. I know I can use movesht to move the entity to a sheet and also use sset, but when I try to use either one I get an error. Here is some of the code:

SELBYP
POLY x2,y1 p2 x1,y2 x1-doff,y2+doff x2+doff,y2+doff x2+doff,y1-doff;
CHANGEFS SOLID
CHANGEC locolor
CHANGEL MAP BORDER
MOVESHT MAP BORDER
SSET;

For SSET, I am geting a "ChkDate DAV has no pending DRQ". And for movesht I get a CC3 cannot perform the command.

Any suggestions?

Comments

  • Well...with some more trouble shooting I found that the script was erroring on the line before it, which was a change layer but the layer was frozen. Script works great now...but I have a related question.

    Which is better to use in a script - SSET to set the sheet to the sheet you want and then run the script. Or to use MOVESHT to move the entity to the sheet you want?
  • RalfRalf Administrator, ProFantasy 🖼️ 18 images Mapmaker
    IMO it's generally better to use the MOVESHT command, as it doesn't affect the current sheet. Otherwise you'll have to either make sure you reset the sheet after the operation or you end up on a different one than before the script - which might be confusing to the user.
  • I agree with your opinion Ralf...but...what if you have too many objects being created...would it be easier to save the current sheet name to a value...move to the sheet you want...create the objects...and then move back to the value you saved?

    Reason I am asking is I am updating an old script (not even sure who created it)..It makes a "Nautical Border". The script uses a lot of math so instead of updating all the created entities with a move I was thinking of the save existing sheet name..move to the one it should...do stuff...and then reset back to the sheet name.

    I guess a question is does it really matter if they are created on the MAP Border sheet? I am really trying to update all the old macros and scripts I used in CC2 to take use of CC3 and it seems to me that making sure the marcos/script places the stuff on the right sheet is an important part of it. thoughts?

    My grand scheme is to update all the macros and scripts I had from CC2 to be more CC3...most of the macros and scripts came from the CC2 macro email list...so if anyone wants them let me know and I will either start posting them here or email them (unless someone at Profantasy tells me that is a no no).
  • RalfRalf Administrator, ProFantasy 🖼️ 18 images Mapmaker
    edited March 2010
    Yes, that would be much easier if you have many objects to create. And should generally be no problem either.
  • jaerdaphjaerdaph Traveler
    edited March 2010
    Posted By: Ralf...the MOVESHT command...
    You know, if you read that too quickly, it kind of looks like it says...

    :D
  • So I am still working this issue...I am trying to add to all my scripts the following:

    get the current layer
    get the current sheet
    set to a another layer
    set to another sheet
    do script work
    set back to current layer
    set back to current sheet

    but I keep getting an error on setting the sheet with sset. Can any one help on how sset gets the sheet name. Anytime I do something like:

    sset Sheetname

    I get an error, but I am not sure what sset by itself does. Here is a sample of the code I am trying:

    GL SheetName1 MAP BORDER
    SGETNAME SheetName2
    SETLAYER SheetName1
    SHOWSHT SheetName1
    SSET;

    that works...but doesn't assign the current sheet to the SheetName1.
Sign In or Register to comment.