Results 1 to 6 of 6
Like Tree4Likes
  • 1 Post By irneb
  • 1 Post By irneb
  • 2 Post By cellophane

Thread: Assign RVT links to worksets

  1. #1
    Member
    Join Date
    May 18, 2011
    Location
    Calgary, AB
    Posts
    356
    Current Local Time
    09:05 AM

    Assign RVT links to worksets

    I'm just dipping my toe into the Dynamo water. I've tried in the past... brain just doesn't want to think like that - I'll get there eventually.

    So my first taste was with Create Worksets. I didn't create, just copied a .dyn to run. I think would work well at the initial project setup, but probably wouldn't use it much after that unless it was a large project split up with multiple links.

    I then started thinking about RVT links. Can Dynamo read an excel file and find a particular rvt link and put it on the correct workset? I'm thinking one column would be the links and the second column would be the workset to be placed. Of course Dynamo would have to pick up both the instance and type workset that a link could be placed on.

  2.    #2
    Member irneb's Avatar
    Join Date
    April 25, 2013
    Location
    Jo'burg SA
    Posts
    350
    Current Local Time
    06:05 PM
    Just going through some unanswered questions, sorry to zombie this post. But in case people have similar needs:

    Dynamo doesn't directly have some tile able to inspect / set a workset this way. However, a workset is just a parameter value of any one element. Dynamo does include tiles like SetParameterByName through which you can change any element's workset (as long as it's not readonly - like when it's inside a group).

    The trick is the value given is just a number, not the workset's name. And to obtain that number you need to find out what it is. Either manually by setting something to the target workset, or through the RevitAPI by iterating over all worksets and finding the Id value of the one matching the name you're after. Unfortunately Dynamo doesn't include a tile which can search for a workset Id like that. Instead it provides tools like Python do "add" such custom abilities.

    Here's a sample of how to set all revit links, as well as their type definitions to a specific workset (by name).

    Note I've used default tiles as much as possible. The only exception being that Python Script tile. It's contents is as follows:
    Code:
    import clr
    clr.AddReference('RevitAPI')
    from Autodesk.Revit.DB import *
    
    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    
    doc = DocumentManager.Instance.CurrentDBDocument
    worksets = FilteredWorksetCollector( doc )
    worksets.OfKind( WorksetKind.UserWorkset )
    name = IN[0]
    wsl = []
    found = None
    for ws in worksets:
        wsl.append([ws.Name, ws.Id.IntegerValue])
        if ws.Name == name:
            found = ws.Id.IntegerValue
    
    OUT = [found, wsl]
    A bit over the top as I also send out all the worksets and their Id's. My idea was to allow choosing from one of them afterwards. But I found using Python directly to get only the one you want is actually simpler than filtering a list and then extracting its value.

    In fact omitting the List.FirstItem just after the Python script and changing the Py to just this would give the exact same result:
    Code:
    import clr
    clr.AddReference('RevitAPI')
    from Autodesk.Revit.DB import *
    
    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    
    doc = DocumentManager.Instance.CurrentDBDocument
    worksets = FilteredWorksetCollector( doc )
    worksets.OfKind( WorksetKind.UserWorkset )
    name = IN[0]
    found = None
    for ws in worksets:
        if ws.Name == name:
            found = ws.Id.IntegerValue
    
    OUT = found
    Attached Thumbnails Attached Thumbnails Assign RVT links to worksets-worksets.png  
    amoursol likes this.

  3.    #3
    Member irneb's Avatar
    Join Date
    April 25, 2013
    Location
    Jo'burg SA
    Posts
    350
    Current Local Time
    06:05 PM
    And then to fully answer this question - including the excel source for each link to workset match:
    The python node had to change a bit:
    Code:
    import clr
    clr.AddReference('RevitAPI')
    from Autodesk.Revit.DB import *
    
    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    
    doc = DocumentManager.Instance.CurrentDBDocument
    worksets = FilteredWorksetCollector( doc )
    worksets.OfKind( WorksetKind.UserWorkset )
    names = []
    ids = []
    for ws in worksets:
        names.append(ws.Name)
        ids.append(ws.Id.IntegerValue)
    
    OUT = [names, ids]
    The "Type Name" parameter of the link is simply the filename (including the .rvt extension) of each.
    Attached Thumbnails Attached Thumbnails Assign RVT links to worksets-worksetsfromexcel.png  
    amoursol likes this.

  4.    #4
    Moderator cellophane's Avatar
    Join Date
    August 9, 2011
    Location
    Louisville, KY
    Posts
    5,923
    Current Local Time
    11:05 AM
    There are also a bunch of package nodes that can get worksets and their names / ids.
    Attached Thumbnails Attached Thumbnails Assign RVT links to worksets-worksets.png  
    amoursol and irneb like this.

  5.    #5
    Moderator
    Join Date
    February 2, 2011
    Location
    Montreal/Paris
    Posts
    825
    Current Local Time
    11:05 AM
    Jsut out of curiosity, you assign all your links to the same worksets?
    I have the same kind of definition but i use the file name to create the worksets and assign it

  6.    #6
    Member irneb's Avatar
    Join Date
    April 25, 2013
    Location
    Jo'burg SA
    Posts
    350
    Current Local Time
    06:05 PM
    If you look at the 3rd post, I've added an extra way by doing exactly what the OP asked for: Each link has an associated workset listed from an Excel file. Though I change the link and all instances thereof to the same workset.

    Your idea also could be done, e.g. get the Type Name, make a workset with same, and then set the type and all instances thereof to that workset. Though I'd be a bit reticent of this. Links can change names, and I'f seen a lot of temporary links coming and going. I'd hate to have a workset list grow and grow with lots of names no longer in use.

    Perhaps that would be another idea for a Dyn project: "Purge" unused worksets.

Similar Threads

  1. Worksets of Attached links?
    By TRWhitehead in forum Architecture and General Revit Questions
    Replies: 8
    Last Post: May 20th, 2015, 09:46 PM
  2. Manage Links & Manage Worksets
    By cmille10 in forum Architecture and General Revit Questions
    Replies: 2
    Last Post: September 25th, 2014, 10:20 AM
  3. Worksets and links
    By karpov005 in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: January 29th, 2014, 02:26 PM
  4. Revit OpEd: Reloading Links and Worksets
    By Revit OpEd in forum Blog Feeds
    Replies: 0
    Last Post: August 1st, 2013, 09:45 PM
  5. Do U Revit: Securing links through worksets
    By Do U Revit in forum Blog Feeds
    Replies: 0
    Last Post: September 6th, 2011, 05:10 PM

Posting Permissions

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