Space conversion from Revit fails if zone is not defined

Hi all,

I’ve just encountered a bug in the conversion of Spaces in the Revit connector. Issue is that conversion fails in the indicated line when a zone is not specified. This gives the well-known but unclear 'object not set to an instance of an object' error. I’m not a Revit expert, but I think it should be possible to send Spaces without a Zone, as also Revit doesn’t have issues with undefined zones. Or at least, it should give a clear error when the zone is missing.

By commenting the line, I was able to convert and send all Spaces. Receiving them (updating in this case), seems to work fine, also without the zones.


Additionally, a bit off-topic, I wasn’t able to properly debug the ConvertSpace.cs in Visual Studio as it didn’t hit my breakpoints for some reason, maybe because it’s in the shared ConverterRevitShared project and not the ConverterRevit2021 project that was being debugged (?). Anyway, if you have any clue on this, some advice would be much appreciated! :grin:

2 Likes

Hi @Rob,

Thanks for reporting this bug and looking into it to find the cause! That’s awesome. If you’re feeling bold, you could just add a null check (changing the line to speckleSpace.zoneName = revitSpace.Zone?.Name should work just fine) and make a PR.

If not that’s fine, I can get around to it.

In terms of the debug issue, that is a common one that I need to add in the readme or something. You need to debug the CONNECTOR, not the converter, for whichever version of Revit your are using or your breakpoints won’t hit. Just right-click on the connector version that you’d like to debug and set it as the startup project
image

2 Likes

Thanks for the quick response!

I checked the solution and that indeed works, easy and elegant way to fix it. I’m not so familiar with C# so didn’t know it was this simple. Also managed to get the debugging working after changing some additional settings, and debugging the connector instead of the converter :slight_smile:

I reported the issue on Github (see below) and was trying to push the solution. However, I can’t push my newly created branch and can also not create one on Github directly, so probably I don’t have permission for that?

Bug: SpaceToSpeckle conversion fails when revitSpace.Zone is not defined · Issue #1956 · specklesystems/speckle-sharp (github.com)

3 Likes

Hi Connor, @teocomi,

Believe I will need to be added as contributor to your speckle-sharp repo to make the PR. For us at least, this small fix is very valuable. Would also be easy in the future if I encounter more of these small bugs.

Or I can use a fork apparently, will have a go with that first. :sweat_smile:

1 Like

@Rob

Yeah we don’t allow anyone who isn’t employed by Speckle to push branches or commits directly to our repo for security reasons. You can definitely create a fork and submit a PR from there. Github has a guide on how to contribute to open source projects that you can follow! Git stuff can be really confusing so let me know if you have any questions and I’ll try to help

1 Like

@connor,

Okay, makes sense. I made the fork and setup a PR: Bugfix: Allow conversion of Revit Spaces without a zone to Speckle by RobClaessensRHDHV · Pull Request #1991 · specklesystems/speckle-sharp (github.com).

Does have a failing test regarding CircleCI, which is showing up in most open PRs, so don’t think that requires action from my side.

@Rob

That is perfect! The circleCI doesn’t run for PRs by external contributors so that’s nothing to worry about. I just merged it in (this is definitely the simplest PR I’ve ever merged haha). However, we aren’t planning on making another release until end of the end of the month. I’ll try to see if we can make a hotfix and release a version 2.10.4 with this change and let you know

1 Like

Haha can imagine, but a good PR for me to get familiar with the contribution guidelines :stuck_out_tongue:

A hotfix would indeed be appreciated our Speckle users!

Aaaand it’s out! Thanks again Rob!

image

1 Like