Where and how to start adding features to revit connector to extract Warnings data

Hi there,
First real post.
I did not really go through all the documentation as it is Large but I was wondering:
Where and how to start adding features to revit connector to extract Warnings data?

I do code a bit and would be happy to add small features to the revit connector to be able to add ‘warnings count and types’ to the revit dash or somewhere else for example

second question: smallest steps possible to add features to the revit connector. I do have quite a bit of python code around to do my QA QC of revit model and would love to add bits and pieces to the connector

cheers

1 Like

Hey @Jean-Marc_Couffin ,

Welcome and thanks for your eagerness to contribute!

I’m curious about your suggested feature, which kind of warings would you want to extract form Revt and why?

In regards to QA/QC, our Revit connector is in .NET, so not sure how easy it would be to port your code. We also have a separate project that we use to run Unit Tests in Revit, maybe your features are a better fit for that?

Hi @teocomi,
xUnitRevit is a good tool to start with I guess.

I could create new samples and start from there to get that in the revit connector extraction process.
By extracting the warnings in Revit I meant using the GetWarnings method below:
https://apidocs.co/apps/revit/2022/4774613d-600a-e1b5-b5aa-f1ee3b14394c.htm#
(clicking on the little <> sign next to the :heart: on the top right of the page gives you lots of code samples in c# and python (usually :wink: ) but you might already know that.

Warnings are a fair indicator of the quality (or lack of) of a model.

I use it as a part of a larger QA QC python workflow to get analytics out of revit data.
In the process, I grab data not only for current model but also from linked files

1 Like

Hi @Jean-Marc_Couffin, in case it helps, you could simply add the warnings to the end of the commit object in the send operation. This is happening here: speckle-sharp/ConnectorBindingsRevit.Send.cs at main · specklesystems/speckle-sharp · GitHub

So basically after that for loop (L112), you could, of the top of my head, do something like:


var warnings = CurrentDoc.Document.GetWarnings();
var processedWarnings = new List<Base>();
foreach(var failMsg in warnings) { 
  // process the warnings into simple speckle objects
  var myWarn = new Base();
  myWarn["message"] = failMsg.FailureMessage;
  myWarn["severity"] = failMsg.GetSeverity(); // seems an enum, might want to parse it into a string

  processedWarnings.Add(myWarn);  
}

// add them to the commit obj
commitObj["documentWarnings"] = processedWarnings;

Edits: minor typos :smiley:

2 Likes

Thanks @dimitrie
Exactly what I needed, pointing me in the proper direction.

I will try it as soon as I get the chance

Noticed the small typo:

commitObject["documentWarnings"] = processedWarnings;
2 Likes