technical architecture.


ServerUtilities v.85

by on Jun.23, 2009, under Batching, maxscript, vray

Its been a while since I’ve posted anything, so its time for the habitual blog sorry/script update!

We recently picked up VrayRT, and i found myself again vnc’ing over to farm machines to restart services and well, that just wont do!

So I did a small update to the ServerUtilities script adding a few services, and doing a little work on the underbelly of it to make it a bit more stable. also packaged it into an installer because I was getting a few people that had just installed it strangely and were having issues.

screenshot and download link

screenshot and download link

    — .65 – added vray 2010 to services
    — .75 – added vrayRT
    — .75 – convert to simpler dos prompt
    — .75 – added an optional pause to the end of the commandline based tools
    — .75 – fixed the invert button in server selection
    — .75 – prints the commandline to the listener
    — .80 – convert to dos based loop for multiple systems (if pause: hit enter to advance to next machine in loop..)
    — .85 – update to support spaces in the max file path! oops!

Download the Installer

5 Comments more...

by on Mar.16, 2009, under Batching, maxscript

Here’s partial results from last nights maxscript silliness.

QuickCollapse is a maxscript Struct with a few functions to speed up collapsing large numbers of objects, it provides feedback in the listener window so you can see progress as it goes.

Run script will trigger ‘CollapseSelected’ on your current selection. there isn’t much Error Checking involved, so filter your selection for meshes, and remeber that it SHUTS UNDO OFF for the collapse so that we dont have RAM overruns on large objectsets, so save/hold first eh?


EDIT 2013: Here’s an update with UI and a few other useful mesh cleanup functions: DOWNLOAD

17 Comments more...

Revit->FBX->Max, Collapsing large numbers of meshes

by on Mar.15, 2009, under Architecture, Batching, maxscript, Scripting, utility

Well, lets just say that dealing with large Revit files can get a little ugly for visualization purposes to say the least. there are several fundamental issues currently, ranging from workflows in building usable familys inside of revit, to dealing with the geometry after the fact for rendering.

I had the pleasure to again deal with a fairly large Revit model. It only weighed in at about 300mb to start! for working on final renderings thats all well and good, and not a real issue to deal with, but for mid project progress renders it can get a bit painful doing a lot of the deconstruction needed to make it useful to work in in 3dsMax. spending several hours ‘cleaning’ a revit model in max so that you can get any sort of rendering done is lets say, a bit depressing, when you know you’ll have to do the same process again in 2 weeks.

all that said, I started looking for some solutions to one small facet of the problem, and found some good case study testing on efficiently attaching a ton of meshes done by Dave Stewart and also a fair number of tips from the Maxscript crew at CGTalk

So I did a  small adaptation of Dave’s attachment script above, which can be found here: Its not pretty, but we’ll get there soon enough.

It takes your current selection, and simplifies the number of objects by the square root (Dave’s tested optimal amount for speed collapsing!) its a work in progress, and i figure i’ll take this, combined with set of other tools for collapsing either by Selected Material, Similar Objects+Instances, Layer, and some name filtering. that should take the day long revit cleanup jobs and compress them down to an hour or so.


2 Comments more...

Mass Exporting, again

by on Feb.24, 2009, under Batching, maxscript, utility

Mass exporting..

We have a fun little virtools app that loads in various NMO’s exported out from max on the fly as needed based on user input, so in the process of working out what our process would be, we came to the need to have each seperate 3dsmax hierarchy exported out into a seperate virtools NMO file.

Pretty simple, but the question came up on a forum today and its been a useful little script that I’ve been using for years now.

the guts are:

--wanky recursive function to parse hierarchy into an array
fn addChildrenToArray theChildren currentObjsToExport =
	for c in theChildren do
		append currentObjsToExport c
		addChildrenToArray c.children currentObjsToExport
fn massExportfn hier path filetype =
	exportSelection = selection as array
	if hier == true then
		baseNodesToExport = for o in exportSelection where o.parent == undefined collect o
	else baseNodesToExport = exportSelection
	--parse through said root nodes
	for o in baseNodesToExport do 
		oldPos = o.position
		o.position = [0,0,oldPos.z]
		--children returns a 'NodeChildrenArray, so convert that to an array manually.
		--include the current node in the array no matter what.
		currentObjsToExport = #(o)
		-- if we're packaging hierarchys then collect childrem
		if hier == true do
			addChildrenToArray o.children currentObjsToExport
		select currentObjsToExport		
		--random info for use to ogle at the export.. yea yea
		format "\tExport:\t%\tas\t%\n" filetype
		format "\tTo:\t%\n" (path + "/" + + filetype)
		format "\n-----------------------------\n\n"
		-- if we need to save selected use this export type
		if filetype == ".MAX" then
			savenodes currentObjsToExport (path + "/" + + filetype) quiet:true
			--export using the name of the root node as the filename
			exportfile (path + "/" + + filetype) #noPrompt selectedOnly:true 
		o.position = oldPos
	select exportSelection
