Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Printing variable values at runtime

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
truckexpert
534 Views, 3 Replies

Printing variable values at runtime

How does one print several values on a single line. I want to print variable values as a table at runtime. All are floating point single precision. I want to format the output with two decimal places. This is for debugging.

 

Suppose a = 88.1234, b=99.1234.

 

At runtime, I want the listener to echo:

 

88.12  99.12

 

Thanks,

Dave

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
3 REPLIES 3
Message 2 of 4
truckexpert
in reply to: truckexpert

Also, it would be nice if there was a format string that handled column alignment, like in FORTRAN (yes, I'm old, thank you).

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
Message 3 of 4

use format (instead of print) and formattedprint (to format values):

 

format "% % % %\n" \
	(formattedprint pi format:".4f") \
	(formattedprint pi format:".3f") \
	(formattedprint pi format:".2f") \
	(formattedprint pi format:".1f")

 

see MXS help for more details.

Message 4 of 4
truckexpert
in reply to: truckexpert

Awesome, thanks!

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report