make money

jav online; jav streaming; 1pondo; caribbeancom; heyzo - tokyo hot

Award Winning Design Blog

Autodesk Stingray: How to batch replace materials with Windows PowerShell

By on June 7, 2016 in Autodesk Stingray, Featured, News with 0 Comments

ducts

So you just imported a Revit model into Stingray and you have 500 objects that you have to replace the material on but you don’t want to drag n drop a material 500 times? Well you’ve come to the right place! Here’s one way you can do this:

Copy the following text into a new text file. Save the file as replace.ps1

param( [string]$Find, [string]$Replace, [string]$Path )
gci -Path $Path -recurse | foreach{ (gc $_) -replace $Find,$Replace | sc $_ }

Next, identify the source material name and replacement material name

  • /content/materials/mySourceMaterial
  • /content/materials/myReplaceMaterial

Open up Windows PowerShell as Administrator

  • CD to replace.ps1 directory and type
 ./replace "/content/materials/mySourceMaterial" "/content/materials/myReplaceMaterial" "C:/the/path/to/my/project/*<partial file name if neccessary>*.<file extension>" 

Voilla!

An issue you might encounter is an error saying that you cannot run unsigned scripts. In that case do the following:

In PowerShell type:

set-executionpolicy remotesigned

If your company has this locked down, I am not sure what the work around is. If anyone knows, please comment. Thanks!

Final thought

Obviously this has far reaching applications outside of Stingray as you may use it to batch replace text in any readable file format. Let us know how you’re using it!

Tags: , , , , ,

About the Author

About the Author: Hi! I am currently an Autodesk Solutions Engineer working to deliver real time solutions to our Enterprise customers. I have been involved with industrial design software for nearly 15 years and am a 3DS Max Professional who is passionate about design visualization. .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

Post a Comment

Your email address will not be published. Required fields are marked *

Top