Tagged 'General Scripting'

Align Pivot

First post here, i thank in advance for your patiente.

Lets suppose i have a sphere: after convert it to Editable Mesh, it is possible to Explode all its polygons into new objects.
The problem is the following: all these new objects inherit original sphere Pivot coordinates.
I know it is possible, by using Hierarchy panel, to select all the new objects, turn on Affect Pivot only and center the pivot on each object.

how to print in MAXscript Listener

Hello

I made a little "script" to change viewport FOV :
-------
a = viewport.GetFOV()
a = a + 15
viewport.SetFOV a
completeredraw()
print a
-------
when I run this from Maxscript Listener it is ok : I have a.value printed
But when I run this in a .mcr, this don't works...
I have other scripts where "print" works as I expect.
If somebody can help :-)

Getting object positions relative to another object's local space?

UPDATE =================================

Thanks to Insanto and Anubis I have found two ways to do what I needed below!

1. theCoords = ($Box01.transform * (inverse $Plane01.transform)).pos
2. theCoords = in coordsys $Plane01 $Box01.pos

========================================

Hello, I'm having trouble getting object's positions relative to another object's rotation & position (transform). See example below:

export selected via maxscript

super simple question but I have no idea and don't found anything in max help.
I want export to obj selected objects from scene to file for specified name.Is it possible at all via maxscript?

The only thing I found is:
actionMan.executeAction 0 "40373" -- File: Export Selected
but there is no access to name, extension, etc.

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 :)

Maxscript write and read .txt file

So I'm making an exporter in maxscript
I have troubles writing the export path into a .txt file and reading it.
This is what I have:

----------------------------------------------------------------------------------
label labelExportFolder "Export folder" pos:[10,600]
edittext folderPathTxt "" pos: [10,620] width:140
button btnBrowse "..." pos: [160,620]
on btnBrowse pressed do
(
Global MyPath = "" -- this stores the path in string form

local dir = getSavePath caption:"path..."
if (dir != undefined) do ( folderPathTxt.text = dir )

how to access vray render settings?

i know showproperties renderer.current
will show me vray properties, but how can i access them?

i have done this with vray camera that wokred, through getVrayPhysicalCamera()

but how to accesss vray render settings like noise threshold, gamma, dmc subdivisions

i can see the commands but i dont know how to access because of the renderer.current command

rotation based on position change

Hi everybody,

I need help developing a rotation script driven by an object translation.
it's similar to the degtorad expressions "degToRad(360*(Ypos/(2*pi*Radius)))" but what I need is a "rotation script" to convert the vector calculated from the object translation into rotation and I'm very bad dealing with rotations in Maxscript.

Thanks in advance
Hani Tiby

create dotnetcontrol buttons inside function

I want to create buttons depending on certain things!
So here is what I need:

fn myfunction=
(
...
 
for i=1 to IDcount do
(
     dotnetcontrol ID_btn[i] "System.Windows.Forms.Button" width:20 height:60 pos:[27,i*153]
     ID_btn[i].backcolor  = (dotnetcolor 70 70 70)
     ID_btn[i].flatstyle = dotnetobject "System.Windows.Forms.FlatStyle" Flat
     ID_btn[i].text="1"
     ID_btn[i].foreColor = (dotnetcolor 200 200 200)
)
)

How to make it work?

convert: undefined to type: String PROBLEM [SOLVED]

OldString = "Arch137" as string -- Change to suit
NewString = "AM137" as string -- Ditto
theMaps = getClassInstances BitmapTexture
for i in 1 to theMaps.count do (
	fileName = theMaps[i].filename
	if matchPattern fileName pattern:"AM*" ignoreCase:false == false then (
		newFilename = trimleft fileName OldString
		new2filename = NewString + newFilename
		theMaps[i].filename = new2Filename -- renames
	)
)
Syndicate content