In the first release, this node just uses Element Ids tobuild a long ‘or‘ search set, but this basic idea could easily be extended and adapted to more closely connect RevittoNavisworkssearch workflows through Dynamo.
XMLfiles are everywhere. Andin the BIM world, we have to deal with a range of different xml file schemas, such as BCF, Navisworks Clash Reports and Viewpoints, and so forth. Hiding inside these XMLs there is some very useful information. For example, BCF files often have Element IDs in the viewpoint.bcfv component, and Navisworks XMLfiles often have point XYZ values. Can we easily get access to this information for usein Dynamo, and then inRevit?
Yes, we can! There were one or two ways to do this in Dynamo before, but here is my take on it…
Dynamo ships with IronPython, which in turn ships with an XML handler called ElementTree. I have created some basic nodes that give us access to ElementTree functions in Dynamo. Along the way, I learnt a bit about encoding and character sets. It turns out that Navisworks often inserts tricky characters into the XML (like the diameter symbol), so as a workaround (for now) I do a string encoding roundtrip to get rid of these problematic characters. In the same node, I create the ElementTree object: this is a special object that essentially represents structured information about the XML data. The initial import looks like this:
Once we have this ElementTree object in hand, we can start to do some interesting things, like: Iterate through tree to get individual XML elements
andShow a hierarchical representation:
With the individual elements, we can Get Attribute names and values, and the Get the children of those elements:
Obviously, you can immediately do some nice lookups against these lists in Dynamo, depending what information you want. However, on large XMLs this can be quite slow. Happily, ElementTree provides some basic XPATH support, which looks a bit like this:
With the XPATH supportand an understanding of the xml hierarchy, I have created a node to do XPATH calls straight to the ElementTree object:
Now that we can ‘snip’ out useful information from the XML, we can do interesting things with it, like make some points:
When it comes to BCF, its a little bit more challenging. I haven’t figured out how to unpack the bcfzip directly to memory (yet), so we have do that manual step first. Once we have a ‘folder’ from the BCFZIP, we can get the bcfv files from inside it and then get information from them, like this:
So, in the latest Bakerypackage are the nodes needed toread a variety of XMLfiles, get information from them, and do some useful things with that information. It was a learning experience for me, and I hope its useful to you 🙂
Sometimes we make a node that we don’t really want the world (ie. Library / In Canvas search) to see. Can we hide it? Yes. Just add this statement to the dyf header: IsVisibleInDynamoLibrary=”false”
If you use a 3Dconnexion mouse with Navisworks, and you have installed the latest drivers (which I highly recommend), you may struggle to find out how to map a Spacebar to a button on your Spacemouse. Obviously, in Navis it is important to be able to hold down the Space key for selection purposes. If you try to record a macro for Spacebar in the 3Dconnexion management menu, you will find that it has both a ‘press’ and ‘release’ action.
You need to use the Keyboard list to map a key press correctly. However, Spacebar does not appear in the default menu… Happily, you can directly modify your profile XML to map the KB_Space action to a button on your 3d mouse. The images below show where to find this file, and how to edit it:
This method will fix the ‘press and release’ nature of macros, meaning you can “hold” the 3d mouse button for a Spacebar or Shift+Spacebar multiselection in Navisworks.
I thought it might be useful to set up a shared folder to allow Navisworks users to upload, download and share resources. The idea here is that lots of Navisworks resources (as listed below) can be exchanged and re-used on future projects. Why should we all keep reinventing the wheel?
Only invited users can upload, while any user can view and download the content. Note: if you are an uploader, keep in mind that this will be globally accessible, so you need to be aware of any IP considerations that may apply. At this point, I’m considering this to be “open source” (with associated licensing conditions). Additionally, I am keeping the guidelines to a minimum, just feel free to share something if you think others could make use of it.
I have posted about KiwiCodes Bonus Tools before, particularly the Excel and data tools. A Sheet Revisions manager has recently been added to the toolset. Check out how quick and easy it is to add revisions to sheets with this:
Honestly, if you have $35 to spend on Revit addins, this Bonus Tools package is definitely what I would spend it on…
Firstly, export the Viewpoints you want to rename to XML.
Open the XML in Notepad++. Now we are going to use Search – Replace to append something to the view name in the XML file. Once we get the Find syntax correct (I used view name=”View), you can just use a backslash 1 in the Replace box to signify the Find result, and then add whatever you like after that. See the image:
(make sure you pick the Regular Expression radio button)
Click Replace All, then save the XML (make sure you just click save, and don’t click Save As). Now, import it back into your Saved Viewpoints in Navisworks.
This is what it looks like in Navisworks after re-importing the XML:
Keep in mind that the import / export process will result in your Hide/Required and Override Material boxes becoming unticked for each imported view.
This is another good reason that you should be using Appearance Profiler by now… Have you noticed Presenter has now been completely replaced by Autodesk Rendering in Navisworks 2015?
Navis uses XML as a data interchange format for almost “everything”.
However, it sometimes doesn’t offer the greatest editing experience for that same data in the vanilla UI. You will find that various users are direct-editing these XML files to streamline workflows in a number of different scenarios.
Here is a simple example – in the Quick Properties / Definitions options in Navisworks, it is not immediately obvious how you can re-sort this list. However, you can export that settings node to XML, and then use a graphical XML Editor like EditiX to view the schema and drag the nodes into the order that you prefer (see image). Then, save the XML and then import back into Navisworks…