-- and its used by:
massExportfn true "C:/temp/" ".vmo"

Theres an interface for it here, but i’ve got it built into many other small little pipeline specific utils, so that may not be of any real use to anyone else, but this little snip might be useful for someone out there.

Leave a Comment more...

Maxscript: ServerUtilities v0.5 beta

by on Dec.07, 2008, under Admin, Batching, maxscript, utility, vray

This handles the services perfectly for me here, I’m doing a little more work on it to support using the server.exe and vrayspawner exe versions as well, but that wont be finished for a while as its a spare time project. I’m really looking for feedback in terms of platforms you’re looking to use it on, and what features would be nice to see in addition.

Click here to Download

Install is pretty straightforward, simply unzip into your Scripts directory.. after a bit more testing for various people I’ll throw together an installer, but for now its slightly manual.

after you unzip it, assuming your max is installed in say, C:\3dsmax08\ you should see several files

Maxscript files: Access them as Maxscript Pulldown, Run Script.
C:\3dsMax08\server_tool_lite_05.mcr — Run this to install the script into the Customize UI, under category dbScripts.
C:\3dsMax08\ServerUtilities\ — Run this to try out the tool without installing it into the Customize ui..

C:\3dsMax08\ServerUtilities\… There will be a few other exe’s in this directory, mostly commandline utilities that the script calls to batch modify things.

After you run the script the first time, it will create a file C:\3dsMax08\ServerUtilities\ServerToolLite.ini which will save your settings. In the script, it might be easier for you to add 1 server, and then browse to the ServerToolLite.ini file and manually add the other 19 servers in notepad.


2 Comments :, more...

need a couple testers for new ServerUtilities script

by on Dec.03, 2008, under maxscript

Looking for a couple testers to beat up on a maxscript for me before I send it out to the whole world.

drop a line to dbuchhofer {AT} gmail {DOT} com if you’ve got a moment to try it out. Things should run much smoother than the old HTA/VBScript nonsense.

Leave a Comment more...

3dsmax DirectX oddity

by on Nov.25, 2008, under maxscript, utility

Basic Problem: IT has enforced a Screensaver password policy here now Now, with the D3D view port driver, when you come back from a locked workstation, it doesn’t always instantiate the DX display correctly. we’re noticing on our workstations that it will come back working to a point.. IE: All of the geometry on screen is selectable, but only ~20% of it is displayed with edges in max.

a hack to fix it without having to restart max every time the computer locks on you, I’ve found i can Disable and then Enable the Direct3D Cached meshes.. this works.. in a crappy sort of way.

Here’s some code that toggles the d3d cached.. it also helps to show how to access things in max that are not readily open to the maxscript language, by using windows messaging to “push” buttons on dialogs! most credit to Richard at cgtalk!

