HELP: Dynamo to fix the small digits number of area separator distance to grids

Hi, I has used the dynamo to generate area separation line from CAD. But the problem is our company required super high precision of line (up to 7 number after 0).
Any idea to solve this issue

So your company requires CAD / BIM accuracy to less than a nanometre? (I’ve heard of micromanagement but…)

I would note that is possible that binary floating point arithmetic would likely create these errors and it is also possible that the original CAD has these measurements. The internal Revit coordinate system is in decimal feet so conversion to millimetres will introduce rounding errors

Line created in user interface
image

Revit will let you round to the nearest femtometre (1 x 10 ⁻¹⁵) if you really want to however in practical terms accuracy to 1 mm (1/32") is standard for construction with varying tolerances depending on finish. I think, in this case, it is beyond the tolerance of Dynamo’s accuracy

Line placed by Dynamo
image

1 Like

Yeah…I also think that 7 number after 0 is over-required for a model precision.
Revit default setting recommend to make it maximum 3 number after 0.
However, if trying to do that by dynamo I think it still possible since some node still work with 1 x 10 ⁻¹⁵ value and can use math.round something to rewrite the lines.
Thank you for your insight

I did some more testing using the Python decimal library using the standard 28 decimal accuracy - even if you achieve seven decimals in one axis you don’t achieve it in the other axis.
There are always going to be points in the process of creating and dimensioning elements where truncations and floating point rounding errors will affect the result, even more so if you have a rotated north on the project.

Line placed with Revit API using Python decimal library to calculate location
image

Code

from decimal import *

import clr

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

mm_to_feet = Decimal("304.799981495")  # Exact standard is 304.8

x = Decimal("-4200") / mm_to_feet
y1 = Decimal("-2350") / mm_to_feet
y2 = Decimal("-6750") / mm_to_feet

p1 = XYZ(x, y1, 0)
p2 = XYZ(x, y2, 0)
line = Line.CreateBound(p1, p2)

TransactionManager.Instance.EnsureInTransaction(doc)
OUT = doc.Create.NewDetailCurve(doc.ActiveView, line)
TransactionManager.Instance.TransactionTaskDone()
2 Likes

I think your idea is exactly the solution I am looking for.
To manage the line length, and distance to grid I think just only manage the distance to grid is ok.
since I have to manually fix every single small digit distance it actually help a lot.
When the distance is precise, only need to join the lines (horizontal and vertical lines) will make the length become nice number.
(I had a dynamo routine to automatic take dimension for every line, so can figure out the ones with small digit number and fix it manually by join lines).