1

I'm having trouble creating a footprint roof using revit 2018 API. Basically, I'm calling this:

doc.Create.NewFootPrintRoof(ca, doc.GetElement(roofsInstances[0].LevelId), roofsInstances[0].RoofType)

And:

  • "ca" is a valid Autodesk.Revit.DB.CurveArray object. It's a closed loop.
  • "doc.GetElement(roofsInstances[0].LevelId)" is a valid Autodesk.Revit.DB.Level object
  • And "roofsInstances[0].RoofType" is a valid Autodesk.Revit.DB.RoofType object

When I call it, it returns: Exception: Value cannot be null.

Any idea on what could be the issue? Thanks a lot!

Arnaud
  • 445
  • 4
  • 18
  • Hey Arnaud, looks like one of the args isnt correct - could you post more code to show us how you built each arg? – Callum Oct 24 '17 at 20:04
  • Dear Callum, as I was trying to provide you with a reproducible example, I found out the solution :) I'll post it below! Thanks! – Arnaud Oct 26 '17 at 07:13

1 Answers1

1

So, I found out what was wrong. First, this method needs a 4th argument, a "out attribute" (sorry, I had never seen that before..) which needs to be a ModelCurveArray. The problem was that even when I gave a ModelCurveArray object as the 4th argument, it was then complaining that it expected a StrongBox[ModelCurveArray]. Never heard of that either.

Anyway, I used this as the 4th argument:

footPrintToModelCurveMapping = clr.StrongBox[ModelCurveArray](ModelCurveArray())

And it works.

Arnaud
  • 445
  • 4
  • 18