Snapshot Multiple Bookmarks and Proposals

Snapshot Multiple Bookmarks and Proposals

kwilktrihydro
Advocate Advocate
1,111 Views
10 Replies
Message 1 of 11

Snapshot Multiple Bookmarks and Proposals

kwilktrihydro
Advocate
Advocate

Hi there, 

 

I have a design where we need to show the client 3 different options and the existing site. I have designed each of these as separate proposals in Infraworks. I then have 7 bookmarks (viewpoints) that the client would like me to create snapshots from. 

 

Does anyone know of anyway to automate the creation of these snapshots? Maybe a script? I don't want to go through and create 28 different snapshots each time the client wants to change the design. 

 

Thanks in advance for any help or advice!

 

Kelby

Kelby Wilkison, P.E.
Civil Engineer
Trihydro Corporation
0 Likes
Accepted solutions (1)
1,112 Views
10 Replies
Replies (10)
Message 2 of 11

Glenn.Coppard
Advocate
Advocate

Easily done using scripts, example to get you started HERE by Matt Wunch.

 

@Anonymous  also outlines some of the process he used combining the above  HERE

Message 3 of 11

Glenn.Coppard
Advocate
Advocate

You will probably also what to look at this post HERE from @Matt__W  (again 😉 ) and @elliott.rosenfeld 

Message 4 of 11

Matt__W
Advisor
Advisor

I should probably write a new script that cycles through each proposal and snapshots each bookmark.  😁



Matt Wunch
Revit Subject Matter Expert/sUAS Pilot

Twitter | LinkedIn

AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models

Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.

Message 5 of 11

kwilktrihydro
Advocate
Advocate

Wow, thank you both for your input.  @Glenn.Coppard  I really appreciate the links! I will definitely take a look at these files and see what I can do! Sorry it took me so long, I got taken over by another project.

 

@Matt__W  if you do end up revising your script, definitely let me know. If not, it looks like you have done most of the lifting, and I have been meaning to dive into the world of Infraworks scripting anyway. 

 

Kelby

Kelby Wilkison, P.E.
Civil Engineer
Trihydro Corporation
0 Likes
Message 6 of 11

Matt__W
Advisor
Advisor

@kwilktrihydro the new code is already underway and should be done soon (next few days, give or take, depending on the Thanksgiving holiday break).



Matt Wunch
Revit Subject Matter Expert/sUAS Pilot

Twitter | LinkedIn

AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models

Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.

Message 7 of 11

Glenn.Coppard
Advocate
Advocate

@Matt__W  sounds good to get the non-script savvy going in a brute-force fashion.

We generally structure our Bookmark Naming to the Proposal (or general) and then loop through the Proposals and output the relevant 'prefixed' bookmarks for that option and files named accordingly.

Saves a lot of time filtering through un-necessary JPG files....

 

There a few more hints/tips for you @kwilktrihydro  don't forget to accept the solution - will help others find the info in the future - good luck. [edit] OK - looks like that 'button' is MIA these days - O'well[/edit]

Message 8 of 11

Matt__W
Advisor
Advisor

Alright.... here you go.

 

This will cycle through each proposal and create a snapshot for each bookmark. Enjoy.

(I guess now I have to write up a new AKN article for this.)  😁

// get the active document
var doc = app.ActiveDocument();
// get all of the bookmarks in zsthe active document
var bmList = app.ActiveDocument().Bookmarks;
// Get all proposals in the model, cycle through them & print them to the debug panel
var varProps = doc.GetAllProposals("");
// image width
var imgWidth = 1920;
// image height
var imgHeight = 1080;

for (x in varProps) {
    var propName = (varProps[x]);
    doc.ChangeProposal(varProps[x]);
    for (var i=0; i<bmList.length; i++) {
        var bm = bmList [i];
        doc.MoveToBookmark(bm.name);
        // location to save snapshots
        var strFilePath = "C:\\Snapshots\\";
        // bookmark name
        var bName = (propName+"-"+bm.name);
        //file name (prefix + bookmark name + .JPG extension
        var bmName = (bName+".jpg");
        // complete output path and filename
        strFilePath = strFilePath + bmName;
        // create the snapshot
        app.CreateSnapshot(strFilePath, imgWidth, imgHeight);
    }
}


Matt Wunch
Revit Subject Matter Expert/sUAS Pilot

Twitter | LinkedIn

AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models

Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.

Message 9 of 11

Matt__W
Advisor
Advisor
Accepted solution

Here's a new AKN article for batch snapshotting all bookmarks and all proposals. It also includes a link to download the JS code.

 

https://knowledge.autodesk.com/community/article/273056



Matt Wunch
Revit Subject Matter Expert/sUAS Pilot

Twitter | LinkedIn

AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models

Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.

Message 10 of 11

Anonymous
Not applicable

Hi,

I'm not that familiar with javascripts, but I think I'm doing something wrong. 

I got this message:

error.PNG

0 Likes
Message 11 of 11

srksphillips
Advocate
Advocate

I'm also unable to run any of these scripts in InfraWorks 20.0.25.0 (I am unwilling to upgrade after the trouble it caused last time). I have been able to run these script in the past on this build so not sure what's going on.

 

The debugger is not happy from the start:

 

var doc = app.ActiveDocument(); // the Active Document

 

If I run anyway I get:

 

There is no image format associated with the specified extension. Do you want to use JPEG format?

 

I have to get a ton of snapshots out soon and would appreciate any help.

 

Cheers,

Steve

0 Likes