I am working on a task where I need to update some parameters in a loop for a pipe fitting model
but the issue is that I am getting the below UI when I commit the transaction.
The weird part is that,
- I am adding parameters in a loop, and only one of 10 fails.
- Also, the same row that failed programmatically works when I try with it in the Revit UI manually.
Since the code only fails for 1 row, I am clear that the code is correct.
using (Transaction tr = new Transaction(famDoc))
{
tr.Start("add data");
DN = "400";
if (!String.IsNullOrWhiteSpace(DN))
{
double dn = Convert.ToDouble(DN);
dn = UnitUtils.ConvertToInternalUnits(dn, DisplayUnitType.DUT_MILLIMETERS);
Parameters.SetParameterFamily(famManager, famDoc, "GEOMETRY", ParameterType.Length, false, "DN", dn);
}
tr.Commit();
}
Also, I came across this link
[https://knowledge.autodesk.com/support/revit/troubleshooting/caas/sfdcarticles/sfdcarticles/Revit-error-Line-is-too-short.html][2]
But I did not understand the solution in my context. Can someone help me with the solution
These are the values of the loop
I also added the result of the UnitUtils.ConvertToInternalUnits(dn, DisplayUnitType.DUT_MILLIMETERS)
- DN = 300 // 0.98425, DN_AB = 100 // 0.3250
- DN = 300 // 0.98425, DN_AB = 150 // 0.4921
- DN = 300 // 0.98425, DN_AB = 200 // 0.6561
- DN = 300 // 0.98425, DN_AB = 250 // 0.82020
- DN = 300 // 0.98425, DN_AB = 300 // 0.98425
- DN = 350 // 1.14829, DN_AB = 350 // 1.14829 // This fails
Thank you in advance