Jump to content

  • Log In with Google      Sign In   
  • Create Account

Question on this maxscript

  • You cannot reply to this topic
No replies to this topic

#1 lucky6969b   Members   -  Reputation: 528


Posted Yesterday, 04:23 PM

try(destroydialog orderPoints) catch()
rollout orderPoints "Order Points" width:200
	fn sortByPosComponent v1 v2 order:#(1,2,3) dir:1 = 
		act = if v1.pos[order[1]] < v2.pos[order[1]] then -1 else if v1.pos[order[1]] > v2.pos[order[1]] then 1 else 
			if order[2] != undefined then sortByPosComponent v1 v2 order:(deleteitem order 1) else 0
	label lb "Order:" align:#right offset:[-20,4] across:3
	dropdownlist order_dd items:#("xyz", "xzy", "yzx", "yxz", "zxy", "zyx") width:44 align:#left offset:[-16,0] tooltip:"Sorting Order"
	checkbox reverse_ch "Reverse" width:90 align:#left offset:[-14,3] tooltip:"Use Reverse Order"
	edittext base_ed text:"Pallete" width:194 align:#left offset:[-12,2] tooltip:"Point Base Name"
	button rename_bt "Rename Points" width:190 align:#left offset:[-8,2] tooltip:"Rename Selected Points\n + Control\t- All Points"
	fn makeOrder = for k=1 to 3 collect (bit.charasint order_dd.selected[k] - 119)

	on rename_bt pressed do undo "Rename Points" on 
		nodes = if keyboard.controlpressed then selection else helpers
		pp = for p in nodes where iskindof p Point collect p
		if pp.count > 0 do
			dir = if reverse_ch.state then -1 else 1
			qsort pp sortByPosComponent order:(makeOrder()) dir:dir
			id = 0
			d = orange/pp.count
			for p in pp do 
				c = orange - id*d
				p.name = base_ed.text + (formattedprint (id += 1) format:"05d")
				p.wirecolor = c
createdialog orderPoints

Pallet01 Pallet02 Pallet03 Pallet077...

The output is incorrect. There are 3 three objects in the first row that are named correctly.

The next several items are named incorrectly.

Any help?

Thanks Jack

Edited by lucky6969b, Yesterday, 04:32 PM.