 # Convert point coordinates to accurate number as string

Hello,

I was wondering if it is possible to convert a point which is made of double values for X,Y,Z coordinates into same thing, but made of string with accurate number without rounding, as string.

for example Dynamo would tell me that this number 321.0000000345 is 321 if it is a double, but it is not correct, then I choose to convert to string with the value that the number it really is.

I used this python to do the translation from double to string but it needs rework after that to present it as the definition of a point: example of the output desired:

Point(X = 0.0, Y = 3.0, Z = 321.0000000345).

but what revit told me it is: Point(X = 0, Y = 3, Z = 321) or Point(X = 0.000, Y = 3.000, Z = 321.000)

not sure if this can be done in a single python node, input as a list of points and output the same but a point built of strings with the real decimals.

``````import clr

def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]

def output1(l1):
if len(l1) == 1: return l1
else: return l1

num1 = tolist(IN)
out1 = []
for i in xrange(len(num1)):
s1 = str(num1[i])
if s1[-2:] == ".0": out1.append(s1[:-2])
else: out1.append(s1)

OUT = output1(out1)
``````

I think this can do the job. It’s a node in archilab package.

or take the python code inside as follwoing

``````clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variable.

strings = IN
numbers = IN
result = []
if len(numbers) != 1:
for i, j in zip(strings, numbers):
x = int(j)
if IN == 1:
result.append(i[x:])
else:
y = int(len(i) - x)
result.append(i[:y])
else:
for i in strings:
if isinstance(numbers, basestring):
x = int(numbers)
else:
x = numbers
if IN == 1:
result.append(i[x:])
else:
y = int(len(i)-x)
result.append(i[:y])
#Assign your output to the OUT variable
OUT = result

``````