Create Views from Groups and Isolate the Corrosponding Group in the View

@lennart030

I also manage to create a Boundigbox from a Group using this

But the issue remains. I need to isolate each group in its respective view.

If i want to Crop the Group i also need to know how to select group in its respective view.

So it is about the far right Node in the second Graph. Like this i will hide all Groups in All Views

could you explain why you want to select this group in its respective view? if you crop the view nothing else then the group is visible in the view

After i made all the Floor Plans ALL the Groups are visible in ALL Views where i need only one Group visible its respective view.
So only Group A visible in View A, only Group B visible in View B, only Group C visible in View C etc.

So for Cropping my Graph ‘needs to know’ which Group to Crop in which View (so same issue).

you could try to use the isolate element node and feed the same list of groups that you use to create the views and the crop

Well, that is where i am having issues… It hides only one Group in one View.
In all other Views all the Groups stay visible.

I hoped it was that simple :stuck_out_tongue_winking_eye: , but it isn’t.

I think (part of) the problem is the Isolate in View node. It says View and not ViewS.

But you do only want to isolate each group in only one view. Can you show us an image of the graph running with all the previews turned on?

The Group (Name) might be the same but ultimate all Groups are unique. For that reason i filtered on the Groups Element ID. I might only have 3 groups, but i can have 30 Views because the Groups are copied 10 times each. For now i put the elements ID in the View Name because we can’t have duplicate View Names (i will replace the Element ID for the appartment no. when i get the Graph to work).

This is what it looks like in Revit (when the Views are created).

image

This image is much more helpful. I think you just need to use list levels (@L1 for both inputs) to get it to work. Because Isolate in View expects a single view input and you’re supplying a list it’s getting confused. You need to use list levels to specify that each view in your list is a separate input.

I tried it like this earlier and it didn’t work (with and without Keep list structure)

image

Does it give you an error? What does it say?

It gives me nulls

image

Looks like the node is broken. Give me a minute to write something up.

You can have more the a minute :wink:.
It is weekend for me and i can’t do stuff at home atm. I’ll have another look at this monday. Thanks for your help so far.
Really appreciate it!

Here’s a potential solution, at least to the part of creating the isolated views. I don’t see a reason to crop the view if everything has been isolated, so it might just be an extra step that you can eliminate.

So I have a model with some groups in in. They are not rooms, but they are on different levels etc.

image

As you can see there are some array groups in there so i will filter these out:

Once we have that we can do what you were doing and create a floor plan from Level, then simply rename it. So far so good.

Then we can use this custom code, to isolate a group in a view. Since Groups contain multiple elements, the way the Isolate method works in the API, we actually have to isolate every member of the group so the code would like this:

# 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")
import Autodesk
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

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

try:
	errorReport = None
	
	TransactionManager.Instance.EnsureInTransaction(doc)
	for e, v in zip(IN[0], IN[1]):
		view = UnwrapElement(v)
		view.IsolateElementsTemporary(UnwrapElement(e).GetMemberIds())
		view.ConvertTemporaryHideIsolateToPermanent()
	TransactionManager.Instance.TransactionTaskDone()
except:
	import traceback
	errorReport = traceback.format_exc()	

if errorReport == None:
	OUT = IN[1]
else:
	OUT = errorReport

The lines of code to pay attention to are: view.IsolateElementsTemporary(UnwrapElement(e).GetMemberIds()) where I am isolating all of the group memebers, and then in the next line we convert the temporary isolation into a pernament one: view.ConvertTemporaryHideIsolateToPermanent(). The result is something like this:

Here’s the definition:

2_viewByGroup2.dyn (52.2 KB)

As you can see the only thing visible is the group, so I don’t think you will have to crop that view. Give it a try. It might save you a step.

Cheers!

4 Likes

@Konrad_K_Sobon

Long story, short answer; There is also a linked model from a 3rd party for the facade (which is not part of the group) that needs to be visible. Therefor i wanted to crop the group ~500mm around it (facade is like ~400mm).

I will try your dyn monday when i am back at work., but i have no doubt it will work.
Really appreciate your help!

Edit: Your Python works (as expected) :smiley: .

@Konrad_K_Sobon

So although you can hide Groups from within Revit it can’t be done with Dynamo :worried:.

Do you have any suggestion what to use to create a Bounding Box from? As i can’t use an isolated Groups ‘box’ to create a Bounding (Crop) Box from.

you can use View.SetCropboxCurves after Geometry.Explode to crop the floor plans

@ck_user
I don’t understand what you mean.

Konrad solution for Isolating the Group members works great, but now i still need to filter each Group specific to it’s View so i can use that for creating a Bounding Box ( = Crop Box).

Another approach would be creating a Curve around the Isolated Elements, but using the Box from the Group seemed a lot easier.

PS. I am only using Dynamo for a year now, so i am still learning. Maybe i bit off more than i can chew :exploding_head: .

After putting this aside for a bit i got it to work
(after learning some things from making another Graph). Big thanks to @Konrad_K_Sobon for the Isolate part.

The working Graph (as promised).


ViewByGroupFINAL.dyn (64.6 KB)

Things i wanna (will) add to this graph;

  1. Apply the correct View Template
  2. Apply the correct Scope Box to the Views (BEFORE the crop)
  3. Create the Sheets for the Views (and place the Views on the Sheets)

I struggle to find a solution for 2). This is not possible??
I searched these forums and Googled, but can’t find an solution.
So any help for 2) is much appreciated.

EDIT
Solved 2)