Discover new ways to use Scripter in Navisworks to automate actions, such as opening and closing doors when you approach them, and how to create scripts with multiple events. Learn how to utilize the on hotspot event and make modifications in the existing scripts for enhanced functionality.
Key Insights
- The article provides detailed steps on how to use Scripter in Navisworks to automate tasks such as opening and closing doors as you approach and move away from them, using the on hotspot event feature.
- It also demonstrates how to create scripts with multiple events in Scripter, enabling you to trigger actions based on either of the events happening, not necessarily all of them. This is done by changing the operator from 'and' to 'or'.
- Aside from these, the article explores useful applications of the scripting tool in a variety of scenarios, like visualizing building sections for clash detection, making it a highly versatile tool for architects and engineers.
Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.
Welcome back to the Navisworks video series. In this video we'll be continuing with Scripter, and we'll be looking at how to create scripts with multiple events, and we'll be using the On Hotspot event in this video as well. We'll be looking at the BIM361Complete.nwf model in your Lesson 3 folder, which is where we last left off.
If you don't have Scripter turned on already, make sure that you do turn it on and that you go to that Scripter tab. In this video we'll be modifying the existing scripts that we've already created, starting with the leftDoorOpen. We're going to make an On Hotspot event which will allow us to, it would allow Scripter to automate the opening of these doors as we approach them and then closing them as we move further away from them.
And we'll be doing this in addition to the On Key Press events that already exist. So with that script selected, go to On Hotspot and you'll see that the operand is now set to "and".
That means that two things have to be true in order for the event to trigger the action. We can change this to "or", which means that one of these can be true and then it will trigger our action. And that's the one that we want.
We don't want to have to hold down L and approach the door. We'd want it to either approach the door or press down the letter L. So let's go to the On Hotspot event. Our hotspot is set to sphere.
That is correct. We're going to trigger when we're entering that sphere as we go within the invisible sphere. And let's create a radius of, let's call it 15 feet just to start out with.
And then for our position, we don't exactly know where this is in space, but we can actually pick a position. Once you hit the pick button, then you can just select the door and then Navisworks fills out where that position of the door is. The animation play has already been set, so we don't need to do anything for our actions.
Let's test out to see if this leftDoorOpen On Hotspot works by selecting Enable Scripts. And then let's approach the door and as soon as we reach within 15 feet of the door, then the door will open. Door won't close though because we haven't actually set an On Hotspot event to the doorsClose script.
But we can push the K button or actually have both of the doors open and then hit K. The reason that it's opening when I hit K is because I have it set to starting on "Start" rather than current position. Next let's apply that same new event, the On Hotspot event, to the rightDoorOpen by turning off Enable Scripts, going to rightDoorOpen, make a new event On Hotspot, change our operand to "or", and then select On Hotspot and we'll set the sphere again triggering when entering that position with a radius of 15 feet. And while we're here let's go to the doorsClose, create a new event, change our operand, select the hotspot, and we're going to trigger when leaving position, same place, radius 15 feet.
Now let's Enable Scripts and see what happens. So as we approach the door we'll see both animations triggering and then when we leave that sphere, the doors closing animation will be triggered. And this happens on both sides because it's a sphere.
And as long as the Enable Scripts is active, anytime we approach this door then it will trigger to open. If we want to modify the way that that animation looks, we can turn off Enable Scripts, go back to the Animator tab, and then reduce the amount of time it takes to open or close these doors. I'm going to Enable Scripts again, deselect the door, and then as I approach now it's much faster, happens in one second.
And at the same time, you can manually activate the doors to open. I'm hitting L, R, and K, so it's either-or. And that's all there is to it.
Now let's practice creating more scripts within this Scripter tool. I turned off Enable Scripts so that as I approach the door it's not going to trigger. I can also edit scripts.
And let's make a script for that section animation that we made a couple of videos back, this Section Front. So let's make a new scene, we'll call this section, and we'll create an On Key Press event, make the key S, and then make our action the Cut Front, starting at start, ending at end. And then we'll need a way to get out of this, so actually let's make a new section or a new script, section reverse, On Key Press, and we can set the key to A on key down.
Our action is animation Cut Front, starting at end and ending at start. And let's see how that looks. If we hit S there's our section cut, if we hit A it'll reverse the section cut.
We can also make one button control both of these scripts if we set our section reverse to on key up as key S and our section to key down key S, both playing the same animations but the section reverse being the reversed version of it. In this case we'd want to set our section animation to start at current position and end at end. If we release the button and we then press the button again, we don't want the section to jump back to fully visible, we want it to be as fluid as possible.
Let's Enable Scripts and check it out. I'm going to key down and hold down S and then as I let go of S it's going to let the section go back to its original position. And the beauty about the Scripter tool is that we can really be anywhere in the project, and if you want to see that section take place then we can simply hold down S, and as long as we're holding down S then the building is being sectioned, but as soon as I let go the building is going to be rebuilt.
This can be very useful for clash detection if you have a number of section planes set, for example first floor, second floor, third floor, or if you want to take the roof off really quick and you have, say, R set to your roof script then you can easily do that, and it's much easier to visualize than when things simply disappear. So as I get creative with the Animator and Scripter tool they're pretty fun tools, and I've enjoyed them and I hope you enjoy them too.