As topic stated, the uploaded commit only has BIM document info, while it doesn’t contain any of element. It seems my way to use “ConvertToSpeckle” doesn’t include element properly. I keen to understand how to properly use ConvertToSpeckle(Element). Thanks!
I’m less familiar with our logic nowadays, @Jedd or @connor should be able to provide you with more info. But essentially, you can have a look at what our connector does here:
The commitObject is expanded to include additional objects beyond the document itself.
You probably don’t need a to use the full commitObjectBuilder.BuildCommitObject but as long as you convert each element that you want to send using converter.ConvertToSpeckle and include it inside a Base object, you should be able to then see them online.
Thanks, @teocomi , @Jedd , and @connor. My core issue is how I can put a Revit element into “ConvertToSpeckle” as a Base so that send a commit object to Speckle. I still cannot get how “ConvertToSpeckle” works for Revit element convert. Appreciate.
Albert
Can you debug and find which object is null?
Maybe it’s the element variable, can you paste a screenshot from VS while you’re inspecting it during debugging?
var kit = KitManager.GetDefaultKit();
var converter = kit.LoadConverter(Objects.Converter.Revit.ConverterRevit.RevitAppName);
converter.ConvertToSpeckle(element);
It seems the issue is due to the “converter” object
@archilles0203, let’s take a moment to look closely at how our RevitConnector/RevitConverter works. Understanding this will help us solve the problem you’re facing.
For our converter to do its job correctly, it needs a bit of preparation. This involves a specific way of starting it up, which is essential for avoiding the errors you’ve encountered. Our Connector/Converter code explains the process of preparing the converter with SetContextDocument, using different pieces of information it needs to start. It’s a crucial step to make sure everything runs smoothly.
You can see the steps for this setup in detail here:
In particular, initialising the doc object will be relevant to your goal. With that in mind, if the specific readiness is not set in any of these contexts, then this explains why we are seeing NULL as a response.
While we are always looking for ways to improve, the approach outlined here is what we recommend for now. Following these instructions closely will help you progress and ensure your work with Speckle and Revit goes as planned.
We’d love to know what you are actually trying to build that isn’t possible with the existing connector.