changing values ​​of the object

Guys, I'm from Brazil I'm trying to learn MAXScript and would very much help from you!
I'm trying to create a script that can change height and width of a box using a textbox and a button. When you already have in your desktop for a Box selected it can put a value in the textbox and then click the button for the script to change the height of the object. How am beginner've tried a few things nothing worked. If you comment on how the script so that I can understand, I will be very grateful.
Thank you.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sonnenberg's picture

Good evening friends! I am

Good evening friends!
I am wanting to put the visual image within MAXScript editor and put color on the buttons that resource type can do with MAXScript?

sonnenberg's picture

Good night guys, As said in

Good night guys,
As said in the previous post I'm new to Max script following the suggestion of our friend barigazy sppiner I'm trying to use the same idea using the script from the previous post and use sppiner trying to change the height of obejeto. I do not know if my idea this right and that the class I'm using is correct for my kind of script. Below attempt to script.

rollout teste "Enter New Base Name" width:176 height:243
(
spinner test "testwidth: " pos:[24,126] width:136 height:16 range:[1,10,5] type:#integer

button create "width" pos:[16,208] width:144 height:24

on create pressed do
(

if selection.count == 0 then messageBox "Select some objects first!" title:"Warning" beep:off
else
(
for i in selection do i.width = classOf et_base_name.width
)

)

)
createDialog teste

sorry for the mistakes that English is not mastered how to use English translator!

barigazy's picture

...

U can put your code between tags to look like this

try(destroyDialog ::teste) catch()
rollout teste "Enter New Base Name"
(
	spinner test "Objects Width: " pos:[5,5] width:140 height:16 range:[.001,1e5,5] type:#float
	button create "Set Width" pos:[5,25] width:140 height:24
 
	on create pressed do
	(
		if selection.count == 0 then messageBox "Select some objects first!" title:"Warning" beep:off
		else (for i in selection where isProperty i "width" do i.width = test.value)
	)
)
createDialog teste 150 50

Read this http://www.scriptspot.com/filter/tips

barigazy

sonnenberg's picture

I'm trying to learn to change

I'm trying to learn to change with this script I got the site MAXScript. I am very beginner in this area. If evaluate my knowledge of 0 to 10 my knowledge is 1.
Sorry to ask these questions of beginners.
Below script.

rollout rename_rollout "Enter New Base Name"
(
edittext base_name ""
button rename_them "RENAME SELECTED OBJECTS..."
on rename_them pressed do
(
if base_name.width != "" do
for i in selection do i.width = uniquename base_name.text
)
)
createDialog rename_rollout 250 50

barigazy's picture

...

Here we go
This video training is very good for starters
http://www.scriptspot.com/3ds-max/tutorials/maxscript-101-free-online-tr...
Next your code

-- if you declare rollout variable as global then your rollout will close same (already opened) dialog after you run code again
-- for more info read in MaxScript Help topics like:
--"Scope of Variables"
--"Rollout User-Interface Control Types"
 
try(DestroyDialog ::rename_rollout) catch()
rollout rename_rollout "Enter New Base Name"
(
	edittext et_base_name "" pos:[2,5] fieldwidth:220 height:17 -- read in help what's mean height of 17 for textbox
	colorpicker cp_wirecolor "" color:black pos:[222,5] fieldWidth:20 height:17 modal:off
	button btn_rename_them "RENAME SELECTED OBJECTS..." pos:[5,27] width:240 height:20
	on btn_rename_them pressed do
	(
		if et_base_name.text == "" then messageBox "Enter some text first!" title:"Warning" beep:off
		else
		(
			if selection.count == 0 then messageBox "Select some objects first!" title:"Warning" beep:off
			else 
			(
				for i in selection do i.name = uniquename et_base_name.text
			)
		)
	)
	on cp_wirecolor changed clr do 
	( 
		-- when you wand to do some operation on selection always check if count is greater then zero
		if selection.count != 0 do selection.wirecolor = clr
	)
)
-- now create styled dialog size 250x50px and cordinates from top left corner x:10 y:110
createDialog rename_rollout 250 50 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

barigazy's picture

...

Now try to write tool to changing basic properties of "Primitives" objects like
width, height, length , radius etc. using "spinner" controls.
A tip: check selection count and if selected object have properties that you nee to change.
Read this topic "Class and Object Inspector Functions".
If you have a problem just post your code again here.

barigazy

barigazy's picture

...

Post what you have for now.
If you want the answer tou need to post some code first

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.