ScriptSpot home

Forum topic · General Scripting

network drive path to UNC path

By beatwalker · 2012-01-25

Description

Hi!
How can I change(replace) may network drive path to UNC using maxscript ?

ex:
T:/work/model_A/texture
T:/work/model_B/texture
T:/work/render

change to

//PC01/work/model_A/texture
//PC01/work/model_B/texture
//PC01/work/render

I just want to change "T:" to "//PC01",
and these are the list of I like to change.

map path
Render Output path
Render Elements path
XRef Objects path

Im using max2012

thank you

Comments (3)
Panayot Karabakalov

can tell whether this works in Max2012
but lets hope its helpful anyway.

-- converting path to UNC
pathConfig.convertPathToUnc "path_string"

-- maps path
for m in (getClassInstances bitmapTexture) do
m.fileName = pathConfig.convertPathToUnc m.fileName

-- set Render Output path
rendOutputFilename = "path_string"

-- set Render Elements path
re = maxOps.GetCurRenderElementMgr()
for n = 0 to (re.NumRenderElements() - 1) do
(
	el = re.GetRenderElement n
	fl = re.GetRenderElementFileName n
	
	el.bitmap.fileName = pathConfig.convertPathToUnc fl
	--or...
	re.SetRenderElementFilename n (pathConfig.convertPathToUnc fl)
)

-- XRef Objects path
for obj in objects where IsKindOf obj XRefObject do
(
	obj.proxyFileName = pathConfig.convertPathToUnc obj.proxyFileName
	obj.fileName = pathConfig.convertPathToUnc obj.fileName
	updateXRef obj
)

IES file

Hi,
I used your script and it work great :), except it's not converting the IES file for photometric light. i tried to change some of the code but with no success.

I need help to add this feature

Thanks...

beatwalker

I could change bitmaps using script below,
but I have no idea how to write "Render Output path""RenderElements path"and"XRef Objects path" in maxscript.

for m in (getClassInstances bitmapTexture) do (
drive = toLower (subString m.filename 1 2)
if (drive == "T:") then ( m.filename = "\\\PC01" + subString m.filename 3 -1 )
)