Subscribe to this thread
Home - General / All posts - Round vertex coordinates
sgaiji38 post(s)
#12-Aug-16 01:08

Hi all,

I need to round up all the coordinates of all the objects of a layer according to a simple criterion: every number is rounded to 2 decimal places.

In summary, for all objects, each vertex is modified so that its coordinates have only two decimal places.

I'm sure the solution is simple but I'm a little sick these days and my brain is too slow.

Thank you in advance.

Stephane

tjhb
10,094 post(s)
#12-Aug-16 03:11

The fastest and easiest way to do this is to open your drawing (in its own window, not a map window), then use the Drawing > Orthogonalize command.

Choose for your example: Scope All objects, Steps 0.01, 0.01, Offsets 0, 0, and for the units the native units of your drawing.

(For safety do this on a duplicate of the drawing first.)

There are two caveats.

(1) In your first paragraph you said "I need to round up all the coordinates...". Orthogonalize rounds up or down, to the nearest allowed value (with midpoints rounded up).

(2) Orthogonalize also removes any vertices that, after rounding, are redundant, i.e. which do not affect the shape of the object, lying on a straight line between neighbouring vertices.

If one of those things is not OK then you may need custom SQL.

sgaiji38 post(s)
#12-Aug-16 06:16

Thanks a lot !

tonyw
736 post(s)
#13-Aug-16 17:06

sgaiji,

Do you mean the display of the coordinates rounded to two decimal places? Or to adjust the location of the vertices by deleting all but two decimal places? Reducing precision will have the effect of nudging vertices slightly south and slightly east (at least in the coordinate systems I'm familiar with). Is that the desired outcome? I'm not in front of Manifold now to test but you can keep the precision in location of your vertices but display only two decimal places with formatting (decimal format, 2 decimal places).

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.