Print/Format selected Obj's

With the code below I get his result.

"name:Point01 pos:[5,5,5] rot:(quat 0 0 0 1) wirecolor:red"

but I want this to be the result.

name:"Point01" pos:[5,5,5] rot:(quat 0 0 0 1) wirecolor:red

The scene setup is just having a selection of a point helper/s and the run the code.

Thanks
JokerMartini

clearListener()
for obj in helpers do
(
	PtName = obj.name as string
	PtPos = obj.pos as string
	PtRot = obj.rotation as string
 
	print ("name:" + PtName + " pos:" + PtRot + " rot:" + PtRot + " wirecolor:red")
)

Comments

Comment viewing options

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

SOLVED

clearListener()
theSceneMats = #("Material 1", "Material 2", "Material 3", "Material 4")
 
mb = "" ; for m in theSceneMats do mb  = mb + "     ' " + m + " '\n" 
messagebox (">>> Something interesting goes here <<<:\n\n" + (mb as string) + "\nthee end.") title:"(◣_◢)" beep:true

NOTE: mb needs to be classed as a string in order to work

3dwannab's picture

NOW: How to get the result to a messgebox

Thanks for the starting point guys but I was wondering how to get this result to a messagebox instead. Similar topic so I thought I'd shout out here.

clearListener()
theSceneMats = #("Material #47", "Material #45", "Material #46", "Material #457")
 
for i= 1 to theSceneMats.count do (
	mb = format "\t' % '\n" theSceneMats[i]
)
messagebox (mb as string)

the for loop results in the listener as:

	' Material #47 '
	' Material #45 '
	' Material #46 '
	' Material #457 '
OK

Also if it can work then how to go about removing the OK.

It's maybe not possible this way as the messagebox comes up as undefined. Any help is greatly appreciated.

Anubis's picture

just add line break "\n" at

just add line break "\n" at the end:
format "name:\"%\" pos:% rot:% wirecolor:red\n" obj.name obj.pos obj.rotation

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Thanks Swordslayer

When i run the script on multiple objects it is formatting them all onto one line in the listener. I'll need it to print each obj separately onto a different line.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Swordslayer's picture

If I understand it right,

If I understand it right, this could do it:

format "name:\"%\" pos:% rot:% wirecolor:red" obj.name obj.pos obj.rotation

Comment viewing options

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