specklesystems / speckle-sharp

.NET SDK, Schema and Connectors: Revit, Rhino, Grasshopper, Dynamo, ETABS, AutoCAD, Civil3D & more.
https://speckle.systems
Apache License 2.0
354 stars 166 forks source link

Feature [Revit]: Excel parameter updater support for shared type parameters #3500

Closed efdiloreto closed 3 days ago

efdiloreto commented 1 month ago

Description & motivation

I opened a thread in the community some days ago because I couldn't update some parameters in the Revit schedules using the Excel Connector. Here is the original post:

https://speckle.community/t/revit-excel-parameter-updater-graying-out-custom-parameters-in-excel/11613

The problem was that Revit considers shared parameters as ScheduleField.Instance instead of ScheduleField.ElementType. Therefore, if the parameter was a "Type Parameter" and was obtained from the element, it would always be considered as "ReadOnly."

The solution was to obtain the parameter from the "Type" rather than from the element. Because of this, I added some logic in the code to handle Shared Parameters.

Reference: https://www.revitapidocs.com/2024/9888db7d-00d0-4fd7-a1a9-cdd1fb5fce16.htm

Changes:

ConvertView.Schedule -> AddColumnMetadataToDataTable

Screenshots:

Using the sample Architecture Project add a shared type parameter to the planting category: image

Add the type and the shared parameters to the existing schedule and sort by type (not itemize every instance) image

Then:

  1. Send to Speckle
  2. Receive from Excel
  3. Edit in Excel
  4. Send To Speckle
  5. Receive in Revit

Checklist:

AlanRynne commented 1 month ago

Hi @efdiloreto!

Thanks for this! We'll try to get someone to review this as soon as possible.

Meanwhile, I see the CI is failing because you're not following our formatting rules (which we recently started enforcing)

You can ensure the code is fully formatted by running:

dotnet tool install in the root of the repository and then dotnet csharpier ./

The rest of the repo is already compliant so you should only see your changes be formatted.

Let us know if you have any further issues getting this done :)

efdiloreto commented 1 month ago

Thanks Alan, will try to format it ASAP

efdiloreto commented 1 month ago

@AlanRynne I think is passing the formatting test, but not sure why is failing now.

connorivy commented 6 days ago

I made the discussed change and created a new PR https://github.com/specklesystems/speckle-sharp/pull/3585. If that one gets merged then we can close this.