Horizontal/vertical view break

archi-lab
#1

I had just a quick question is’t possible to control the horizontal/vertical view break in views?

I couldn’t find any further information about this topic on the forum.

0 Likes

#2

Does someone has an answer to this?

0 Likes

#3

I had a look, I can’t find anything in the API which looked promising… Sorry… Perhaps you can see something I missed?

Viewport
http://www.revitapidocs.com/2018/7744ebd3-e87e-5a60-e5b3-fc97fb2569af.htm

View
http://www.revitapidocs.com/2018/2d37a7c0-7734-3b5b-9f80-c18d38e82ea8.htm

Section
http://www.revitapidocs.com/2018/c471aff8-99ab-c86e-60df-8d0fa7f13a9e.htm

0 Likes

#4

Yeah I looked in the RevitAPI to but couldn´t find anything sadly.

For the viewbreak I have a temporary solution by creating two sections to simulate the break line. It´s for now not the best solution but it is a solution for now…

1 Like

#5

I am assuming you are asking if its possible to create the view crop region splits:

Now, that functionality is indeed available in Dynamo via the ViewCropRegionShapeManager https://apidocs.co/apps/revit/2017/d815093f-0331-76c9-7607-67e62f9f2c9b.htm

Now you can split a view crop region vertically like so:

Here’s the Python code:

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)


def process_list(_func, _list):
    return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)

def to_list(x):
    if hasattr(x, '__iter__'):
        return x
    else:
        return [x]

def split_view(view):
	v = UnwrapElement(view)
	sm = v.GetCropRegionShapeManager()
	sm.SplitRegionVertically(0, 0.49, 0.51)
	return v

if IN[1]:
	try:
	    errorReport = None
	    
	    TransactionManager.Instance.EnsureInTransaction(doc)
	    output = process_list(split_view, to_list(IN[0]))
	    TransactionManager.Instance.TransactionTaskDone()
	except:
	    import traceback
	    errorReport = traceback.format_exc()
else:
	output = "Set RunIt to True!"

if None == errorReport:
    OUT = output
else:
    OUT = errorReport

The line of code that splits the region is the following: sm.SplitRegionVertically(0, 0.49, 0.51) Just as an explanation the three arguments are:

  • Region index. Each region is stored in a list. Since you can have more than one region (splitting the region once results in two regions) you need to tell it which one to split. Lists are zero indexed so first item in that list is 0.
  • Top and Bottom proportions. Proportions are set using numbers from 0-1, but make sure that they add up to 1. In my case I am using 0.49 and 0.51. That’s roughly splitting the region in half, and keeping the two halves equal. Just like in the UI, you cannot split it exactly in half, and keep the halves next to each other, because that would result in regions having one common edge overlapping. Just like in UI, doing 0.5, 0.5 will result in an error. That’s why I did uneven halves.

Now, this is just a basic split method. There are a lot more functionality involved. You can find all that here: https://apidocs.co/apps/revit/2017/d815093f-0331-76c9-7607-67e62f9f2c9b.htm

3 Likes

#6

Thanks this was exactly what I was looking!!

I see that in the RevitAPI a lot more possibilities to expend this function I’m going to look more into but thanks again this helps a lot!

0 Likes

#7

Just a little follow up question. I’m not so good yet with the RevitAPI and Python (just started with learning it). But is it als possible to move the splittend crop view?

0 Likes

#8

Hey,

Assuming I understand you correctly… Yes… The placement of the crop is dependent on this line…

sm.SplitRegionVertically(0, 0.49, 0.51)

As a following of that line of thought you can then change it to

sm.SplitRegionVertically(IN[2], IN[3], IN[4])

and add some inputs…

I haven’t gone on to see how that works with lists of input points…

Hope that’s useful,

Mark

1 Like

#9

Mark,

This I already made it work the problem at the moment is more that I create this break but I want to control the white space between it see picture. In Revit you can control this with the blue arrows. But at the moment I can’t control this with the RevitApi module used to split the view in the script from @Konrad_K_Sobon.

0 Likes

#10

Hey, sorry if I wasn’t clear… if you change those numbers, doesn’t that zone change? :slight_smile:

0 Likes

#11

Yeah I know that how to change the zone. But I want to control the white space between the splitted views that are created. I want the views closer if I show 1 m of a top and bottom of a element. Now you just get a large white space between the separated views.

0 Likes

#12

Oh interesting, moving these grab handles?

1 Like

#13

Yes sorry for the poor explanation…:sweat_smile:

0 Likes