tt-acm / DynamoForRebar

A Dynamo package for authoring geometrically complex rebar models in Revit 2016.
Other
39 stars 18 forks source link

The nodes for setting reinforcement spacing are not working in Revit 2023 #87

Open JRiad opened 2 years ago

JRiad commented 2 years ago

This is due to a change in Revit API where the way units are handled has been changed, see links:

https://help.autodesk.com/view/RVT/2022/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Introduction_Application_and_Document_ForgeTypeId_html

https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/td-p/9439210

I solved the issue by hard coding the length to mm, like below. Not sure if you want to use that solution, I'm sure there is a more general way.

    [IsVisibleInDynamoLibrary(false)]
    public static double ToRvtLength(this double length)
    {
        ForgeTypeId ftID = UnitTypeId.Millimeters;            
        return Autodesk.Revit.DB.UnitUtils.ConvertToInternalUnits(length, ftID);
    }

    [IsVisibleInDynamoLibrary(false)]
    public static double FromRvtLength(this double length)
    {
        ForgeTypeId ftID = UnitTypeId.Millimeters;           
        return Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(length, ftID);  
    }