willhl / BuildingGraph-Client-Revit

Neo4j and Building Graph (GraphQL) integrations with Autodesk Revit and Dynamo
MIT License
25 stars 13 forks source link

Greetings, seasons! After a long hiatus, Attempting to get the revit export working with revit2022 - running into a few issues with compilatilon... #3

Closed mimomenome closed 2 years ago

mimomenome commented 2 years ago

After updating references (which I think worked) - getting the following which appears to be due to a breaking change in the way revit handles units...

line 165 _revitPerameter.DisplayUnitType

Severity Code Description Project File Line Suppression State Error CS1061 'Parameter' does not contain a definition for 'DisplayUnitType' and no accessible extension method 'DisplayUnitType' accepting a first argument of type 'Parameter' could be found (are you missing a using directive or an assembly reference?) BuildingGraph.Integration.Revit D:\Development\metagraph\BuildingGraph-Client-Revit\BuildingGraph.Integration.Revit\Parameters\HLRevitParameter.cs 165 Active

Severity Code Description Project File Line Suppression State Error CS0117 'DisplayUnitType' does not contain a definition for 'DUT_PERCENTAGE' BuildingGraph.Integration.Revit D:\Development\metagraph\BuildingGraph-Client-Revit\BuildingGraph.Integration.Revit\Parameters\HLRevitParameter.cs 165 Active

Cheers! M.

mimomenome commented 2 years ago

Maybe this?

                    if (wasParsed && _revitPerameter.GetUnitTypeId() == UnitTypeId.Percentage && dval > 1)
                    { 
                        dval = dval / 100;
                        _revitPerameter.Set(dval);
                        wasSet = true;
                    }
                    else if (wasParsed)
                    {
                        _revitPerameter.Set(dval);
                        wasSet = true;
                    }
willhl commented 2 years ago

Yeah there was a significant change with the units API in Revit 2021/22, it looks like you're on the right track, I have a library which abstracts the units API (currently in a private repo) to support all versions of Revit, I'll look at getting it ported over to this one :)

mimomenome commented 2 years ago

Is resolved in latest! Thanks!!!