Set Level/Grid Curve by Detail Curves in View

Hi Guys,

I’m relaly newbie with Python.
I found that there is a Method in the RevitAPI for setting new curve for the level in view. (when the level representation is view specific 2d). (attached picture)
I’ve tried to use this method but I know that I’m doing something wrong. I believe it is not complicated, but I’m not experienced with python, so I’m asking for your help to make this work. Attached sample revit file and .dyn file.

It is like using scope box and aligning all level/grid heads to it. But I want to have more freedom and align the level/grid heads differently in different views. Don’t want to create multiple scope boxes.

Set Curve Level.dyn (5.1 KB)
SampleLevels.rvt (1.7 MB)

Without testing there’s a few things I notice:

  • You need to unwrap the levels and view as well
  • You misspelled the method, it’s SetCurveInView
  • This won’t cause and error, but the list NewLevels won’t return anything because the method returns Void (nothing)

New errors may arise after that, but it should get you a bit further. Good luck!

Thank you very much!
I’ve changed the script a little bit, because I realized that I’ll be using only one curve not a list with curves (for now, later I’ll use different approach may be with vertical detail lines and I’ll intersect the level to match this lines, something like that)
Also I follow your advises and Unwarp the input data. Now I need to convert the DetailLine to curve - see attached picture. I’ll try to find how to do that and hope it will work.

That’s great! You can search the Revit API for DetailLine and see if you can find a way to extract the Curve.

Thank you!

Because I’m not good with Python (YET !, It is something that I must learn)
I convert the Detail Line to Curve with one node before conecting it to the python script.
Then simply convert to Revit Type and It worked!
Here is how. (attached image)

And if someone can help me with the Python code - please let me know how to do everything with the script. Thank you!


Either of these 2 should work:

Great, thank you! I’ll develop this script - for now I only wanted to know if it will work with this method.
Now I know that it is working and will create the real script and share it here.
Have a great day! Cheers!

1 Like

I’m stuck again and I’ll use the same topic to bring my problem to the public.
I’m extracting the curve representing the level in the active view. I want to intersect this curve with two detail lines that I have drawn in the view. Then use the two points from the intersection to create new curve and set the new curve to the level. Setting curve to level was discussed above and it is working - it is not the issue.
The issue is that I can’t intersect the curves from the levels with the detail lines.
How to use properly Geometry.IntersectAll method ???
And also which method I should use to create the new line from points - maybe this one - http://www.revitapidocs.com/2017/7885bdf9-3007-ea60-af6b-a96ac7672c18.htm ???
See attached dyn, rvt files and screenshots.



Set Curve Level.dyn (7.2 KB)
SampleLevels.rvt (1.7 MB)

I have progress but it is not using Python.
I’ve managed to achieve everything with the help of few nodes. I would like to include everything in python.
Here is what I’ve done.
Hope someone can help me with doing all this only with Python.


Set Curve Level.dyn (13.0 KB)
SampleLevels.rvt (1.7 MB)

And a gif of how it works