r/Maxscript • • Nov 06 '19

Terminal command for workgroup name?

0 Upvotes

Is there a simple command that displays output of Mac so I can see the current workgroup?

Any input would be amazing.


r/Maxscript • • Jul 01 '20

3dx Max

1 Upvotes

i want to create an environment complied of only boxes and how do i do that using maxscript. kinda new so can anyone help me out with some codes?


r/Maxscript • • May 06 '22

Maxscript : Arrays

Thumbnail
youtu.be
3 Upvotes

r/Maxscript • • Mar 06 '15

Print a string without quotation marks?

3 Upvotes

What can I place after this to display a string without quotation marks?
Similar to Adding 'as name', but that'll return: #no quotes

myString = "no quotes"
myString

r/Maxscript • • Jun 06 '26

Hi everyone, somebody know how to create a 3ds max script that assigns selected materials to objects with the same name?

2 Upvotes

r/Maxscript • • Aug 27 '19

Simple Grab Viewport and Save it - HELP

3 Upvotes

I want a very simple script to grab the viewport and save it on the same opened project folder.

I did it all, select the viewport that I want, change the shading method, but I cannot make up the script line to get the file path and save the image into it.

I tried:

1

print (getBitmapInfo (getDir #maxroot +"\\capture\\+(getFilenameFile)+ ".jpeg"))

--

2

img.filename = MyPath + (getfileNameFile maxFileName) + ".jpg"

save img

--

3

getFilenamePath() + "\\"

--

4

img.filename = getSaveFileName (getfileNameFile + getMAXSaveFileName) + ".jpg"

save img

The last one, works once, but strangely when you run it again, it doesn't. No explanation, just saves once, even if you delete the image, it does not save it again. Only when Max is restarted.

I found in the ScriptSpot this but I just want one button click to run this, no further options.

Thank you.


r/Maxscript • • Jun 17 '18

Is this function doing too much, or a fine amount? Please critique the method.

2 Upvotes
fn ShapeFromArray shapeName myInterpolation theKnotPositionArray theSegmentmaterialArray=
(
	-- create the shape object
	newShape = splineshape()
	--add a spline to the shape
	newSpline = addnewSpline newShape
	--add knots from array
	for myKnot in theKnotPositionArray do
	(
		addKnot newShape newSpline myInterpolation #curve myKnot
		--#corner, #smooth
	)
	--update
	updateShape newShape
	newShape.name = "tmpShape"
	for i = 1 to theSegmentmaterialArray.count do
	try(
		setMaterialID $'tmpShape' 1 i theSegmentMaterialArray[i]
	)catch()
	updateShape newShape
	newShape.name = shapeName
	select (getNodeByName shapeName)
)
--------------------------
/*
--now the function can be called like this:
myKnotArray = #([3.79589,0.0475944,-100], [3.59589,0.0475944,-100], [3.59589,0.0393065,-100], [3.79589,0.0393065,-100], [3.79589,0.0475944,-100])
mySegmentMaterialArray =#(10,1,1,1)
shapeFromArray "firstShape" #corner myKnotArray mySegmentMaterialArray

It's just a function to create a shape and assign material IDs to its segments, create 2 arrays and use the function, as shown.
When declaring the function it will fail on the setMaterial line because I think it is trying to execute that line, so I wrapped it with a try/catch and it skips over it.
I'm starting to see how I can bundle more and more into a function that I'll use multiple times in a script. This is what I should be doing with functions right?
In this example It it faster to create the shapes rather than using a merge command which is slow.


r/Maxscript • • May 19 '17

Undocumented MAXScript Features

3 Upvotes

Blogspot post I made to make my life easier since I keep forgetting these.

Apart from stuff most of you already know (edit poly methods), there's more than 30 other sections. Everything reported previously as missing/incomplete, and once again brought to attention of the documentation team after compiling all the info in that post, so a more complete version will hopefully appear in the official docs in the future.

There's bound to be much more of these that I'm not aware of so if you didn't find something you know is undocumented or documented in a misleading way in the list, I'd be happy to hear that.

There are also numerous function-holding structs and global functions defined in stdscripts like snaps, filters, functions from controllerfunctions.ms, VFB_methods, lvops (.net listview helper fns), tvops (dtto for treeview), PolyToolsUI, PolyBoost, Ribbon_Modeling, Main_Ribbon. While those are not documented either and quite useful (there's a lot of stuff that almost everyone who starts writing maxscript reinvents again since there's no mention about it in the reference), I didn't include those as anyone can access them, see what arguments are expected and what the function does.


r/Maxscript • • Apr 14 '15

Diving deeper into the Material Editor to 'ShowInViewport'

2 Upvotes
meditMaterials[2].materialList[28].ShowInViewport = true  
This works, but the bitmap I really want to show is a little deeper  
  
Toggling the Use Real-World Scale I get this:  
meditMaterials[2].materialList[28][#Maps][#Diffuse_Color__Map__166____Falloff].map2.coords.realWorldScale = on  
But I'm unable to reach a 'ShowInViewport' at this level.  
meditMaterials[2].materialList[28][#Maps][#Diffuse_Color__Map__166____Falloff].map2.ShowInViewport  
gives:  
-- Unknown property: "showInViewport" in Map #167:Bitmap  
  
Can I get this Bitmap showing in my viewport with Maxscript?  

It works to press the 'Show Shaded Material in Viewport' button, but I'm wanting to script a bunch of these to turn on when importing a library material for a building texture tool.


r/Maxscript • • Apr 05 '15

Could someone point out how to optimize/foolproof this simple working script.

2 Upvotes
(
    ( 
        if MatEditor.isOpen() == true then
        (
            MatEditor.Close()
        )
        else
        (
        )
    )
    meditMaterials[1] = Standardmaterial ()
    meditMaterials[1].Diffuse = color 255 255 255
    meditMaterials[1].ambient = color 255 255 255
    meditMaterials[1].name = "whiteMaterial"
    (
        objectSelection = selection as array
        clearSelection()
        for obj in objectSelection do
        (
            select obj
            currentObject = $
            if superclassof $ == GeometryClass then
            (
                $.material = meditMaterials[1]
                $.wirecolor = color 0 0 0
                meditMaterials[1] = $.material
            )
            else
            (
            )
        )
    select objectSelection
    )
)

This here just applies a white material and sets wireframes to black.
In a past thread someone had gone through and dropped a few lines from a different script for me:
-- select obj
-- currentObject = $
(keep the obj instead of $)
I tried that here but it was failing, I must have missed something.
And I just saw these two lines:
$.material = meditMaterials[1]
meditMaterials[1] = $.material
I feel like a moron for leaving those in, ha.
I have empty else statements, is this a correct use of that?
Thanks again.
edit: Is 'foolproof' the correct term?


r/Maxscript • • May 01 '20

Dynamic Dropdownlist

1 Upvotes

Hello how could i go about and just show specific Items from the dropdown Array according to the value of a slider? I got the part "if slider == 7 then" but dont know further, ideally it would be "... Then show item 4 to 8" for example.


r/Maxscript • • Apr 16 '21

Being annoyed by ones lack of consistency

2 Upvotes

--Saw this yesterday, 3 arrays created slightly differently one after the other. Do you like a full stop here.
myArr1 = #()
myArr2= #()
myArr3 =#()
--
usuallyLikeThis = ""
Then why did I name this $RenderCamera ?
--
if (this == that) then
(
do this
)else --that's an ugly place to put this?
(
do that
)

I've been trying to look at being more consistent in how I'm formatting code, the more I focus on that, the more I have these moments of self loathing when I'm acting like there aren't any rules, or making up new conventions on the fly.

I started writing my variable names out longer and using less abbreviations so it's camera instead of cam. But I'm sometimes wondering: 'what's the point!?'

I'm loving it but how do I become more disciplined?


r/Maxscript • • Apr 21 '21

Do you have a better way to write this tournament function. I will do things like run an operation on the verts of a face with it.

1 Upvotes
testArr = #("a","b","c","d","e","f","g")
fn Tournament arr =
(
    local numberOfPlayers = arr.count
    local numberOfMatches = numberOfPlayers - 2
    for i = 1 to numberOfPlayers - 1 do
    (
	for n = (numberOfPlayers-numberOfMatches) to numberOfPlayers do
	(
		print (arr[i] as string + " vs " + arr[n] as string)
	)
	numberOfMatches -= 1
    )
)
Tournament testArr

r/Maxscript • • Apr 20 '21

Select even vertices

1 Upvotes

Hello guys, I am a noob but I really need to select evenly the vertices of my geometry (1,3,5,ecc), or better ione vertex every two.. and i can’t find a script/command. please can you help me?


r/Maxscript • • Mar 30 '21

Disable Buttons

2 Upvotes

Is it possible to use maxscript to deactivate previously active buttons when no object is selected?

	on bt_head changed state do
	(
		if bt_head.checked == true then
		(
			selectmore $Farlee_pelvis_torso_spine1_Ctrl
		)
		else if bt_head.checked == false then
		(
			deselect $Farlee_pelvis_torso_spine1_Ctrl
		)
		
	)

r/Maxscript • • May 04 '21

Batch Render Preset

1 Upvotes

I'm using the following code to populate the Max Batch Render utility with a view for each camera in the scene:

for b = batchRenderMgr.numViews to 1 by -1 do
(
temp = batchRenderMgr.GetView b
temp.overridePreset = false
temp.outputFilename = (edtxt_outputPath.text + "\\view0" + (b as string) + ".jpg")
temp.presetFile = "C:\\Presets\\production.rps"
)

The preset file exists, the path is correct, and the script throws no errors when executed. However, nothing appears in the dropdown list for presets. Does anyone know why, and how to force it?


r/Maxscript • • Mar 23 '17

(REQUEST/HELP) Script for controlling MultiRes based on camera distance.

1 Upvotes

Hey guys, first off, I have a very limited knowledge of maxscript. I'll let you know what I'm trying to achieve, and where I am so far.

AIM

In a scene with many High polygon objects, to be able to select a high poly object and a camera (or dummy), extract the distance between the two objects to drive a Multires percentage, with capped value. For example, if the camera is 5m or closer, the object will be at 100% poly count. Whereas if the object is from 5m to 100m the polycount will gradually reduce until it gets to 2% but wont drop below that.

note, for the above figures and distances would be great for this to be a customisable value.

MY SOLUTION SO FAR...

So far, I've achieved the right effect using Wire Parameters, using a expose transform helper and wiring the Distance to the Multires vertex count % using this formula:

2+(98*exp(-(distance-500)/1000))    

that gives me a capped 100% vertex count at 5m distance that drops down to 2% over about 100m using an inverse exponential curve and doesn't drop below 2%. (so the object never disapears)

MY ACTUAL QUESTION

And that's fine, for 1 object. but when I want to do this with 20-40 different objects, this becomes really time consuming. And not very flexible.

I don't know how to do this, but in wire parameters, is it possible for multiple wire parameters to reference a formula defined elsewhere? So if I change the formula in one place, the rest will change too?

Or, am i doing this the hard way, is there a simpler way to achieve this same effect and control?

Thanks for having a read, i hope what I'm trying to achieve makes sense.


r/Maxscript • • Oct 18 '16

(Script Request) Set UV Position Presets

1 Upvotes

Hey All,

I don't suppose anyone would be kind enough to whip up a little script that would allow me to move selected verts/faces to preset locations in UV space? I have to do a lot of mapping of swatches and it's a pain to have to move them all by hand and remember which vague color is what material.

Ideally, the basic interface would just have some buttons with labels on them for easy reference. Just select your verts/faces/whatever, hit a button and it sends those verts to a single spot in UV space. If it were a little more robust, that would be great, but that basic functionality is all I really need aside from the ability to change coordinates, but I'm cool with going into the .ms file to alter that.

If you're down to help and/or wouldn't mind getting crazy with it, I'm sure I can think of ways to make it better :)

Thanks in advance!


r/Maxscript • • Mar 18 '17

Incremental Translation - maxscript

1 Upvotes

So I've been trying my best but failing at creating a way to (like Maya) limit my Gizmo's movement by a given increment.

Is there a script out there that does this? Or any ideas as to where I should start to try and tackle this?

PS. Anyone know how to access Max's angle snap settings through code? (It's nowhere to be found in the help documents.

Thank you for your time. :)


r/Maxscript • • Oct 18 '16

Using Notepad++

2 Upvotes

Is there a recommended way to configure Notepad++ for writing MAXScript?
I browsed this page http://www.ycdivfx.com/notepad-maxscript-ycdivfx-packages/ and noticed that this would execute scripts directly from the Notepad++ - I don't know if this is something that I want to do - is it??
I think I just wanted some colourised terms and mayyybe an autocomplete, anyone know what I'm after or what is a good standard?


r/Maxscript • • Aug 31 '15

Convert array to edge selection #(2,4,6,9) to 2,4,6,9

1 Upvotes
myEdgeSel = #(2,4,6,9)  
$.modifiers[#edit_poly].Select #Edge#{(myEdgeSel as ??)}

I'd need the selection to be #{2,4,6,9}
How can I get 2,4,6,9 out of my array #(2,4,6,9)? thanks!


r/Maxscript • • Jan 15 '23

save- load animation problem

1 Upvotes

Hi to everyone. I am animator and recently noticed a ridiculous problem in 3ds max. As you well know you can save and load animation in 3dsmax easily. It have "relative" option in loading that make it more useful. But the problem. If your object is linked to another one the relative option not working and result is "absolute".even there is no different if you try it in "save load animation" in curve editor right click menu. So I think to scripting. The script that do this in curve editor: 1-Set selected keys into an array.it should be dependent of object and track name so it can operate on any track. 2-Subtract last array member value from first one. And hold it into something like "A" or copy it to clipboard. 3- Subtract last array member frame number from first one. And hold it into something like "B". 4-move the selected keys to "B" frame after 5-add "A" to the values of selected keys . My main problem is the "1-" making right array. I Know this is very basic idea. Thanks for better ideas and any help.


r/Maxscript • • Jan 01 '23

Simplifying Vray and Corona Material with maxscript

1 Upvotes

Hi, I am very new to maxscript and I want to simplify vray and corona materials with maxscript.

I want to connect each and every map directly to its corresponding socket. Please check the attached example below to get a clear idea.

If anyone can help I will be very grateful as I want to do this on 100s of materials.

Thanks


r/Maxscript • • Sep 07 '23

A little help with structs?

1 Upvotes

I'm trying to make my script more readable and for the declaration of the struct it is beautiful:

struct SequenceBase
(
Name,
Spline,
Dolly,
LockTargetToCam,
FocusDist,
FStop,
TargetPos,
SplineHeight,
Rotate,
Speed,
Start,
End
)

But when it comes to assigning values I have to type everything in one long line like this:

Sequence[ActiveSequence] = SequenceBase Name:EA_Rollout.txtSeqName.text Spline:SplineList[EA_Rollout.DDLPathSelection.selection] Dolly:EA_Rollout.DollyCam.value LockTargetToCam: EA_Rollout.chkLockTarget.checked FocusDist:EA_Rollout.spnFocus.value FStop:EA_Rollout.spnDOF.value TargetPos:Cam.Target.pos SplineHeight:EA_Rollout.spnArcSpline.value Rotate:EA_Rollout.spnRotateObj.value Speed:EA_Rollout.spnSeqSpeed.value Start:SequenceMarkStart End:SequenceMarkEnd

Is it possible to make this last line comma-separated or in another way make it look more structured?


r/Maxscript • • Sep 04 '23

Help with rollout variables

1 Upvotes

I hope someone can help me out here. (It's probably a very basic misunderstanding on my side)...

I have a rollout with lots of buttons and sliders.First button is a load-button to load a model into max, and the following sliders and buttons can access the properties of the object and for instance rotate the object.But when I run the script, I get a lot of errors because the sliders don't yet know the object or the properties of it...Now, how do I get around this problem?Ideally the bottom of the rollout shouldn't be active until an object has been loaded.

I have tried with two rollouts as floaters where the second one doesn't load until there's an object. But then I get errors in THAT part because Max STILL doesn't know anything about the object yet.

Can someone tell me in what order Max evaluates the script?