Creation.Document.NewSpace(Level, UV)

Hi community!

I’m trying to use the Creation.Document.NewSpace(Level, UV) method to create a mechanical space based on the Room element. Though I feed in the Level and a UV point to the method, it tells me a Document is required. I did not find any Space create method requires a Document instance. How to make it work? Thanks in advance.

    doc = DocumentManager.Instance.CurrentDBDocument
    room = UnwrapElement(IN[0])
    theUV = UV(room.Location.Point.X, room.Location.Point.Y)

    TransactionManager.Instance.EnsureInTransaction(doc)

    space = Document.NewSpace(room.Level, theUV)

    TransactionManager.Instance.TransactionTaskDone()
    OUT = space

SpaceFromRoom.dyn (4.0 KB)
Project1.rvt (3.0 MB)

Hi @jshial,

Try this :

doc = DocumentManager.Instance.CurrentDBDocument
room = UnwrapElement(IN[0])
theUV = UV(room.Location.Point.X, room.Location.Point.Y)

TransactionManager.Instance.EnsureInTransaction(doc)

space = doc.Create.NewSpace(room.Level, theUV)

TransactionManager.Instance.TransactionTaskDone()
OUT = space 

space

2 Likes

Thx! @Alban_de_Chasteigner Helpful as always.