Family Parameter Values (double)

Family Parameter Values (double)

stephen_harrison
Advocate Advocate
262 Views
2 Replies
Message 1 of 3

Family Parameter Values (double)

stephen_harrison
Advocate
Advocate

I hope someone can help, I’m using Revit 2026 and c#.

My issue is I’m collecting Family parameter values and copying it into other new Family shared parameter. The data is collected using code derived from

The Building Coder: Family Parameter Value

(Thank you Jeremy)

Everything appears to work perfectly except for double values. I believe the issue relates to the fact that Revit stores data in imperial and I’m currently working in metric.

 

The Method I’m using to add the values to my Family Shared Parameter is

 

else if (familyParam.StorageType == StorageType.Double)
{
    if (Double.TryParse(familyParameterData.Value!, out double doubleValue))
    {
        mgr.Set(familyParam, doubleValue);
    }
}

When I compare the new values to the original some are correct some have fractions of millimetres to much or to little.

I hope someone has a solution for me.

Thank you in advance for your assistance.

0 Likes
Accepted solutions (1)
263 Views
2 Replies
Replies (2)
Message 2 of 3

TripleM-Dev.net
Advisor
Advisor
Accepted solution

Are you converting the Doubles before using (for showing to user or so),

try to use the original Double value and don't apply any ronding on it, that way the values stay thesame. If a convertion is needed always keep the original also.

 

Otherwise some small value difference can occur but those are indeed fraction of mm.

Message 3 of 3

stephen_harrison
Advocate
Advocate

Thank you for your quick response.

In stead of converting the values to strings i have used the original values and as you suggested and this has resolved my problem.

Unsure why converting value to string should introduce a rounding issue, but at lease my problem is resolved.

0 Likes