Scripting assistance for a remove tool

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2013
Scripting assistance for a remove tool

Hi all, I recently decided to start leaning maxscript. The fist thing I want to tackle is scripting a decent remove tool that works on simple editable poly objects or in the presence of an edit poly modifier.

This is what I have thus far:


    macroScript My_Edge_Remove category: "My Tools" buttonText: "Kyle's Edge Remove3" tooltip:"Remove edges and clean verts3"
    (
    	oper=false
    for x = 1 to $.modifiers.count do
    	(
    		if ((ClassOf $.modifiers[x])== Edit_Poly) and (oper=false)  then
    		
    			if subobjectLevel==2 then
    			$.modifiers[x].ButtonOp #RemoveEdgeRemoveVertices
    			oper=true
    		
    			if subobjectLevel==1 then
    			$.modifiers[x].ButtonOp #RemoveVertex
    			oper=true
    	)
    	if oper==false then
    		$.EditablePoly.Remove ()
    )
    
    


this code seems to work correctly if the object is only an editable poly, however, If an edit poly modifier is added later the script only seems to remove verts when I use it under selection level 1 of this modifier. If I use the script under selection level 2 in the edit poly modifier then there is simply no result, no error message appears on the screen or in the Listener. The same is true if after adding the edit poly modifier I go back down to edit the editable poly level of the hierarchy, though this does yield an "--Unknown system exception" error after a few attempts. If anyone knows how to directly get the currently selected modifier from 3ds max that would be more efficient than looping through and trying to find an Edit_Poly modifier in the hierarchy.

Any help would be greatly appreciated!

Last edited by yamanash : 03 March 2013 at 08:57 PM.
 
  03 March 2013
As for the second part, getting the current object in modifier stack: modPanel.GetCurrentObject()

For the rest be sure to search the forum for posts like this one.
__________________
Scripts :: linkedin
 
  03 March 2013
Thanks a lot, I have it working now.
 
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:39 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.