Tagged 'General Scripting'

Sorted Array Objects by name

I need to sort the objects in the array by there name without replacing the array with just there names.
The first printed list with all the objects information is what I need, but I need it to be in alphabetical order. The second list is in the correct order but I loose all the objects information.....

arr = selection as array
print arr -- need this array to be sorted by name but still keep all there information
listed = sort(for i in arr collect i.name)
print listed

Select objects by prefix and group them using group name same as prefix

Hello everyone, I started with maxscript few days ago and I'm stuck in this.
I have multiple objects in scene, like: (objectnames)

color_black
color_red
color_blue
bar_1
bar_2
plane001
plane002
...

and I would like to ask how do I use "select" function to select them.

I've used this to select one of them.
select ($color_black)

How can I select all object in scene starting with "color" "bar" "plane"?
and make group with names "color" "bar" and "plane"
Thanks for any help.

Help with the trimleft/trimright function

 

I've taken my favourite script and tried to learn from it. It's probably is a bit complicated for a beginner but I really wanted to add a function to trim any leading and trailing whitespace characters and also add an option for Title case and Sentence case. I read the manual and all I can see is:

 ToLower + ToUpper

Is there another way to achieve Title case and Sentence case?

Help with simple convert to Edit Poly and Quadrify all script

Hi Everyone

I am very new to max script and trying to build something that I feel should be extremely simple... i just can't seem to get it to work.

I am sure I am making some beginner mistake, but I am not getting any errors in the listener, and from the information in the help file I think I have it written correctly.

All I would like the script to do is convert the selection to an editable poly and then quadrify all. I often get heavily triangulated Imports from AutoCAD and this can be helpful when cleaning up the meshes.

Resource: Get All Textures Function

EDIT (2014-07-11): Antomor replied with a version reduced to just 2 lines. This will give you a string array of file paths rather than the actual bitmap instances, though. Use Anubis' getClassInstances version below for bitmapTexture instances.

Newbie question - how to script Select All command

Hello everyone ...

I apologize if this has already been addressed in the past.

I am trying to find out what is the appropriate way to script the Select All command (select all objects).

I have tried looking this up in the Maxscript reference and doing a search online to no avail.

Is it possible to do a Select All in maxscript?

Thanks in advance for any replies.

Remove specific type of object from scene...

I would like to know how I can create a script that specifically deletes a certain object from the scene.

Example: I accidentally select a space warp or particle view or something and I want to be able to click a button that automatically finds particle view and removes it from my scene.
Here's my lousy attempt:

(
on press return (Particle_View.current!=undefined)
on execute do
(
if( Particle_View:Particle View.current==undefined ) then true
else Particle_View.current.DeleteSelected()
)
)

print selected object name

what i want max to do is to print the selected object name every time i select one object/change selection

but i cant figure out how to do it..
any insights?

Problems assigning default values to variables in a function

This is my first post, so I honestly apologize if I'm doing something wrong...

I'm new at MAXscript and I've got a little problem trying to assign default values to variables in a user function. Let's just take the example MAXscript help provides:

   function sign val:0 =
   (
   if val == 0
   then messagebox ("Equal to 0")
   else if val > 0
   then messagebox ("Greater than 0")
   else messagebox ("Less than 0")
   )

Can't edit the “Main Toolbar”

Can't edit the “Main Toolbar”? I
would like to ether delete some buttons from the main toolbar. Or I
have started a new main toolbar but there are some tools unavailable
from the original, such as Selection Filter, Reference Coordinate
System, and so on. I thought all was available via “Customize”

Syndicate content