[Closed] dubugging: how to
i am trying to use the debug tool in maxscript but cant get to figure out how…tried the help without luck…
my script is quite long and it works with all files but 1… probably there is some condition i havent added or whatever but i cant figure out with the error message… the problem is such that after executing the script once it doesnt compile if i make changes. actually maxscipt stops working totally… so if i enter any command in the listener it wont react or work… nothing until i restart max.
– Compile error: Unexpected end-of-script
– In line: < >
so please someone tell me how can i use debug and watch my script execute line by line and see the value of variables
it really wierd… i tried to strip all objects in my scene and check the script for each object as i was wondering if it could be just a mesh problem…
now i have attached a max file including an object… my script wont run for that object at all and throw an exception… all others are fine. so basically when i convert this object to editable mesh and back to poly the script runs fine…
so this is a mesh problem. is there anything in max to find out what is the problem with this mesh… strangely enough it even crashes maxscript and the listener wont respond to any commands until max restart…
As a general rule running STL Check modifer on your mesh will at least report back if there are any eggregious errors, but oftentimes a mesh that has gone bad will just not be fixable (or understandable). Best bet is to delete and start over again.
That is not what the STL check modifier is used for, and no it does not check if you have errors or problems with your mesh.
The STL Check modifier checks to see if an object will export correctly according to the stereolithography file format. It does not check for any eggregious errors.
hit the esc key when this happens. It stops maxscript from trying to execute anything further from the errored script and will return interupted to the listener. Then you can continue as normal without needing to restart max
when a script gives you an error it stops execution at that point of error. although i have tried escape just in case and nothing… so the bad mesh crashes maxscript
i will check the stlcheck modifier and see if that can report errors on the mesh… my script will be used on hundreds of objects and by other artists at work so i dont want it to throw an error… so just need to find out that if the object has an error then report it to user that the object is bad.
any suggestions how to find an object has error and report to the user… please look at the max file attached in the previous post… its only one object
aparrently i just ran some tests and found that while checking the faces of the object to retrieve its Id’s returns undefined for one of the ID and the script throws an error…
I can load the scene file in Max 8, but if I load it in Max 9. Then it crashes Max.
This isn’t a scripting problem. Your scene file has become corrupted, and will cause 3D Studio Max to act in unpredictable ways. You might not be able to catch these problems.
The only advise I can give you is to wrap your MaxScript code in a try/catch block, and if any exceptions are caught to report it as a problem to the user, but there isn’t much you can do if the data is causing Max to crash.
using the function to get number of faces on this object (above max file) returns 10 whereas the actual faces are 11… there are no hidden faces. this is the error… how can i find out that this is an error and report to user. its really important…
polyop.getNumFaces $
Edited: just found out $.[b][b]GetFaceMaterial <faceid> will give u material ID of the specified faces… this is what is written in the help
“[/b][/b]Returns the material ID of the specified face. If the face index is higher than the number of faces in the EditablePoly, the function will return 1.”
does this mean the function $.GetFaceMaterial in itself checks the total num faces and is able to retrieve the actual count even without the error???
on the object it returns 1 for faces 2,3,5 and 7 … please someone can interpret this better…
[left]
[/left]
this is interesting… all my objects are mostly editable poly and this is the function i use to get faces of an editable poly:
meshop.getNumfaces $.mesh returns the results in total no. of triangles whereas polyop returns the number of polys… but where polyop returns wrong number on this object meshop works fine and doesnt have a problem…
-- Returns the number of faces (Polys) an object has. Takes an object as parameter
function faceCount obj = (
if (classof obj == PolyMeshObject) or (classof obj == Editable_poly) then (
return polyop.getNumFaces obj
)
if classof obj == Editable_Mesh do (
return getNumFaces obj
)
)
anyone? i also want to add an error trapping to this function for cases like this.