Tagged 'General Scripting'

STICKY - Forum Guidelines

The ScriptSpot community is a place for professional artists, developers, students or others to come discuss relevent topics. Topics which are deemed inappropriate or inflammatory may be removed at moderator disgression. This is an open community, but it is not a place to air our differences - keep on topic and everyone will benefit from the collective knowledge here.

Content that does not adhere to the following guidelines may be removed or edited without warning at moderator disgression:

boolean code error

sorry ~ many ask ~

i made this code too
this is boolean code about selected face

i tested many times

but i dont know error problem well
pls teach again ~~~

bigbox = selection[1]

faces_sel=polyOp.getFaceSelection selection[1];
polyOp.detachFaces selection[1] faces_sel delete:false asNode:true name:"newface"

smallface = copy $newface ;delete $newface

converttopoly smallface

polyop.extrudefaces smallface (polyop.getfaceselection smallface) (-100)

snapMode.active=false

ProBoolean.createBooleanObjects bigbox smallface 2 0 0

how can i create shape button with script ?

hi
i would like to press button create- spline - recangle button with hwnd way

i modified sample code but error

what problem ?

fn pressButton hwnd: name:"OK" =
(
if hwnd == unsupplied do hwnd = DialogMonitorOPS.GetWindowHandle()
UIAccessor.PressButtonByName hwnd name
)

hwnd = windows.getchildhwnd #max "Create Shape"

DialogMonitorOPS.unRegisterNotification id:#rectangle
DialogMonitorOPS.RegisterNotification pressButton id:#rectangle
DialogMonitorOPS.Enabled = on
UIAccessor.PressButton hwnd[1]

Does exist a simple way to remove variables?

Maybe somebody know a simple way to remove variables what was created during the script testing for example if you create rollout

rollout rl_test "Some Rollout" width:100 height:100
(
  checkbutton myButton "My Button" width:80 height:24
)
createDialog rl_test

if I execute code bellow before rollout is created

rl_test.myButton.state

then I get
-- Unknown property: "myButton" in undefined
and this is fine because max doesn't know about such a rollout and button

MaxScript to batch render with automatic texture changes

Hi!

I have a scene with a single cube, and I need to render (and save) pictures of this scene hundreds of times, each with a different texture (diffuse bitmap) on the cube. The bitmap textures are numbered from 001.bmp to 699.bmp

So basically I need a script to automatically change the diffuse bitmap texture of a single material (Material 01), then render the scene to an image file, and repeat for all the textures.

Is it possible to write such a script? If yes, would anybody be kind enough to write it, or at least point me to a resource that might help?

Thanks in advance :)

Create multiple global variables from an array

I had a situation where I needed to separate out each element of an array (in my case a Multi-dimensional array) to their own globals so I created a fn to do so.

It can set the globals to undefined also.

I made it work with any array type while I was at it.

It's a very edge case fn but here's the code for anyone that may need it.

If you have another method that doesn't involve the use of the execute function then I'd be happy to hear that. Or if you have any comments then please let me know.

(
 
  cnt = undefined ; local cnt = 13
 
  -- String class example.

Load new keyboard shortcut .hsx via maxscript

Hello,
I want to load keyboard shortcut (.hsx) by firing maxscript, .hsx is located in a network path.

Thank you in advance!

Maxscript materials

Hi,

I'm iterating over all materials in a selection in maxscript.
I want to replace the top/bottom materials with the bottom material from the current top/bottom shader.

I can't wrap my head around what I'm doeing wrong.
I don't see the result on the object in the material editor when I select an object with a top/bottom material on it ...

for o in $ where o.material != undefined do
(
if classOf o.material == topBottomMat then
(
copied_mat = copy o.material.bottomMaterial
o.material = copied_mat
)
)

Any ideas?

Regards
Bert

Booleans Bool3 - Create a nested sub-boolean with maxscript code.

Is it possible to create a nested boolean within a boolean (bool3) object with maxscript code. Example: I have a boolean (bool3) with some objects. Then I want to add a new object as a base object and use the other objects as a subtractive (nested) sub-boolean.

This is handy because I sometimes first need to subtract some objects from an object and use the resulting boolean object again as a subtract. I know you can place multiple booleans in the modifier stack, but I would like to solve it all within one bool3 with nested booleans.

face move script error

i made this script
this is script for moving face with 3 vertex
there is error
pls see attacef file

lastvetx = #()

curO = selection[1]

aFaces = (polyOp.getFaceSelection curO) as array

for selFaceBA in aFaces do
(

vertPos1 = polyop.getVertsUsingFace curO selFaceBA
vertPos = vertPos1 as array
vertPosArr = for v in vertPos1 collect (polyOp.getVert curO v).z
vertZmax = amax vertPosArr
topVertIdx = 0

Syndicate content