Jump to content

3d Max Scripting Help Needed


guitarboy
 Share

Recommended Posts

Hey all.

 

Ive just started mucking around with max scripting using MAXscript listener and stuff just to get a feel for it and see if i like it, but have run into a bit of a barrier.

 

Like i said, im using the MAXscript listener to help me work out things like, chamfer, connect, extrude, etc commands, but for some reason, the detach one does not seem to work. i copy the detach command from the script listener as it gets it and insert it into my script, but the detach command i get doesnt actually detach the polygon at all.

 

Anyone able to write out the detach script for me, or help me out in finding it, would be very helpful :)

 

Many thx

Link to comment
Share on other sites

elementbreak = $ -----is say elementbreak = what is selected---------

elementbreak.numfaces ----- asks how many faces are in the orginal piece

thebreak = meshop.getElementsUsingFace elementbreak 1 ---gets the faces for element

while elementbreak.numfaces != 0 do ----makes sure there are some faces left

(

newMesh = meshop.detachFaces elementbreak thebreak delete:true asMesh:true

update elementbreak --remaining mesh

update newMesh --- the detached faces

emesh = Editable_mesh() --create an empty Editable_mesh

emesh.pos = elementbreak.pos --- makes the shell is in the right place

emesh.mesh = newMesh -----puts the detached faces in the shell

update emesh ----redraws the faces

emesh.pivot = emesh.center ----resets the pivot of the broken off piece

gc()

)

 

delete elementbreak --------deletes the empty mesh after all pieces have been pulled out

 

 

Here a script to break out elements of a mesh.

The key is you have to make an empty edit mesh to put the detatched faces in.

 

Hope this helps

Link to comment
Share on other sites

The above script may be what you need, what would be a good approach for future queries would be to describe exactly what you would like a tool to do, describe the work flow, and underlying reason for the script. This would be a good process to help communicate the idea and also would help with working through the idea for you own programming effort.

 

The Maxscript Help file is an invaluable resource, which unfortunately can be hard to navigate. You will find that the listener only gets you 20 - 30% of the information you might need to make a more complicated script, and things that show up in the listener are not always what you want in a script.

 

I did some basic maxscripting demos at a Max User group meeting recently, with some scripts that are here:

 

http://www.neoscape.com/clients/aauga/

 

Click on "May 2008" on the lower right side and download the movie (.zip) file and the scripts.

 

-Nils

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...