Create / Modify Revit Scope Boxes through API

Create / Modify Revit Scope Boxes through API

jnoordzij
Advocate Advocate
2,318 Views
14 Replies
Message 1 of 15

Create / Modify Revit Scope Boxes through API

jnoordzij
Advocate
Advocate

Hi, I was searching for an API way of creating / modifying Revit scope boxes. But I did not find any results in the Revit API docs. Also on the Dynamo forum, there is this old post from 2015 saying that it is not possible through the API. Is this still the case? Isnt there any API functionality to create / duplicate / modify scope boxes? 

 

https://forum.dynamobim.com/t/creating-scope-boxes-with-dynamo-possible-or-not/1962/6

 

 

Accepted solutions (1)
2,319 Views
14 Replies
Replies (14)
Message 2 of 15

moturi.magati.george
Autodesk
Autodesk

Hi @jnoordzij,

 

This was a response from the engineering team on a similar question.

 

"Unfortunately, Scope boxes cannot be created in the API yet, but you can read data from them and they can be used to generate filters used for object selection."

 

You can have a look at this forum thread and see the suggestion if it will help you.

https://forums.autodesk.com/t5/revit-api-forum/create-scope-boxes/td-p/7050125

 

 

Whenever you require new or enhanced functionality, the Revit Idea Station is the place to go.

Please search there for a corresponding wish list entry for the suggested functionality and add your comments to it, or create a new one, if none already exists:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302


Tag it as an API wish:

https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent/label-name/api

 

Ensure it gets as many votes as possible to underline its importance to you and the rest of the developer community.

 

The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements.

 

The Revit development team look there. Your comment here in the discussion forum might be overlooked.

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 3 of 15

jnoordzij
Advocate
Advocate
Accepted solution

Thanks for the info! I found that even though scopebox creation is impossible, it is possible to duplicate another scopebox and modify its parameters like its position, lenght, width, height, name, etcetera. This way I was able to create new scope boxes from a dummy scope box, and modifying them to meet all my wishes. 

0 Likes
Message 4 of 15

moturi.magati.george
Autodesk
Autodesk

Hi @jnoordzij,

 

I am glad you found a workaround for your problem. 
Cheers

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 5 of 15

official.jaydeo
Enthusiast
Enthusiast

Can you show us how to filter scopebox and modify? also can we duplicate scope box?

 

Message 6 of 15

pieter4
Advisor
Advisor

I'm really curious how you were able to edit the width and length of an existing scope box. The selection is easy:

 

            FilteredElementCollector collector = new FilteredElementCollector(Document)
                .OfCategory(BuiltInCategory.OST_VolumeOfInterest)
                .WhereElementIsNotElementType();

 

But how to adjust the scope box dimensions? Height seems to be an exposed parameter. but length and width are not exposed?

Message 7 of 15

jnoordzij
Advocate
Advocate

I don't remember which project I used this technique for so I can't look it up. But the first that comes to my mind is to use Dynamo to select a scopebox element and query its parameters. See if there are parameters there like width, length, position and if you can modify them (or maybe its a boundary parameter, I dont remember). I think thats the way I did it. If it's possible through Dynamo it should be possible through the Revit API. 

0 Likes
Message 8 of 15

jnoordzij
Advocate
Advocate

I think I duplicated the scopebox element with a Dynamo node 

0 Likes
Message 9 of 15

pieter4
Advisor
Advisor

Duplicating scope boxes is a good workaround for not being able to create them, but I think most use cases will require to be able to edit their width and depth, not just the height.

 

Height, Position and Name are exposed in Revit 2025, but there does not seem to be a way to edit width or depth. Are you sure you were able to edit these parameters? 

Message 10 of 15

marcusss_
Contributor
Contributor

Does anyone know the answer, can we adjust scope boxes via API, or no?

0 Likes
Message 11 of 15

rcrdzmmrmnn
Advocate
Advocate

I don’t think so. Scope boxes don’t even have their own class; they belong to the Element class. They also don’t have parameters like width and length. So, unless a subclass like ScopeBox is introduced and given a property to define its boundaries using BoundingBoxXYZ, I don’t believe this will be possible.

0 Likes
Message 12 of 15

rcrdzmmrmnn
Advocate
Advocate

I've created an idea in the Revit Ideas forum. Vote and give more suggestions there please.
Create Subclass for ScopeBox with a Constructor of ScopeBox(BoundingBoxXYZ) - Autodesk Community

0 Likes
Message 13 of 15

pieter4
Advisor
Advisor

fwiw, there already is a Revit idea about editing scope boxes through the API with 99 votes: https://forums.autodesk.com/t5/revit-ideas/scope-boxes-control-visibility-amp-size-via-api/idi-p/802...

0 Likes
Message 14 of 15

rcrdzmmrmnn
Advocate
Advocate

Oh, I didn't know that, and couldn't find a way to delete the post, so I've edited it and added a link to this idea.
Thank you for pointing out @pieter4 

0 Likes
Message 15 of 15

jnoordzij
Advocate
Advocate

Was thinking back about it and maybe what I did back then was to duplicate, move, and rotate an existing scopebox element into desired new position with dynamo nodes Element,Duplicate, Element.Move and Element.Rotate. But I'm not sure. 

0 Likes