[Closed] Exporting vertex position to txt file
my problem is im not getting enough decimal places passed through. Please Help!!
(
selA = $ –Select Spline
vertA = getKnotPoint selA 1 1
s = vertA.x as float
Lat = s as string
VFile = createfile (Dest + selA.name + “.xyz”)
format (Lat + “,”) to:VFile
)
Results:
actual x position = 434.522095
s = 434.522
Lat = “434.522”
I’ve had this problem before. A Float value in Maxscript can only store decimal places to a certain amount before it clips them off. You will need to format the value straight to the file instead of assigning it to a variable first. Assigning it to a variable stores the float in memory, thus clipping off important information if the number is too precise. If directly accessed and directly formatted, you should get the right value:
So,
format "%
" (getKnotPoint selA 1 1).x to:VFile
why are you converting to float then string?? that is where you are losing precision.
try this:
_x = vertA.x as string
_y = vertA.y as string
_z = vertA.z as string
VFile = createfile (Dest + selA.name + ".xyz")
format ("%,%,%
") _x _y _z to:VFile