One of the most basic questions that I'm getting about some of the models that we're showing off is, "How many assets are in that model?"
It turns out that there is no easy way to get this information from the user interface, but it's a pretty simple task with a JavaScript.
Here's what you do:
1. Open Infrastructure Modeler and load a model of choice
2. Select Window-->Scripting Window and
3. Paste the following code snippet into the window:
// Autodesk Infrastructure Modeler 2012 JavaScript example
// Name: Count All Model Assets
var tcount = 0;
var db = app.ActiveModelDb;
print();
print("Counting all assets in model");
print("----------------------------");
//Loop through the tables
for (i = 0; i < db.TableCount; i++){
//This line skips some internal tables that don't need to be counted
if (db.TableNames[i].slice(0,4) != "__jo"){
//Sum the number of records in each relevant table
count = db.Table(i).QueryRowCount();
if (count > 0){
print(" "+ db.TableNames[i] + " " + count);
tcount += count;
}
}
}
print();
print("Total selected: " + tcount);
print();
4. Click Start Script
5. You should see some output like this:
This post has also been posted to the Infrastructure Modeler 2012 WIKI Help system.
Subscribe
Here are my assets:
http://twitpic.com/7fd8br
Joshua Nelson
Posted by: JoshNelson | 11/17/2011 at 06:39 AM
Impressive, Josh!!! Thanks for posting the pic!
Posted by: Chris Andrews | 11/17/2011 at 09:40 AM