Start a new topic

msPromptDialogFile help please

I am trying to add to the script that you guys helped with previously. I have added a few things after to delete some stuff and export to fbx.

I am having an issue with msPromptDialogFile. I cannot get it to run on more than one file from the selection(last file selected does)

heres what I have that doesnt seem to be working. 

outs1 = mgPromptDialogFile ( None, MPFM_OPEN, MPFA_FLAGS,


MPFA_PATTERN, "OpenFlight Files|*.flt",


status1 = outs1[0]

if (MSTAT_ISOK(status1)):

numFiles = outs1[1]

fileNames = outs1[2]

for fileName in fileNames:

print fileName

db = mgOpenDb (fileName)

print " Processing ", fileName


mgWalk (db, RemovefltPolygon, None, None, MWALK_NONESTED)

mgWalk (db, RemovefltLightPoint, None, None, MWALK_NONESTED)

mgWalk (db, RemovefltObject, None, None, MWALK_NONESTED)

mgWalk (db, RemoveEmptyLods, None, None, MWALK_NONESTED)

mgWalk (db, RemoveEmptyGroups, None, None, MWALK_NONESTED)



The biggest problem I see is the indentation. Python uses indentation to know what lines belong to particular statements. For instance, if you have the following if statement


function 1 would only be called if myVar was 1, but function 2 would be called all the time.

In your case  you have a loop


Notice how the database is opened after the for loop completes?  This will mean only the last file is opened. Also all the processing you do on the opened database needs to be done inside the for loop as well.

Try something more like this:


I had moved all the lines around due to IndentationErrors:

Where I had them in what I typed above is where the script editor finally liked the placement

Man I wish it wasn't so complicated to move files to unclass boxes. 

yup, that was it. 

I was banging my head against the wall on this for about 2 hours. I was thinking it had something to do with the naming of the numfiles and outs.

I had already used the same code in the top of the script to open a master.flt

was hellbent on it being an issue with naming since they were already used earlier in the script

Glad I could help!

Login to post a comment