1

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.

enter image description here

The weird part is that,

  1. I am adding parameters in a loop, and only one of 10 fails.
  2. 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)
  1. DN = 300 // 0.98425, DN_AB = 100 // 0.3250
  2. DN = 300 // 0.98425, DN_AB = 150 // 0.4921
  3. DN = 300 // 0.98425, DN_AB = 200 // 0.6561
  4. DN = 300 // 0.98425, DN_AB = 250 // 0.82020
  5. DN = 300 // 0.98425, DN_AB = 300 // 0.98425
  6. DN = 350 // 1.14829, DN_AB = 350 // 1.14829 // This fails

Thank you in advance

JPais
  • 115
  • 2
  • 14

0 Answers0