View Full Version : Scripting: Get XYZ values of each point in a mesh?

05-03-2006, 11:37 PM
I'd like to grab the xyz values of each point in a mesh and output it to the script panel...

Also, is there a way to make vbscript write data to a .txt file locally?

05-04-2006, 12:07 AM
to get and print the coordinates of the points of a selected object in VBS:

set sel = Application.Selection(0)
posArray = sel.ActivePrimitive.Geometry.Points.PositionArray
Application.LogMessage posArray

to write to a txt you need to create the file and dump whatever you want into it; it's not XSI dependant but VBS dependant, and you will need the FSO (file system object).

this should be enough to get you started, next step is googling and reading the rest ;)

05-04-2006, 12:18 AM
You might be interested in this document on XML generation from within XSI.
Works nice if you want to store off some data in a teeext file.

05-04-2006, 06:11 AM
Thank you, thank you, thank you, thank you, thank you! You guys are the best :)

05-04-2006, 02:01 PM
ThE_JacO, I get this error on the third line:

'ERROR : Type mismatch: 'Application.LogMessage' - [line 3]

05-04-2006, 02:33 PM
probably logmessage not being happy with VBS' safearrays.

set sel = Application.Selection(0)
posArray = sel.ActivePrimitive.Geometry.Points.PositionArray
for i = LBound(posArray, 2) to UBound(posArray, 2)
Application.LogMessage posArray(0,i) & " " & posArray(1,i) & " " & posArray(2,i)

however, trying to figure it out yourself and learning some basic skills might help you more then me wrangling scripts for you :)

05-04-2006, 03:08 PM
Thank you again, that works good. I want to learn this. I know AS and JSFL quite well. It's more difficult to find info on VBS/XSI scripting than it is AS and Im a little frustrated. The XSI docs are good, but not quite as helpful as Flash's help menu by comparison...but I know what yer sayin :)

CGTalk Moderation
05-04-2006, 03:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.