Community
Navisworks Forum
Welcome to Autodesk’s Navisworks Forums. Share your knowledge, ask questions, and explore popular Navisworks topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Scriptor & Scripts Examples or Samples.

5 REPLIES 5
Reply
Message 1 of 6
VWD-MLM
3312 Views, 5 Replies

Scriptor & Scripts Examples or Samples.

Not being a 'programmer' per se, I am struggling with Scripts and Scriptor.  Can't seem to get my head around it as there are no real good explanations in the Help file.  Does anyone have or know of any decent examples wtih Scripting in it?

 

Mike

Michael L. Maloney
Virtual World Designs
VDC & BIM Model Design, Clash & Coordination
mike@VirtualWorldDesigns.com
BDSU 2015, 2016
Charlotte, NC ; Fort Mill, SC
5 REPLIES 5
Message 2 of 6
john.lipp
in reply to: VWD-MLM

Hi mike,


Here are some steps to create a script where the animation of a door opening plays when you are within a certain distance from the door:

First create the animation:

1. Open Animator from the Tools Panel of the Home tab.

2. Click the Add scene button to add a scene

3. In the scene view, select the door. When selecting the door, hold down shift to cycle through the selection resolution so that you only select the door and not the frame as well. Alternatively, select from the selection tree.

4. With the door selected, in the Animator tool, right click on the scene you created and select Add animation set > From Current Selection.

5. Click the rotate animation set button in Animator.  You should now see the rotate gizmo in the scene view.

6. In the scene view, select the X axis of the gizmo and drag the gizmo so that the origin is placed on the left side edge of the door.  This will allow the door to swing open rather than spin around.

7. Back in Animator, click the capture keyframe button. 

8. Drag the time slider or enter the time of 3 seconds to move the time slider to that point in time.

9. Drag the blue curve of the gizmo to rotate the door about the Z axis.

10. Click the capture keyframe button.  You’ll now have a keyframe at 3 seconds of the door open.

11. Unselect the rotate animation set so the gizmo is no longer displayed.  

12. Click the play button.  You should now have an animation of the door opening.


Now that you have the animation, create the script:

1. Open Scripter from the Tools Panel of the Home tab.

2. In the Scripter tool, click the add new script button.

3. In the events panel, click the on hotspot button.

4. In the properties of the On Hotspot event, set the radius to about 10 meters

5. For the Position click the Pick button, and the cursor will turn into a cross-hairs

6. Pick a point on the door in the scene view.

7. Back in Animator, in the actions panel, click the play animation button.

8. In the properties, set Animation to the animation set you previously created.

9. Very importantly, mark “Enabled Scripts” in the scripts panel of the Animation tab. Without this turned on, your scripts will not run.

You can now use the walk navigation tool to navigate closer to the door, and once you are within 10 meters, it should swing open.  If you want to play the animation again, just toggle scripts off/on.

Attached is the sample file I created from the steps above.  There is an animation you can play of the camera moving toward the door.  Make sure you have “Enabled Scripts” turned on when you play it.


Best regards,

autodesk_logo_signature.png

John Lipp
Product Support Specialist
Autodesk Product Support 

Message 3 of 6
VWD-MLM
in reply to: john.lipp

Thanks John,

 

I'll take a look at this and get back with you.  I'm sure there'll be more questions.  This is uncharted territory for me.

Mike

Michael L. Maloney
Virtual World Designs
VDC & BIM Model Design, Clash & Coordination
mike@VirtualWorldDesigns.com
BDSU 2015, 2016
Charlotte, NC ; Fort Mill, SC
Message 4 of 6

After spending much time and trial with many errors, I found some neat thing with this feature.

 

  • In the hotspot editor, choose 'sphere on selection'. You need to select the item first and click on the set button to engage it.
  • I found that I could delete the animation in the viewpoints tab after the fact and it does not affect my door opening. This lets you hide all sorts of easter eggs in your model.
  • Speaking of easter eggs, I tried to do a hospot script where a bunny (sketchup file) would appear when I got close to a desk. It worked but closed my working file and opened the bunny file. Perhaps there is a way to do this...John?

Bunny

Message 5 of 6

Hi there,

 

I'm afraid I can see no simple way currently to allow your bunny to appear when you approach it. This would require either the Load Model script to allow append actions as well as replacement open actions, or alternatively, an action that allows you to hide or unhide the bunny on demand (and you append the bunny to the existing file in preparation).

 

You could conceivably animate or transform the bunny off into the distance at start of playback and snap it back at the point you desired (if I recall correctly, animations don't have to be smooth transitions but default to that). A little kludgy and it might cause odd model bounding box effects depending on where you moved it to, but it might be a suitable workaround depending on your scenario (e.g. animate/transform the bunny off inside a cupboard or something).

 

I'm not sure the act of deleting the viewpoint animation and still referring to it in Scripter is supposed to work quite like that. You may be relying on undefined behaviour there. Generally I'd recommend not deleting components of the file on which you are reliant 🙂

 

Hope that helps,

 

Jeff

 

PS: On the original question of how does one use Scripter, my concise take on it would be that Scripter is intended to be a way to link up events that trigger actions; each script representing one pairing of a set of events with a set of corresponding actions. It is a first take on providing interaction within your Navisworks model.

 

Each script is composed of one or more events that, when triggered via any desired logic (e.g. pressing a key OR moving into a hotspot), causes the associated actions to run. There is a variables system built in that enables more complex logic to built up out of multiple scripts e.g. you could have a script that OnKeyPress of J increments a variable, and another script that runs when that variable reaches three and plays an animation. With OnStart, OnAnimation, OnScript & OnTimer events, you can chain scripts & script effects together more directly.



Senior Software Engineer
Navisworks
Autodesk Ltd.
Message 6 of 6

New to understanding and writting scripts or that this may be the right path. What I am trying to do is animate in timeliner a sequence during construction so that when the building is at the 6th floor and the horizontal safety nets display that the 4th floor safety next disappear. So as the building goes up the nets appear to be jumping in sequence. I assume that this type of script can cover things like a hoist or crane as well. Thank you for any support.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report