Jump to content
Developer Wiki and Function Reference Links ×

Super Publish for Spotlight


Recommended Posts

After re-publishing documents countless times because I forgot to do something in Spotlight, I have decided to embark on the journey of creating a "catch-all" publish script for VWX Spotlight, and I want to call it Super Publish.

 

Spoiler alert, writing scripts is not my jam and I didn't make it very far. Below I've outlined exactly what I'm trying to get this script to do and I think lots of people would enjoy it:

 

1. Recalculate all Worksheets in the Document

2. Update All Schematic View Objects

3. Refresh All Lighting Devices

3. Renumber All Sheets based on Stacking Order / Page Number

4. Save

5. Publish

 

NOTES: 

 

- I know that the Publish Command already has an option to recalculate all Worksheets. But I would like to see the worksheet update prior to waiting for the publish to finish as this is where I can often find errors in the document. Ideally I can have my Key Worksheet visible in the background -> start the Super Publish Script -> have the Key Worksheet Update and Refresh -> then receive a prompt to choose to continue with steps 2 thru 5. (Yes yes, I could just refresh the WS before starting Super Publish, but where is the fun in that?)

 

- As for renumbering sheet layers, it looks like @michaelk has the best solution out there but it has more control than I need and I always have to run it twice. We aren't using pre-fixes, blocked numbers, or anything of that sort. I just want to straight-up start at 1 and re-number sheets sequentially based on stacking order. I think this can be achieved without any user input just by re-configuring @michaelk's script to run twice with set values. The first pass would use some obscure prefix like "z" start at a value of "1" and end at a value of "200". The second pass would then start, have no value for the prefix, a start at a value of "1" and end at a value of "200". It's clunky, but this is what I have to do anyways and I'm sure a script could do it faster than I could.

 

- In my mind Super Publish works just fine as a "fire-and-forget" menu command. But if any of you geniuses have sorted out the madness of creating functional dialogues I picture Super Publish could also work well as a Dialogue where each step is a checkbox and users can decide which components to use. 

 

Below is how far I've made it writing the script. It doesn't give me an error message, so I assume it's working for the most part. Notably not present is anything to do with showing the refreshed WS or Renumbering Sheets.

 

PROCEDURE SuperPublish;

VAR 
  i, n : INTEGER;
  objName : STRING;
  foundObject : HANDLE;
  OK : BOOLEAN; 

FUNCTION DoIt (h : HANDLE) : BOOLEAN;
BEGIN
  RECALCULATEWS(h);
  RESETOBJECT(h);              { these two lines   }
  RESETOBJECT(GETWSIMAGE(h));  { are the key part! }
END;

BEGIN
  n := NAMENUM; 
  FOR i := 1 TO n DO BEGIN
    foundObject := GETOBJECT(NAMELIST(i));
    IF GETTYPE(foundObject) = 18 THEN ok := DoIt(foundObject);
  END; 

DoMenuTextByName('Update All Schematic Views',0) ;

DoMenuTextByName('Save',0) ;

DoMenuTextByName('Publish',0) ;
  END;

RUN(SuperPublish);

 

To anybody who made it this far, thank you for coming to my Ted Talk! It was the forums that helped me get to this point and any help is greatly appreciated! Hopefully the end result will be a great help to my fellow Spotlight Users! 

 

Link to comment

I think it's all possible except for steps 3 and 5.

 

I could be very wrong about this.  I wrote that sheet renumbering script a while ago and I don't remember all the issues.  But I think the script has to end for all the new values to be committed.  Again, I might be wrong, but I recall trying to make it run twice so I wouldn't have to do exactly what you are doing, and I couldn't get it to go.

 

I'm only familiar with the PublishSavedSet function.  And if you change the sheet numbers in step 3, your saved set will kick up an error and the function will fail..

Link to comment

I wonder if you could rewrite my script to bypass the dialog box.  Like you said, set the prefix to something crazy.  Start at 1, end at 200.  Make it into a menu command.  Duplicate it remove the prefix setting and make it another menu command.

 

Maybe you could use DoMenuTextByName to run them both.  Worth a try.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...