Tagged 'General Scripting'

pivot point and other

Hello,

This may be the wrong place to ask this question. But I am desperate. I have these 2 problems.

I am using 3ds max 2009 and I keep getting frozen shadow on the screen. I have tried everything I have found in the net but didn't work. So if there is anyone with any suggestion please let me know.

The second issue is I use to know what is the short key for the show pivot point so I can move it without going to the pivot editer. So can someone remind me. Thank you all.

 

Material name

Hi, I wanted to have the selected object name of the material ( multisubobject material ) with :
selection[1].material.materiallist[12] for eg.
but I get WOOD:Standart material for eg.

I just want "WOOD". Any help ? Thanks.

Rotation of one object relative to another

Hello . I'm trying to rotate one object relative to another. But it's not like it doesn't work so that when the slider changes, it's smooth.

In 1 case, I managed to make it rotate, but there it constantly adds value when the slider changes.
In 2 cases, I managed to make a smooth rotation, but for some reason it rotates relative to 0 coordinates.

Help solve the problem.

try (destroydialog Transformer) catch()
 
rollout Transformer "Transformer" width:200
(
	local nodeRoot
	local originTM = #()
	local nodeArray = #()
 
	group "Position: "
	(

how to auto-run a script when opening a max file

Hello,
I would like to auto-run a script, everytime I open a max file.

How can I do that ?

Kind regards
Alex

Arc by 3 Points

Original Post : https://forums.cgsociety.org/t/how-to-create-a-arc-through-3-points-with...

(
	local p1 = point pos:[0,0,0], p2 = point pos:[20,80,0], p3 = point pos:[100,100,0]
	local a = p1.pos, b = p2.pos, c = p3.pos
	fn intersection2d p1 r1 p2 r2 = (
		local dx = p2.x - p1.x, dy = p2.y - p1.y,
		det = r2.x * r1.y - r2.y * r1.x
		p1 + r1 * (dy * r2.x - dx * r2.y) / det
	)
	fn Make_Arc a b c ccw:false = (
		local ab = b - a, bc = c - b, mab = a + 0.5 * ab, mbc = b + 0.5 * bc,
		ab = normalize ab; bc = normalize bc

Circle by Point and Tangent

(
	local pt1 = point pos:[50,50,0] , pt2 = point pos:[10,45,0],
	p = pt1.pos, vo = pt2.pos , d = distance p vo , vi = p+(normalize (p-vo))*d,
	r = d/0.551915024494, -- http://gorkamendieta.es/wordpress/maxscript-circle-using-bezier-curves/
	m = matrixFromNormal (normalize (vo-p)) , c = p+m.row1*r, -- there should be better solution to get the vector (m.row1)
	cr = circle radius:r pos:c dir:-m.row3
	in coordsys local rotate cr (AngleAxis -90 x_axis)
	addModifier cr (Edit_Spline())
	select cr ; max modify mode ; subObjectLevel = 1
)

Save the transform relative to another object when transforming.

Help . Hello. There are for example 3 points. How to get a transform matrix of 1 point when transforming 2 points to 3, so that the position and rotation itself is also preserved between 1 and 2 point. (as if point 1 was linked to point 2)

ObjT = $Point002.transform
TrgtT = $Point003_Point.transform
OffT = $Point001_Point.transform

TmOffset = TrgtT * inverse ObjT

in coordsys local TmOffset .rotation = inverse (TmOffset.rotation as quat)
TmOffset.pos += TmOffset.pos

DotNet Draw in Label

Hi. It’s not like it’s impossible to make the text be on top of the DrawRectangle during the Draft and after releasing the MouseUp everything goes back.

    try(destroydialog drawRol) catch()
    rollout drawRol "Draw in Label"
    (
     dotNetControl lb "System.Windows.Forms.Label" width:240 height:30 pos:[10, 10]
 
     local PaintRdy = false
 
     on lb mouseDown s e do
     (
    	 PaintRdy = true
     )
 
     on lb mouseUp s e do
     (
    	 PaintRdy = false
     )
 
     on lb mouseMove s e do
     (
    	if PaintRdy do
    	(

export selected object as .dwg on D Drive

Can you please help me write a simple script to export a selected object as 1.dwg on drive d?
Thanks.

gwText unregister when mouse move

Hi, I want the text I draw to be hidden after mouse move/pan/rotate or over time in viewport.
Here's my code:

(
	global GW_displayText
	unregisterRedrawViewsCallback GW_displayText
	fn GW_displayText = (
		rect = (box2 13 47 96 97)
		gw.Hrect rect red
		gw.hMarker (point3 20 207 0) #smallDiamond color:yellow
		gw.hText (point3 27 200 0) ("This is not a Standard material. Actual typ1e:") color:yellow
		gw.enlargeUpdateRect #whole 
		gw.updateScreen()
	)
	registerRedrawViewsCallback GW_displayText
)
Syndicate content