AsValueString() return encoding string

Hello, community,

I am currently working on developing a tool that prints either the project base point or the survey point.

I have retrieved information using the AsValueString() function, and I have a value that looks like this: u'0.00\xb0', which I would like to format as "0.00°".

Could you please assist me with this task?

That should get you out of it

1 Like

thank you! yes, that is actually the solution.

I found it odd that when we call a function AsValueString() we return with encoding error of this kind :frowning:
anyway, thank you for your support it is super helpful… I will create a func that modifies this bug. which will not be the most elegant but it will work :slight_smile:

Gian Claudio S.

1 Like

I did a similar thing, printing project angle with no format problem

loc = doc.ActiveProjectLocation
pos = loc.GetProjectPosition(DB.XYZ(0, 0, 0))

angle_ratio_const = 3.141592653589793 / 180 # constant converstion from rad to degrees


print("EAST-WEST..: {} M".format(pos.EastWest * 0.3048))
print("NORTH-SOUTH: {} M".format(pos.NorthSouth * 0.3048))
print("ELEVATION..: {} M".format(pos.Elevation * 0.3048))
print("ANGLE......: {}° / {}°".format(pos.Angle / angle_ratio_const, 360 - pos.Angle / angle_ratio_const))