Results 1 to 3 of 3

Thread: Controlling worksets in a link with Dynamo

  1.    #1
    Member
    Join Date
    August 31, 2011
    Posts
    149
    Current Local Time
    07:38 PM

    Controlling worksets in a link with Dynamo

    I have a model with 8 large revit link files and would like to be able to change the visibility of the worksets in each link. I can do this via manage links but was wondering can it be done in a quick and easier way with dynamo. Thanks

  2.    #2
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Posts
    1,204
    Current Local Time
    08:38 PM
    To the question "Is XXX possible in Dynamo?" The answer is always; "Look in the API manual."

    Did a search for linked models and worksets and found this;
    LoadFrom Method (ModelPath, WorksetConfiguration)

    So, yes it looks like it is possible to reload a linked model with a specified set of worksets.
    But how you can actually do that in a python script in dynamo I dont know. You should ask about this method on the Dynamo forum.

  3.    #3
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    554
    Current Local Time
    07:38 PM
    Hello Joe,

    To get you started, the following does a similar thing for Batch Reloading Families. You'll also need to create a Class for your LoadFrom method as Joseph has mentioned.

    Below is the code which follows a similar format:

    Code:
    import clr
    clr.AddReference('ProtoGeometry')
    from Autodesk.DesignScript.Geometry import *
    
    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
    uiapp = DocumentManager.Instance.CurrentUIApplication
    app = uiapp.Application
    
    clr.AddReference('RevitAPI')
    import Autodesk
    from Autodesk.Revit.DB import *
    import System
    
    import sys
    pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
    sys.path.append(pyt_path)
    
    dirPath = IN[0]
    overWrite = IN[1]
    
    class famOptions(IFamilyLoadOptions):
        def __init__(self) : pass
        def OnFamilyFound(self,familyInUse,overwriteParameterValues) : return ooverWrite[0]
        def OnSharedFamilyFound(self,familyInUse,source,overwriteParameterValues) : return overWrite[0]
    
    try:
        errorReport = None
        outValue = []
        for i in dirPath:
            if ".rfa" in i:
                famDoc = app.OpenDocumentFile(i)
                outValue.append(famDoc.LoadFamily(doc,famOptions()))
                famDoc.Close(False)
    except:
        import traceback
        errorReport = traceback.format_exc()
        
    if errorReport == None:
        OUT = outValue
    else:
        OUT = errorReport
    This is still a little beyond me (Shoutout to Dimitar Venkov!) but may point you in the right direction.
    Last edited by amoursol; January 17th, 2018 at 03:10 PM.

Similar Threads

  1. Can I use Dynamo to create Worksets?
    By ryntau in forum Dynamo BIM
    Replies: 4
    Last Post: November 5th, 2015, 02:37 PM
  2. Revit Link Controlled by two Worksets
    By Nakmonadon in forum Architecture and General Revit Questions
    Replies: 7
    Last Post: July 17th, 2015, 08:27 AM
  3. Replies: 0
    Last Post: September 8th, 2014, 12:45 PM
  4. Group to Link and Preserve Worksets?
    By Versiamo01 in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: May 22nd, 2014, 08:33 PM
  5. Managed Worksets with a RVT Link
    By Alex Cunningham in forum Architecture and General Revit Questions
    Replies: 4
    Last Post: May 20th, 2011, 03:44 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
  •