ScriptSpot

Forum topic · Scripts Wanted

Print/Format selected Obj's

By JokerMartini · 2011-03-05

Description

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 (5)

SOLVED

3dwannab · 2015-08-14

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

NOW: How to get the result to a messgebox

3dwannab · 2015-08-14

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 · 2011-03-06

just add line break "\n" at the end:

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

Thanks Swordslayer

JokerMartini · 2011-03-05

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.

Swordslayer · 2011-03-05

If I understand it right, this could do it:

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