I’ve seen this used before, but have not gotten my hands on the formula.
Create a 3D view names after the workset that isolates that workset.
Has anyone seen this formula floating around the forums?
I’ve seen this used before, but have not gotten my hands on the formula.
Create a 3D view names after the workset that isolates that workset.
Has anyone seen this formula floating around the forums?
I haven’t seen one around here. I used to work on one for my previous employer, that happens to be Open Source. You can reuse this code:
Cheers!
Now, that’s not a Dynamo solution, but an actual Revit Addin and would require some skills with things like Visual Studio etc.
I have many skills, but coding and VB are not among them!
From what I understand, there is no simple ‘install’ button to install these tools?
Not these particular ones. You would need to download the source code and build it. Especially if you want just one particular tool, and not the whole thing.
Thanks for your help Konrad! Won’t be much help to me unfortunately, but still very appreciated!!
Break the process down, that will help you select your nodes.
Dynamo is all about figuring out the logical process behind the workflows you are wanting to achieve
Ok, if coding is not an option for you, please have a look the following workflow:
Here’s the definition:
You can get the file here: 2_ViewPerWorkset.dyn (29.6 KB)
Here’s code for the node that creates 3D Views:
# Copyright(c) 2018, 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 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)
def process_list(_func, _list):
return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)
def create_3dview(name):
views = FilteredElementCollector(doc).OfClass(View3D).ToElements()
#(Konrad) Check for existing view
view = None
for v in views:
if v.Name == name:
view = v
break
#(Konrad) If view doesn't exist just create a new one
if view == None:
vft = next((x for x in FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements() if x.ViewFamily == ViewFamily.ThreeDimensional), None)
view = View3D.CreateIsometric(doc, vft.Id)
view.Name = name
return view
try:
errorReport = None
TransactionManager.Instance.EnsureInTransaction(doc)
output = process_list(create_3dview, IN[0])
TransactionManager.Instance.TransactionTaskDone()
except:
import traceback
errorReport = traceback.format_exc()
if None == errorReport:
OUT = output
else:
OUT = errorReport
You will need an archi-lab.net package for this. Version 2019.2.8 is the latest.
Cheers!
Thanks for breaking it down, but I disagree with couple of things. There is no reason to do all of the steps. Instead of getting all of the elements in the view, and hiding them, just hide the workset. That’s much faster and reliable then chasing down individual elements.
Cheers!
Ps. Check out my solution below, for what I think is a little bit more efficient approach.
Agreed @Konrad_K_Sobon A much simpler workflow, when the new views are created and all the elements are visible anyway
Yes, although I do agree that if View already existed, and some elements were hidden manually, this workflow would not un-hide them. I don’t think it’s something that we should concern ourselves with in this case, as that was not what OP was asking about.
That Modelical package is exactly the amount of nodes my small brain can handle!!! Thanks Scott!
Additional:
For an overview of all worksets (colored) there is allways the Workset Display
Not in the API tho…as far as i know
I know about seeing all the worksets in color together with the button, but isolating them lets me see the nitty-gritty errors and do a quality control more easily
Sorry for the late reply, I finally got time to test it and the Modelical package works perfectly.
To be honest, Dynamo is easily overwhelming since I don’t get time to learn it at work, so a single node that just works is perfect for me!
Thank you for this. This solved the problem of looking for alledgedly “your” node “Hide All Worksets”
If I were to alter your phyton code to add a suffix to the name of the 3D-view, how would that be implemented?
Thanks again!
I`ll just say that this workflow is great for quality control. If I could add one thing to it, it would beto create a 3D view for all phases and give an acronym for that phase in front of the view name.
Example:
EX-Workset1
EX-Shared Grids & Levels
NEW-Workset1
NEW-Shared Grids & Levels
@sarsenaultbrassard I guess it’s really time to learn Python once and for all! so we can fix this
“so a single node that just works is perfect for me!”…
…
…“If I could add one thing”
This is why I use Dynamo, so easy to add one more thing, without needing anyone else
Not sure you need python… Though it would make it more concise!
ViewFromWorkset&Phase.dyn (29.1 KB)The Modelical works great! keep it simple and straight, save some braincell for something els haha