Please help me with script

Hello!
Please help to write a simple maxscript script, or help with maxscript commands, which I need to use for it.

I have a scene (a lot of them).
There is an object in this scene named "object_name_1" (Editable Mesh, if it is important)
I need:

- Load another object from max/obj/fbx file
- Align new object to old object (pivot to pivot)
- Link new to old
- Color new object with specific color
- Make it`s visibility 0.2
- Copy new object
- Assign material to new-new-object (default material, wire, Self-illumination with specific color)

Or write commands which do all this:
- mesh import from file
- align to pivot
- link one object to another
- set color
- set visivility
- copy object
- set material properties: wire, self-illumination
- assign material to object

Thank you!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Culham's picture

Path Constraint/wire Parameters

Hi
I found a post that has the exact same question I wanted to ask, and the answer. But I don’t understand the answer?

Question?
I have a null that is path constrained and keyed at different percentages along a spline.
I want to have an another dummy that is always 10% further along the path than the first dummy. Can anyone suggest the syntax I should use in the wire parameters express window to achieve this?

I have tried a simply: percent+10, but the 2nd null remains on top of the first.
I have tired multiplication: percent*1.1 and this gives an offset, but obviously the offset grows as the percentage of the first/parent null goes from 1% to 100%. I want a consistent offset of 10 extra percentage points.

Any help would be greatly appreciated.

Answer
percent controller is from 0 to 1 based, not 0-100

delete objects
with redraw off
(
b1 = point name:"first" wirecolor:orange
b2 = point name:"next" wirecolor:green
sp = converttosplineshape (circle name:"path" radius:20 wirecolor:yellow)
c1 = b1.pos.controller = Path path:sp
c2 = b2.pos.controller = Path path:sp
paramwire.connect2way c1[#percent] c2[#percent] "percent - 0.1" "percent + 0.1"
)

Can anyone break down the answer for me so I can understand it?

Kind regards
Roger :)

fajar's picture

another suggest :use this

PS = edited

barigazy's picture

...

??? not understand you fayar

bga

barigazy's picture

...

First pick object from current scene ("object_name_1")
Twick all paremeters and then import file. Done

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "• • •"
(
	local source, nodes = #(), lastObjectIdx = 0
	pickbutton pb_node "Pick Mesh From Scene" pos:[5,5] width:150
	colorPicker cp_wire "Wirecolor:                " pos:[5,30] fieldwidth:50 color:red
	colorPicker cp_selfill "SelfIllumination:       " pos:[5,55] fieldwidth:50 color:yellow
	spinner spn_vis "Visibility:                   " pos:[5,80] fieldwidth:40 range:[0,1,.2]
	label lbl_clone "Clone:" pos:[5,100]
	radiobuttons rb_copy "" pos:[40,100] labels:#("Instance","Copy")
	label lbl_name "Clone Name:" pos:[5,120]
	edittext et_name "" pos:[65,120] fieldwidth:85 height:17 text:"NewObj"
	button btn_import "Import Object" pos:[5,140] width:150
 
	fn addVisTrack node value:spn_vis.value = (node.visibility = Bezier_Float() ; node[1].track.value = value)
	fn defMtl color:cp_selfill.color = (standard diffuse:color useSelfIllumColor:on wire:on selfIllumColor:color)
	on pb_node picked obj do if isValidNode obj do
	(
		source = obj ; pb_node.text = obj.name
	)
	on btn_import pressed do
	(
		if (file = getOpenFileName caption:"Import Model") != undefined do
		(
			lastObjectIdx = objects.count+1 ; importfile file
			if objects.count >= lastObjectIdx and isValidNode source do
			(
				name = if et_name.text == "" then "NewObj" else et_name.text
				for i = lastObjectIdx to objects.count do
				(
					node = objects[i]
					CenterObject node
					node.name = uniquename name
					node.pos = source.pos
					node.wirecolor = cp_wire.color
					addVisTrack node
					object = copy node name:(node.name + "_clone") material:(defMtl()) parent:node
					node.parent = source
					max tool zoomextents
				)
			)
		)
	)
)
createDialog bgaRoll 160 165 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.