Results 1 to 7 of 7

Thread: View Template by Name

  1.    #1
    Moderator DaveP's Avatar
    Join Date
    January 10, 2011
    Location
    St Paul, MN
    Posts
    3,354
    Current Local Time
    05:28 PM

    Not allowed! Not allowed!

    View Template by Name

    I just got bit (again) by one of the nodes that tracks elements by their position in the list instead of by name
    This one was View Templates. I was using the View Templates node from archilab, but that node - like so many other Dynamo nodes - can't reliably return the same *value as our Revit Template evolves.
    So I had to switch to using several other nodes.
    Just wondering if there is another node out there somewhere that can return a View Template by passing the name instead of selecting from a list. This works, but I always prefer less nodes
    Click image for larger version. 

Name:	VT By Name.PNG 
Views:	20 
Size:	94.3 KB 
ID:	39175

    * If you don't know what I'm talking about, many nodes that use a drop-down selection save the default as it's position in the drop-down list. For example, Dynamo says "They want the 87th item in the list" instead of "They want the 'Walls' element type".
    The problem with this is that when a new element is added to the list, now 'Walls' is number 88 and your graph is looking for the wrong thing.

  2.    #2
    Member Exar Kun's Avatar
    Join Date
    August 2, 2011
    Posts
    223
    Current Local Time
    08:28 AM

    Not allowed! Not allowed!
    SteamNodes has a node "ApplyViewTemplate" that does exactly what you're after. The package hasn't been updated in while but that particular node is just a python script so you can grab the internals and run with it. A bonus - using that node you can apply a view template to a 3D view too.

  3.    #3
    Moderator DaveP's Avatar
    Join Date
    January 10, 2011
    Location
    St Paul, MN
    Posts
    3,354
    Current Local Time
    05:28 PM

    Not allowed! Not allowed!
    Thanks, Michael, but that's not quite what I'm looking for.
    I have Views already created and View Templates already assigned to them.
    I'm creating filters, and adding them to the existing VTs.
    I know the name of the View Template and the "View Templates" node lets me select it from a drop-down list.
    The problem is that list can change so in the future what I selected is no longer in the same position in the list.
    I have run into the same problem in the past with the "Categories" node and had to switch to the "Category.ByName" node.

    What I really need is a "Views.ByName" node.

  4.    #4
    Administrator Twiceroadsfool's Avatar
    Join Date
    December 7, 2010
    Location
    Dallas, TX
    Posts
    11,152
    Current Local Time
    05:28 PM

    Not allowed! Not allowed!
    Dude... Go buy the View Filter Manager, by Artejon. It pays for itself in ten minutes.

    Sent from my Pixel 3 XL using Tapatalk

  5.    #5
    Moderator DaveP's Avatar
    Join Date
    January 10, 2011
    Location
    St Paul, MN
    Posts
    3,354
    Current Local Time
    05:28 PM

    Not allowed! Not allowed!
    Again, not what I'm looking for.
    This is a Dynamo graph that examines the project to see what Partition Types are used
    Then it creates a filter for each Partition Type
    Then it applies those Filters to the (already existing) View Template
    I attached the graph, but it uses a custom node
    I've got similar graphs for Ceiling Types and Ceiling Heights
    Here's what those two look like
    Click image for larger version. 

Name:	Ceilngs.PNG 
Views:	12 
Size:	43.5 KB 
ID:	39177
    Attached Files Attached Files
    Last edited by DaveP; July 28th, 2020 at 09:07 PM. Reason: The Attachment didn't attach

  6.    #6
    Member Exar Kun's Avatar
    Join Date
    August 2, 2011
    Posts
    223
    Current Local Time
    08:28 AM

    1 Not allowed! Not allowed!
    Hi Dave,

    Try this (apologies it contains a lot of mess at the start as I don't really know my way around Python)

    Code:
    import clr
    clr.AddReference('ProtoGeometry')
    from Autodesk.DesignScript.Geometry import *
    # Import ToDSType(bool) extension method
    clr.AddReference("RevitNodes")
    import Revit
    clr.ImportExtensions(Revit.Elements)
    # Import geometry conversion extension methods
    clr.ImportExtensions(Revit.GeometryConversion)
    # Import DocumentManager and TransactionManager
    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager
    from System.Collections.Generic import *
    # Import RevitAPI
    clr.AddReference("RevitAPI")
    import Autodesk
    from Autodesk.Revit.DB import *
    
    doc = DocumentManager.Instance.CurrentDBDocument
    uiapp = DocumentManager.Instance.CurrentUIApplication
    app = uiapp.Application
    uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
    
    viewTempName = IN[0]
    views = []
    
    
    collector = FilteredElementCollector(doc).OfClass(View)
    for i in collector:
    	if i.Name == viewTempName:
    		views.append(i)
    
    
    OUT=views
    Click image for larger version. 

Name:	2020-07-29_09h32_05.png 
Views:	11 
Size:	33.2 KB 
ID:	39179


    That'll work on a single input name as a string and return any views in the project with the same name. Just needs a little tweak to the input and looping to make it work on a list of names.
    Last edited by Exar Kun; July 28th, 2020 at 11:31 PM.

  7.    #7
    Moderator DaveP's Avatar
    Join Date
    January 10, 2011
    Location
    St Paul, MN
    Posts
    3,354
    Current Local Time
    05:28 PM

    1 Not allowed! Not allowed!
    Thanks, Michael
    That works a treat!

Similar Threads

  1. template of view template
    By philsogood in forum Architecture and General Revit Questions
    Replies: 3
    Last Post: October 30th, 2019, 11:12 PM
  2. View Template Negates Default View Detail Level
    By evan.dodds in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: March 11th, 2016, 08:09 AM
  3. View's detail level deos not match view template setting
    By safoulkes in forum Architecture and General Revit Questions
    Replies: 7
    Last Post: June 11th, 2014, 09:41 PM
  4. 2014: *temporary* use of a view template can move your View in the browser
    By Duncan in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: December 11th, 2013, 10:12 PM
  5. Replies: 0
    Last Post: March 7th, 2013, 07:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •