Edge Extrude "Preset" for toolbar

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
  09 September 2013
Edge Extrude "Preset" for toolbar

Hey guys!

I use the Extrude tool a lot to create "V" grooves with the same parameters. I need a simple script in which I can define the height and width that will perform an Extrude operation with those values by pressing a button placed in the toolbar.

I'm using Editable Poly objects. If you guys can give me the code so I can duplicate and plug in different values I would be forever grateful! It's been driving me nuts lol I'm sure it's dead simple if you know what you're doing but it's less simple than say, changing the wire color or material using the Maxscript listener lol

Brandon
__________________
_deleted
=======
Acura RSX
Maxda RX-8: Devil Mod {Carbon Drip Edition}
Toyota Celica Custom
Bugatti Veyron
 
  09 September 2013
$.edgeExtrudeHeight = -5
$.edgeExtrudeWidth = 0.5
$.EditablePoly.buttonOp #Extrude


Just select all of it and drag it to your button bar. Now you can make an edge selection in your EditPoly, and then click the button to perform the extrusion.

BTW, I found this just by using the macro recorder
 
  09 September 2013
Originally Posted by deleted: Hey guys!

I use the Extrude tool a lot to create "V" grooves with the same parameters. I need a simple script in which I can define the height and width that will perform an Extrude operation with those values by pressing a button placed in the toolbar.

I'm using Editable Poly objects. If you guys can give me the code so I can duplicate and plug in different values I would be forever grateful! It's been driving me nuts lol I'm sure it's dead simple if you know what you're doing but it's less simple than say, changing the wire color or material using the Maxscript listener lol

Brandon

Because "Extrude Edge" is not exposed in maxscript you can use Edit_Poly modifier.
NOTE: if you not check "Collapse to Poly" checkbox E-Poly modifier will stay on the top.
Also with this tool you can extrude edges of multiple selected objects and delete this modifier from selection


 try(destroyDialog ::bgaRoll)catch()
 rollout bgaRoll "Extrude Edge"
 (
 	spinner spn_height "Height: " pos:[5,5] fieldwidth:60 range:[-1e5,1e5,10]
 	spinner spn_width "Width:  " pos:[5,25] fieldwidth:60 range:[0,1e5,3]
 	checkbox cb_collapse "Collapse To Poly" pos:[5,45]
 	button btn_ext "Extrude" pos:[5,65] width:110
 	button btn_remove "Del Extrude Modifiers" pos:[5,90] width:110
 	on btn_ext pressed do 
 	(
 		if selection.count != 0 do
 		(
 			if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
 			with redraw off
 				for obj in selection where canConvertTo obj Editable_Poly do
 				(
 					addModifier obj (Edit_Poly name:"Extrude Edges" currentOperation:40 extrudeEdgeHeight:spn_height.value extrudeEdgeWidth:spn_width.value)
 					if cb_collapse.checked do convertToPoly obj
 				)
 		)
 	)
 	on btn_remove pressed do
 	(
 		if selection.count != 0 do
 		(
 			if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
 			with redraw off
 				for o in selection where o.modifiers.count != 0 do
 				(
 					for m = o.modifiers.count to 1 by -1 where o.modifiers[m].name == "Extrude Edges" do deleteModifier o m
 				)
 		)
 	)
 )
 createDialog bgaRoll 120 120 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
  
__________________
Looking in the right side. [bgaTools]

Last edited by gazybara : 09 September 2013 at 12:20 PM.
 
  09 September 2013
@Laserschwert
I was able to see "$.EditablePoly.buttonOp #Extrude" in the listener but not the other two lines. Unfortunately, this didn't work. It will perform an Extrude operation, but with the values last defined by the settings.

@gazybara
Since I'm working with instances, I'm trying to avoid using modifiers so I don't have to delete the copy, and mirror it back over.

My hope is that I use this elusive script with one set of values like -4 and 2 for a large groove and create a button for it. Then duplicate it and use the values -2 and 1.5 for a small groove. This way I can simply make my selections, hit one of the two buttons and it just does it without skipping a beat.
__________________
_deleted
=======
Acura RSX
Maxda RX-8: Devil Mod {Carbon Drip Edition}
Toyota Celica Custom
Bugatti Veyron
 
  09 September 2013
Originally Posted by deleted: @Laserschwert
Unfortunately, this didn't work. It will perform an Extrude operation, but with the values last defined by the settings.

What? It works without problems for me... I created two buttons:

$.edgeExtrudeHeight = -4
$.edgeExtrudeWidth = 2
$.EditablePoly.buttonOp #Extrude

and

$.edgeExtrudeHeight = -2
$.edgeExtrudeWidth = 1.5
$.EditablePoly.buttonOp #Extrude

And depending on which one I click, the current edge selection is extruded with either of those values. The first two lines DO set the current settings, the third line executes the extrusion with those settings. This does exactly what you were asking for...

Last edited by Laserschwert : 09 September 2013 at 01:46 AM.
 
  09 September 2013
Originally Posted by Laserschwert: What? It works without problems for me... I created two buttons:

$.edgeExtrudeHeight = -4
$.edgeExtrudeWidth = 2
$.EditablePoly.buttonOp #Extrude

and

$.edgeExtrudeHeight = -2
$.edgeExtrudeWidth = 1.5
$.EditablePoly.buttonOp #Extrude

And depending on which one I click, the current edge selection is extruded with either of those values. The first two lines DO set the current settings, the third line executes the extrusion with those settings. This does exactly what you were asking for...



Alright, now I feel like an idiot lol I made the mistake of trying to run it in the Listener window lol It would seem that it only ran the last line. Pasted it into a new script and evaluated all and it worked as advertised.

Sorry about that! You were right on the money Thanks man!
__________________
_deleted
=======
Acura RSX
Maxda RX-8: Devil Mod {Carbon Drip Edition}
Toyota Celica Custom
Bugatti Veyron
 
  09 September 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 06:30 PM.


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