Help with setting Grid & Level extends through Python

Hey everone,

On the forums I found some python code node for setting Datums and cropping them by Cropview.
(Set Grid Extents and Bubbles - #32 by RevitRobot)
I don’t know any Python and I was wondering if someone could help me rewrite the code so it cuts by a list of Curves rather than the Cropview. This is because the Grid bubbles need to be just inside the Cropview, but I also want to use the node to set Levels and Grids to the left and bottom of the drawing:


933×776 53.9 KB

So for elevations and sections, the left and bottom.

For vertical details: cropped within the cropbox, and the bubble side an extra 7mm

Same with horizontal details (so mini floorplans basically) but those usually have grid bubbles also on the sides, not just the bottom

Is it possible someone here can help me rewrite the code for this so I can feed the node a list of curves? I can then preset the curve calculation rather than setting the crop view to those curves, using the current node and resetting the Crop View back. (Which is also very error sensitive)

There is plenty enough you can find on these forums for the Grid Bubbles other then the topic you found the Python code in.

https://forum.dynamobim.com/search?q=Grid%20extents

Unfortunately setting the extents of Levels still is not possible (afaik).

I’m aware, in the listed forum link I can actually set all levels and grids to the cropbox. (As long as the grids are intersecting the cropbox). The node even has a built in offset, so I can set it to -7.

However this offsets the entire cropbox. Not merely the sides with grid bubbles

So I made a script that sets Cropboxes, then use the Python Node, then resetting the Cropbox. This works but is error sensitive and needs a double transaction. Not ideal and not clean.

This is why I want help with the Python code that sets all intersecting Datums (yes even levels) to the provided Curves. I tried ChatGPT but it only gives me errors

However this offsets the entire cropbox. Not merely the sides with grid bubbles

I think i use also they Python in one of those topic but it leaves the Crop Box untouched.
In other words; It doesn’t offset the Crop Box

(yes even levels)

If you would manage that then you would make many of us (me included) very happy.

Can’t help you with any Python because unfortunately i don’t know Python yet.

So the question still stands

Hi @RevitRobot

are you tried with a negative offset at input ? Could this suit you?

grids extend

I used this code

Yes, I don’t think you guys are reading my question correctly.

I need all grids and levels cropped to the cropbox. EXCEPT for the ones that have a bubble, I need an EXTRA offset for those.

This python script only lets me set all the grids to the cropbox in the same way. So I need to feed it a list of curves rather than the cropbox.

your request is not simple, that’s why I asked if this compromise could satisfy you