toolTip="toggle the Use Cached D3DXMeshes Viewport"
buttonText="toggle the Use Cached D3DXMeshes Viewport"
--start macro
-- toggles the "Use Cached D3DXMeshes" checkbox of the Viewport configuration
--diable it while
 dialogMonitorOps.enabled = false
 global prefsDialog_hwnd = undefined
 global retMessage=""
 fn toggleCachedD3DMeshes = (
	 --Constants for sendMessage method	
	local BM_GETSTATE = 0xF2
	local BM_CLICK = 0xF5
	local BM_SETCHECK = 0xF1
	local BST_CHECKED = 0x1	 
 	local hwnd = dialogMonitorOps.getWindowHandle()
 	local dialogTitle = uiAccessor.getWindowText hwnd
 	if (dialogTitle != undefined) then (
 		if (dialogTitle == "Preference Settings") then (
			prefsDialog_hwnd = hwnd
			format "We're in the preferences dialog\n" 
			local hwnd_children = uiAccessor.getChildWindows hwnd
 			for i = 1 to hwnd_children.count do (
 				local hwnd_child_title = uiAccessor.getWindowText hwnd_children[i]
				if (findString hwnd_child_title "Configure Driver..." == 1) then (
					format "found config button... pressing\n"
					local hwnd_config = hwnd_children[i]
 					uiAccessor.pressButton hwnd_config
		else if (dialogTitle == "Configure Direct3D") then (
			local hwnd_children = uiAccessor.getChildWindows hwnd
 			for i = 1 to hwnd_children.count do (
 				local hwnd_child_title = uiAccessor.getWindowText hwnd_children[i]
				if (findString hwnd_child_title "Use Cached D3DXMeshes" == 1) then (
					format "found the cached button\n"
					local hwnd_cached = hwnd_children[i]
					local CheckState = windows.sendMessage hwnd_cached BM_GETSTATE 0 0
					local IsChecked = bit.get CheckState BST_CHECKED
					format "the checkbox was: %\n" IsChecked
					-- Uncheck it
					if IsChecked then
						windows.sendMessage hwnd_cached BM_CLICK 0 0
						windows.sendMessage hwnd_cached BM_SETCHECK 0 0
						format "Cached D3DXMeshes has been disabled.\n"
						format "Pressing OK on the ConfigureD3D page\n"
						uiAccessor.sendMessageID hwnd #IDOK
						format "Pressing OK on the Preferences page\n"
						uiAccessor.sendMessageID prefsDialog_hwnd #IDOK
						retMessage="Turning the CachedD3DXMeshes *OFF*"
					-- Check it
					else if not IsChecked then
						windows.sendMessage hwnd_cached BM_CLICK 0 0
						windows.sendMessage hwnd_cached BM_SETCHECK 1 0
						format "Cached D3DXMeshes has been enabled.\n"
						format "Pressing OK on the ConfigureD3D page\n"
						uiAccessor.sendMessageID hwnd #IDOK
						format "Pressing OK on the Preferences page\n"
						uiAccessor.sendMessageID prefsDialog_hwnd #IDOK
						retMessage="Turning the CachedD3DXMeshes *ON*"
fn toggleUseCache =
	dialogMonitorOps.interactive = false
	dialogMonitorOps.unregisterNotification id:#setD3DCache
	dialogMonitorOps.registerNotification toggleCachedD3DMeshes id:#setD3DCache
	dialogMonitorOps.enabled = true
	--run it
	max file preferences
	--disable it!
	dialogMonitorOps.enabled = false
	dialogMonitorOps.unregisterNotification id:#setD3DCache
	--messagebox retMessage
format retMessage
Leave a Comment :, , more...

Maxscript: Grid by Name

by on Nov.07, 2008, under Architecture, maxscript, utility

Here’s a useful one i made in 2003, one of my first scripts actually! posting it up because i find myself using it ~60 times a day on this current project with curved/angled bits all over it!

A Helper dialog to speed up working with custom Grids. Helps immensely in the workflow of angular modeling (read: silly modern architecture) when combined with a hotkey to create grid and autogrid >:)

Basics: It populates the dialog with all current grids in the scene, including the HomeGrid. you can double click on any grid to activate that, also has buttons to change the view to match the grid, and to select the current active grid. also includes a cycle of the Toolmodes (View/World/Parent/Screen/Local/Gimbal/Grid)

— if there are no grids in the scene, then toggle between the toolmodes
— if there is just 1 grid in the scene, toggle between it and the Home Grid
— if there are grids in the scene, open the window
— if there are grids in the scene and the window is already open, toggle between the grids

1 Comment :, , more...

Maxscript: Vray Light Calc Filenames

by on Nov.02, 2008, under maxscript, vray

Here’s a relatively simple script thats already saved me many headaches.

Vray Light Calc switcherizer

Vray Light Calc switcherizer, click image to download script.

Basic Gist: as its set up It will create a directory called ‘Calcs’ under the directory where your maxfile is at, and will switch your filenames for vray irradiance maps and light cache back and forth between saving to, and loading from file in that directory, it will save the calcs as “maxfilename_cameraname.vrlmap/vrmap’

its set to use a UNC directory where possible, and to use irradiance map and light cache. Theres not much error checking in it, its currently set up to work for us internally, If anyone has issues with it, you can contact me. I think its helpful, but not ‘solid?’ enough to drop up onto scriptspot as yet.


1 Comment :, , more...

Adventures in maxscript.. (Or, asset management part 2.)

by on Aug.26, 2008, under maxscript

A couple days later, and a few hours of learning in, and i’ve built up the starting point for what i think is a somewhat useful asset/library management system.

The Basics as they stand so far:

  • Choose a root directory that you have your meshes stored at.
  • for each directory in the root tree, add an entry to the treeview on the left, a’la explorer.
  • when you click on any leaflet of the treeview, we build on the fly an html thumbnail page of the Maxfiles/Thumbnails in the directory with a few basic informational items.
  • clicking on a thumbnail, imports a model.

That glosses over some of the fun parts of getting the thumbnails of each model, and general organizational bits involved in maintaining your asset library, but thats it, clean and simple.

Its what i imagine that Utilities menu ‘Asset Library’ would do, if it didn’t just make max fast exit.


Now to evaluate the work involved in making it bulletproof enough to possibly be useful outside of our small studio.

  • Features on the horizon:
  • fully cached directories (Done!, only recurse the filesystem once.)
  • Multiple Library Classes:
    • Mesh
    • Material
    • Texture
    • Texture as Billboard
  • Queue of meshes to load
  • Placement of meshes on load? OR integrate the idrop functionality
  • include maxfiles that do not have thumbnails (extracting the explorer thumbnail preview)

Well, that’s probably enough to kill off my free time for a few more days.. Heh!

6 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!