<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>technical architecture. &#187; utility</title>
	<atom:link href="http://buchhofer.com/category/scripting/utility/feed/" rel="self" type="application/rss+xml" />
	<link>http://buchhofer.com</link>
	<description>Maxscript, Architecture, 3D, 3DSMax, Unity3D</description>
	<lastBuildDate>Sat, 14 Jan 2012 14:12:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Recursive Tiff to PDF</title>
		<link>http://buchhofer.com/2010/04/recursive-tiff-to-pdf/</link>
		<comments>http://buchhofer.com/2010/04/recursive-tiff-to-pdf/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 20:30:19 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Batching]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=243</guid>
		<description><![CDATA[Another one of those semi random requests that turned out to be more of a pain in the arse than it really should be. the mission: Converting a large mass of scanned tiff CAD drawings into multi page PDF’s There are two ways to do this fairly quickly, the easy way if you don’t have [...]]]></description>
			<content:encoded><![CDATA[<p>Another one of those semi random requests that turned out to be more of a pain in the arse than it really should be. the mission: Converting a large mass of scanned tiff CAD drawings into multi page PDF’s</p>
<p>There are two ways to do this fairly quickly, the easy way if you don’t have many individual sets to work with is to simply drag all the tif images into the window in Acrobat Pro and save the file from there.</p>
<p>If however, like us, you have to convert 42 gigs or so of tiff’s spread across 204 folders and group the PDF’s by the folders, you can programmatically do it via some batch scripting and the use of a few free command line utilities from the internet.</p>
<p>First thing to do is convert each individual TIF file to a PDF, for this, we use <a href="http://www.imagemagick.org/script/index.php">Imagemagick </a> this is a tool that can do many things but we’re really just going to abuse the ‘convert’ application for now.</p>
<p>After installation, you can then in the dos prompt type ‘convert file.tif file.pdf’</p>
<p>For our purposes we want to convert ALL of the files, so we can set it up in a recursive for loop using</p>
<p>Saved into a file “Convert all Tiffs in Subdirectory to PDFs.bat” or something equally exciting:<br />
<code>FOR /R %%a IN (*.tif) DO convert "%%a" "%%a.pdf"</code></p>
<p>After that is done we will use a second utility to ‘join’ the pdf’s the <a href="http://www.accesspdf.com/pdftk/">PDF toolkit</a></p>
<p>With this util we can modify pdf files quickly; we’ll use the Append function</p>
<p><code>pdftk *.pdf cat output combined.pdf</code></p>
<p>This will concatenate all pdf’s in the current directory and write them into ‘combined.pdf’ in the same directory. Great!</p>
<p> To expand this into a large subdirectory we do a little more batch scripting</p>
<p>The below is saved into a file “Join all PDF in directory tree.bat”</p>
<p><code>FOR /F "delims=" %%a in ('DIR /S /B /AD ^|SORT') DO (<br />
CD "%%a"<br />
pdftk *.pdf cat output "%%a_joined.pdf"<br />
)</code></p>
<p>This will output a combined PDF for each of the individual directories.</p>
<p>A good time was had by all.</p>
<p>Imagemagick looks to have quite a few useful applications and will warrant some more exploration soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2010/04/recursive-tiff-to-pdf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Revit-&gt;FBX-&gt;Max, Collapsing large numbers of meshes</title>
		<link>http://buchhofer.com/2009/03/revit-fbx-max-collapsing-large-numbers-of-meshes/</link>
		<comments>http://buchhofer.com/2009/03/revit-fbx-max-collapsing-large-numbers-of-meshes/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 19:48:17 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Batching]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=187</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>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 &#8216;cleaning&#8217; 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&#8217;ll have to do the same process again in 2 weeks.</p>
<p>all that said, I started looking for some solutions to one small facet of the problem, and found some <a href="http://www.keyframesandcode.com/code/development/maxscript/time-stamper-meshopsattach-case-study/">good case study testing </a>on efficiently attaching a ton of meshes done by <a href="http://www.keyframesandcode.com/code/">Dave Stewart</a> and also a fair number of tips from the <a href="http://forums.cgsociety.org/showthread.php?f=98&amp;t=635477">Maxscript crew at CGTalk</a></p>
<p>So I did a  small adaptation of Dave&#8217;s attachment script above, which can be found here: <a href="http://www.buchhofer.com/upload/files/Scripts/CollapseSelected-inParts5.ms">CollapseSelected-inParts5.ms</a> Its not pretty, but we&#8217;ll get there soon enough.</p>
<p>It takes your current selection, and simplifies the number of objects by the square root (Dave&#8217;s tested optimal amount for speed collapsing!) its a work in progress, and i figure i&#8217;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.</p>
<p>Yay.</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2009/03/revit-fbx-max-collapsing-large-numbers-of-meshes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mass Exporting, again</title>
		<link>http://buchhofer.com/2009/02/mass-exporting-again/</link>
		<comments>http://buchhofer.com/2009/02/mass-exporting-again/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:56:42 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[Batching]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=180</guid>
		<description><![CDATA[Mass exporting.. We have a fun little virtools app that loads in various NMO&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>Mass exporting..</p>
<p>We have a fun little virtools app that loads in various NMO&#8217;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.</p>
<p>Pretty simple, but the question came up on a forum today and its been a useful little script that I&#8217;ve been using for years now.</p>
<p>the guts are:</p>

<div class="wp_syntax"><div class="code"><pre class="maxscript" style="font-family:monospace;">&nbsp;
--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
	)
)
&nbsp;
fn massExportfn hier path filetype =
(	
&nbsp;
	exportSelection = selection as array
	if hier == true then
	(
		baseNodesToExport = for o in exportSelection where o.parent == undefined collect o
	)
	else baseNodesToExport = exportSelection
&nbsp;
	--parse through said root nodes
	for o in baseNodesToExport do 
	( 
		oldPos = o.position
		o.position = [0,0,oldPos.z]
&nbsp;
		--children returns a 'NodeChildrenArray, so convert that to an array manually.
		--include the current node in the array no matter what.
		currentObjsToExport = #(o)
&nbsp;
		-- if we're packaging hierarchys then collect childrem
		if hier == true do
		(
			addChildrenToArray o.children currentObjsToExport
		)
&nbsp;
		select currentObjsToExport		
&nbsp;
		--random info for use to ogle at the export.. yea yea
		format &quot;\tExport:\t%\tas\t%\n&quot;  o.name filetype
		format &quot;\tTo:\t%\n&quot; (path + &quot;/&quot; + o.name + filetype)
		format &quot;\n-----------------------------\n\n&quot;
&nbsp;
		-- if we need to save selected use this export type
		if filetype == &quot;.MAX&quot; then
		(
			savenodes currentObjsToExport (path + &quot;/&quot; + o.name + filetype) quiet:true
		)
		else
		(
			--export using the name of the root node as the filename
			exportfile (path + &quot;/&quot; + o.name + filetype) #noPrompt selectedOnly:true 
		)
		o.position = oldPos
	)
	select exportSelection
)
&nbsp;
-- and its used by:
massExportfn true &quot;C:/temp/&quot; &quot;.vmo&quot;</pre></div></div>

<p>Theres an interface for it here, but i&#8217;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.</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2009/02/mass-exporting-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maxscript: ServerUtilities v0.5 beta</title>
		<link>http://buchhofer.com/2008/12/maxscript-serverutilities-v05-beta/</link>
		<comments>http://buchhofer.com/2008/12/maxscript-serverutilities-v05-beta/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 13:54:06 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Batching]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[vray]]></category>
		<category><![CDATA[beta]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=128</guid>
		<description><![CDATA[This handles the services perfectly for me here, I&#8217;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&#8217;m really looking for feedback in terms of platforms you&#8217;re looking to use it [...]]]></description>
			<content:encoded><![CDATA[<p>This handles the services perfectly for me here, I&#8217;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&#8217;m really looking for feedback in terms of platforms you&#8217;re looking to use it on, and what features would be nice to see in addition.</p>
<p><a href="http://buchhofer.com/wp-content/uploads/2008/12/serverutilslite5.jpg"><img class="alignnone size-medium wp-image-118" title="Server Utils maxscript" src="http://buchhofer.com/wp-content/uploads/2008/12/serverutilslite5-121x300.jpg" alt="" width="121" height="300" /></a><br />
<a href="http://www.buchhofer.com/upload/files/Scripts/server_tool_lite_05.zip">Click here to Download</a></p>
<p>Install is pretty straightforward, simply unzip into your Scripts directory.. after a bit more testing for various people I&#8217;ll throw together an installer, but for now its slightly manual.</p>
<p>after you unzip it, assuming your max is installed in say, C:\3dsmax08\ you should see several files</p>
<p>Maxscript files: Access them as Maxscript Pulldown, Run Script.<br />
C:\3dsMax08\server_tool_lite_05.mcr &#8212; Run this to install the script into the Customize UI, under category dbScripts.<br />
C:\3dsMax08\ServerUtilities\server_tool_lite_05.ms &#8212; Run this to try out the tool without installing it into the Customize ui..</p>
<p>C:\3dsMax08\ServerUtilities\&#8230; There will be a few other exe&#8217;s in this directory, mostly commandline utilities that the script calls to batch modify things.</p>
<p>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.</p>
<p>Cheers,<br />
Dave</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2008/12/maxscript-serverutilities-v05-beta/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>3dsmax DirectX oddity</title>
		<link>http://buchhofer.com/2008/11/3dsmax-directx-oddity/</link>
		<comments>http://buchhofer.com/2008/11/3dsmax-directx-oddity/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 16:28:08 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[maxscript]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[3dsmax]]></category>
		<category><![CDATA[dialogs]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=94</guid>
		<description><![CDATA[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&#8217;t always instantiate the DX display correctly. we&#8217;re noticing on our workstations that it will come back working to a point.. IE: All of the geometry on screen [...]]]></description>
			<content:encoded><![CDATA[<p>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&#8217;t always instantiate the DX display correctly. we&#8217;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.</p>
<p>a hack to fix it without having to restart max every time the computer locks on you, I&#8217;ve found i can Disable and then Enable the Direct3D Cached meshes.. this works.. in a crappy sort of way.</p>
<p>Here&#8217;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 &#8220;push&#8221; buttons on dialogs! most credit to <a href="http://forums.cgsociety.org/showthread.php?f=98&#038;t=686067">Richard at cgtalk</a>!</p>

<div class="wp_syntax"><div class="code"><pre class="maxscript" style="font-family:monospace;">&nbsp;
toolTip=&quot;toggle the Use Cached D3DXMeshes Viewport&quot;
buttonText=&quot;toggle the Use Cached D3DXMeshes Viewport&quot;
&nbsp;
--start macro
&nbsp;
-----------------------------------------------------------------------------------------------
--
-- toggles the &quot;Use Cached D3DXMeshes&quot; checkbox of the Viewport configuration
--
-----------------------------------------------------------------------------------------------
&nbsp;
--diable it while
 dialogMonitorOps.enabled = false
 global prefsDialog_hwnd = undefined
 global retMessage=&quot;&quot;
 fn toggleCachedD3DMeshes = (
&nbsp;
	 --Constants for sendMessage method	
	local BM_GETSTATE = 0xF2
	local BM_CLICK = 0xF5
	local BM_SETCHECK = 0xF1
	local BST_CHECKED = 0x1	 
&nbsp;
 	local hwnd = dialogMonitorOps.getWindowHandle()
 	local dialogTitle = uiAccessor.getWindowText hwnd
 	if (dialogTitle != undefined) then (
 		if (dialogTitle == &quot;Preference Settings&quot;) then (
			prefsDialog_hwnd = hwnd
			format &quot;We're in the preferences dialog\n&quot; 
			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 &quot;Configure Driver...&quot; == 1) then (
					format &quot;found config button... pressing\n&quot;
					local hwnd_config = hwnd_children[i]
 					uiAccessor.pressButton hwnd_config
					)
				)
			)
		else if (dialogTitle == &quot;Configure Direct3D&quot;) 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 &quot;Use Cached D3DXMeshes&quot; == 1) then (
					format &quot;found the cached button\n&quot;
					local hwnd_cached = hwnd_children[i]
					local CheckState = windows.sendMessage hwnd_cached BM_GETSTATE 0 0
					local IsChecked = bit.get CheckState BST_CHECKED
					format &quot;the checkbox was: %\n&quot; IsChecked
					-- Uncheck it
					if IsChecked then
					(
						windows.sendMessage hwnd_cached BM_CLICK 0 0
						windows.sendMessage hwnd_cached BM_SETCHECK 0 0
						format &quot;Cached D3DXMeshes has been disabled.\n&quot;
						format &quot;Pressing OK on the ConfigureD3D page\n&quot;
						uiAccessor.sendMessageID hwnd #IDOK
						format &quot;Pressing OK on the Preferences page\n&quot;
						uiAccessor.sendMessageID prefsDialog_hwnd #IDOK
						retMessage=&quot;Turning the CachedD3DXMeshes *OFF*&quot;
					)
					-- Check it
					else if not IsChecked then
					(
						windows.sendMessage hwnd_cached BM_CLICK 0 0
						windows.sendMessage hwnd_cached BM_SETCHECK 1 0
						format &quot;Cached D3DXMeshes has been enabled.\n&quot;
						format &quot;Pressing OK on the ConfigureD3D page\n&quot;
						uiAccessor.sendMessageID hwnd #IDOK
						format &quot;Pressing OK on the Preferences page\n&quot;
						uiAccessor.sendMessageID prefsDialog_hwnd #IDOK
						retMessage=&quot;Turning the CachedD3DXMeshes *ON*&quot;
					)
 				)
 			)
 		)
 	)
	true
&nbsp;
 )
&nbsp;
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
)
&nbsp;
toggleUseCache()
format retMessage</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2008/11/3dsmax-directx-oddity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maxscript: Grid by Name</title>
		<link>http://buchhofer.com/2008/11/maxscript-grid-by-name/</link>
		<comments>http://buchhofer.com/2008/11/maxscript-grid-by-name/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 12:20:39 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[grids]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=90</guid>
		<description><![CDATA[Here&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;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!</p>
<p>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 &gt;:)</p>
<p>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)</p>
<p><a href="http://www.buchhofer.com/Scripts/Grid_By_Name.ms"><img class="alignnone" title="Maxscript: Grid by Name" src="http://www.buchhofer.com/Scripts/Grid_By_Name.jpg" alt="" width="261" height="168" /></a></p>
<p>&#8211; if there are no grids in the scene, then toggle between the toolmodes<br />
&#8211; if there is just 1 grid in the scene, toggle between it and the Home Grid<br />
&#8211; if there are grids in the scene, open the window<br />
&#8211; if there are grids in the scene and the window is already open, toggle between the grids</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2008/11/maxscript-grid-by-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>working :)</title>
		<link>http://buchhofer.com/2008/10/working/</link>
		<comments>http://buchhofer.com/2008/10/working/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 14:19:34 +0000</pubDate>
		<dc:creator>Dave Buchhofer</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[asset management]]></category>

		<guid isPermaLink="false">http://buchhofer.com/?p=72</guid>
		<description><![CDATA[yay, all the right clickies work.]]></description>
			<content:encoded><![CDATA[<p><a href="http://buchhofer.com/wp-content/uploads/2008/10/pyassetbrowser1.jpg"><img class="alignnone size-medium wp-image-76" title="pyassetbrowser1" src="http://buchhofer.com/wp-content/uploads/2008/10/pyassetbrowser1-300x147.jpg" alt="" width="300" height="147" /></a></p>
<p>yay, all the right clickies work.</p>
]]></content:encoded>
			<wfw:commentRss>http://buchhofer.com/2008/10/working/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

