Skip to content

Commit

Permalink
Feat(Revit): CNX-7577 project info custom props (#3100)
Browse files Browse the repository at this point in the history
* include custom properties

* fix formatting

---------

Co-authored-by: Connor Ivy <[email protected]>
  • Loading branch information
connorivy and Connor Ivy authored Dec 11, 2023
1 parent 7fbf8d4 commit 2d6355a
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Objects.BuiltElements.Revit;
using Speckle.Core.Models;
using System.Collections.Generic;
using DB = Autodesk.Revit.DB;
using ProjectInfo = Objects.BuiltElements.Revit.ProjectInfo;

Expand All @@ -21,6 +24,43 @@ private ProjectInfo ProjectInfoToSpeckle(DB.ProjectInfo revitInfo)
status = revitInfo.Status
};
Report.Log($"Converted ProjectInfo");

Base parameterParent = new();
GetAllRevitParamsAndIds(
parameterParent,
revitInfo,
new List<string>
{
// parameters included in the strongly typed properties
"PROJECT_ADDRESS",
"PROJECT_AUTHOR",
"PROJECT_BUILDING_NAME",
"CLIENT_NAME",
"PROJECT_ISSUE_DATE",
"PROJECT_NUMBER",
"PROJECT_ORGANIZATION_DESCRIPTION",
"PROJECT_ORGANIZATION_NAME",
"PROJECT_NUMBER",
"PROJECT_STATUS",
// parameters to be excluded entirely
"ELEM_CATEGORY_PARAM_MT",
"ELEM_CATEGORY_PARAM",
"DESIGN_OPTION_ID",
}
);

if (parameterParent["parameters"] is Base parameters)
{
Dictionary<string, object> parameterDict = parameters.GetMembers(DynamicBaseMemberType.Dynamic);
foreach (KeyValuePair<string, object> kvp in parameterDict)
{
if (kvp.Value is Parameter param && param.value is not null)
{
speckleInfo[param.name] = param.value;
}
}
}

return speckleInfo;
}
}

0 comments on commit 2d6355a

Please sign in to comment.