False Algorithm
Hey ! I need help again ! I've finish my algorithm !!!! :D no error for run
But Attach_all_mesh and EXPORTATION are failed
Attach_all_mesh nothing happened
EXPORTATION 3ds max say me : --No ""+"" funtion for undefined in line 47
(
exportFile (exportfolderASE + (getFilenameFile maxFileName)+ suff + ".ase") #noPrompt
)
And the algorith :
----------------------------------------------------------------------------------------------------------------------------------- FUNCTION ---------------------------------------------------------------------------------------------------------------------------- function Attach_all_mesh = ( -------------- ATTACH ALL MESH -------------- ( max select all mtl = #() ; tmp = #() ; fin = #() sel = selection as array if sel.count == 0 then -- check selection messageBox "Erreur lors de l'execution du script s'il vous plait contactez Kasimashi" else ( -- filter selection sel = for i in sel where classOf i == Editable_mesh \ and i.material != undefined collect i if sel.count == 0 then messageBox "Aucun Mesh dans la séléction !!! " title:"Attacher les Mesh" else ( for i in sel do appendIfUnique mtl i.material for m in mtl do ( tmp = for i in sel where i.material == m collect i append fin tmp ) undo on ( for i in fin do ( trg = i[1] deleteItem i 1 for j in i do meshop.attach trg j attachMat:#IDToMat condenseMat:true ) ) $.name = "Model"- $.pos = [0,0,0] ) ) ) ) -----------------------EXPORT SUFF --------------------------------------- function EXPORTATION suff= ( ------------------- SCALE 1/88 FOR FREEWORLD LUNASTRA------------------------ ( exportFile (exportfolderASE + (getFilenameFile maxFileName)+ suff + ".ase") #noPrompt ) -----------------------EXPORT GR2 + 3DS ----------------------- ( scale $ [88,88,88] actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected saveMAXFile (exportfolder3DSMAX+ (getFilenameFile maxFileName) + suff + ".max") exportFile (exportfolder3DS +(getFilenameFile maxFileName)+ suff + ".3ds") #noPrompt using:exporterPlugin.classes[1] exportFile (exportfolderGR2 +(getFilenameFile maxFileName)+ suff + ".gr2") ) ) -----------------------PLANE OVER FACE --------------------------------------- function planesOverFaces obj orient = ( local planeArr = #() local ev = polyop.getEdgeVerts local gv = polyop.getvert local gfe = polyop.getFaceEdges local gfsc = polyop.getSafeFaceCenter local gfn = polyop.getFaceNormal local allFaces = (obj.Faces as bitarray) as array for f in allFaces do ( getEdges = gfe obj f local sizeArr = #() for i in getEdges do ( append sizeArr (distance (gv obj (ev obj i)[2]) (gv obj (ev obj i)[1])) ) if orient == 0 then (w = amin sizeArr ; l = amax sizeArr) else (l = amin sizeArr ; w = amax sizeArr) fc = gfsc obj f nf = gfn obj f xv = normalize (cross nf [0,0,1]) yv = normalize (cross nf xv) thePlane = plane length:l width:w lengthsegs:1 widthsegs:1 name:(uniquename "collision_plane_")\ isSelected:on wirecolor:(random black white) transform:(matrix3 xv yv nf fc) append planeArr thePlane ) select planeArr ) -----------------------PLANE OVER FACE --------------------------------------- -----------------------CREATE BOX AS CAGE --------------------------------------- function createBoxAsCage obj = if isValidNode obj do ( local bb = in coordsys local nodeLocalBoundingBox obj local wX = abs((bb[1]-bb[2]).x) , lY = abs((bb[1]-bb[2]).y) , hZ = abs((bb[1]-bb[2]).z) local cage = convertToPoly (box width:wX length:lY height:hZ mapcoords:on name:"Cage" wirecolor:black) CenterPivot cage local tm = obj.transform tm.row4 = obj.center cage.transform = tm polyop.deleteFaces cage #{1,2} planesOverFaces cage (if wX < hZ then 0 else 1) delete cage ) -----------------------CREATE BOX AS CAGE --------------------------------------- -------------------------------------------------------------------------------------------------------------------- DEBUT ALGORITHME ---------------------------------------------------------------------------------------------------------------------- try(destroyDialog ::bgaRoll)catch() rollout bgaRoll "Lunastra Building Compiler • • •" ( local allFiles = #() label Help_1 "-------------------------------------------------------------------------------" align:"center" label Help_2 "Veuillez séléctionner votre répertoire contenant tout vos modèles à exporter" align:"center" label Help_3 "Ensuite cliquez sur le button exporter standard ou détruit suivant ce que vous voulez" align:"center" button btn_import "Selection du dossier" align:"center" label Help_4 "-------------------------------------------------------------------------------" align:"center" button btn_export_standard "Exporter Standard" align:"center" button btn_export_destroy "Exporter Détruit" align:"center" label Copyright "Create by Kasimashi for any problem contact : [email protected]" align:"center" on btn_import pressed do ( dir = getSavePath caption:"Select Folder" initialDir:#images if dir != undefined do ( allFiles = getFiles (dir + "\\*.max") print allFiles ) ( -------------------------------- DECLARATION DES VARIABLES --------------------------- exportfolderASE = dir + "\\" +"ASE"+"\\" exportfolderGR2 = dir + "\\" + "GR2"+"\\" exportfolder3DS = dir + "\\"+ "3DS"+"\\" exportfolder3DSMAX = dir + "\\"+ "3DSMAX"+"\\" ---------------------- CREATION DES REPERTOIRES S'IL N'EXISTE PAS --------------- if doesFileExist exportfolderASE == false do (makedir exportfolderASE) if doesFileExist exportfolderGR2 == false do (makedir exportfolderGR2) if doesFileExist exportfolder3DS == false do (makedir exportfolder3DS) if doesFileExist exportfolder3DSMAX == false do (makedir exportfolder3DSMAX) ) ) on btn_export_standard pressed do ( for f in allFiles do ( loadMAXFile f; max select all --select all objects delete (for o in objects where matchPattern o.name pattern:("*2_*") collect o) Attach_all_mesh $selection.material = meditMaterials[1] --assign standard material $selection.wirecolor = black -- assign black color of wireframe viewport.SetRenderLevel #smoothhighlights actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected EXPORTATION "" ) ) on btn_export_destroy pressed do ( for f in allFiles do ( loadMAXFile f; max select all --select all objects delete (for o in objects where matchPattern o.name pattern:("*2_*") and o.parent != undefined collect o.parent) Attach_all_mesh $selection.material = meditMaterials[1] --assign standard material $selection.wirecolor = black -- assign black color of wireframe viewport.SetRenderLevel #smoothhighlights actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected EXPORTATION "_destroyed" ) ) ) --------------------------------------------------------------------------------------------------------------------- FIN ALGORITHME ---------------------------------------------------------------------------------------------------------------------- createDialog bgaRoll 500 200 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
Comments
This works, but I think that
This works, but I think that 3dsMax don't know how to export as .gr2 and only the GR2 folder is empty.
Tools and Scripts for Autodesk 3dsMax
The problem again is the
The problem again is the variables and where you defines them. Try this:
Keep the functions inside the rollout, otherwise they will become global. Did you read the Scope of variables topic in the maxscript help file?
Tools and Scripts for Autodesk 3dsMax
Don't work :(MAXLISTENNER
Don't work :(
MAXLISTENNER say me :
Without this error Attach all mesh don't work again :(
I've try to remake my script now this script work :p Edit : It had work 1 time now don't work but I've don't edit something in the script is strange !
Thanks for your help !
Regards
Kasimashi