Donate Now Goal amount for this year: 2500 USD, Received: 1627 USD (65%)

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
Like Tree2Likes

Thread: NWC export in views

  1. #1
    Member
    Join Date
    August 29, 2015
    Posts
    95
    Current Local Time
    09:37 PM

    NWC export in views

    Hello!

    Can someone help me to export some views to NWC with Dynamo? I have found a node that export active view to NWC, but then I can only export one view. I have tried to modify the python script in "Export Active View (NWC)" but i did not make it.

    Best regards Engineer

  2. #2
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Posts
    1,401
    Current Local Time
    11:37 PM
    Does the script have a 'View' input, and if so can you input a list of views?
    Most nodes will take a single item or a list if you give them the right inputs.

  3. #3
    Member
    Join Date
    August 29, 2015
    Posts
    95
    Current Local Time
    09:37 PM
    Quote Originally Posted by josephpeel View Post
    Does the script have a 'View' input, and if so can you input a list of views?
    Most nodes will take a single item or a list if you give them the right inputs.
    No it dont, that is the problem. I tried to change the script so it had a view as input, but i did not make it. I guess it is easy if you have done some Revit-scripting, the only thing i want to do is to change from exporting active view, to exporting "input-view". Maybe you can take a look at the code.

    Here is the script:

    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 *


    import System


    import math


    doc = DocumentManager.Instance.CurrentDBDocument
    uiapp = DocumentManager.Instance.CurrentUIApplication
    app = uiapp.Application
    uidoc=DocumentManager.Instance.CurrentUIApplicatio n.ActiveUIDocument


    coll = FilteredElementCollector(doc).OfClass(ProjectLocat ion)


    output = []
    path = IN[0]
    name = IN[1]
    #path = Autodesk.Revit.DB.FilePath(pathName)
    Options = Autodesk.Revit.DB.NavisworksExportOptions()
    Options.ExportScope = NavisworksExportScope.View
    Options.ViewId = uidoc.ActiveView.Id
    doc.Export(path,name , Options)
    TransactionManager.Instance.EnsureInTransaction(do c)






    TransactionManager.Instance.TransactionTaskDone()
    doc.Regenerate()
    #OUT = dir(Autodesk.Revit.DB.NavisworksExportOptions.Expo rtScope)
    OUT = 0

  4. #4
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    10:37 PM
    Kia ora Engineer,

    Try the following (Will only work for a single View at present):

    Code:
    import clr
    clr.AddReference("RevitServices")
    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager
    clr.AddReference("RevitAPI")
    import Autodesk
    from Autodesk.Revit.DB import *
    
    doc = DocumentManager.Instance.CurrentDBDocument
    
    def tolist(item):
        if hasattr(item, "__iter__"): return item
        else: return [item]
    
    _path = IN[0]
    _name = IN[1]
    _view = UnwrapElement(IN[2])
    
    outputList = []
    
    t = TransactionGroup(doc, "Exporting Navisworks Views")
    t.Start()
    
    for _v in tolist(_view):
        _options = Autodesk.Revit.DB.NavisworksExportOptions()
        _options.ExportScope = NavisworksExportScope.View
        _options.ViewId = _v.Id
        
        exp = doc.Export(_path, _name , _options)
        outputList.append("Success")
    
    t.Commit()
    
    OUT = outputList[0]

  5. #5
    Member
    Join Date
    August 29, 2015
    Posts
    95
    Current Local Time
    09:37 PM
    Thank you amoursol, it works with one view. But how do i do if i want to export more than one view? I tried to copy the python block and put in different name and views to different python-blocks, but then i got error. "Transaction group cannot be started during an active transaction".
    amoursol likes this.

  6. #6
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    10:37 PM
    It's fickle to be honest... I tried getting it working for multiples but to no avail yet. It may need to wrap up multiples into sub-transactions. I can have a play later in the week

  7. #7
    Forum Co-Founder Twiceroadsfool's Avatar
    Join Date
    December 7, 2010
    Location
    Dallas, TX
    Posts
    10,178
    Current Local Time
    04:37 PM
    Quote Originally Posted by amoursol View Post
    It's fickle to be honest... I tried getting it working for multiples but to no avail yet. It may need to wrap up multiples into sub-transactions. I can have a play later in the week
    Just buy the CTC batch suite. It does this (and much more) and is only a couple hundred dollars. You've probably burned through that just in man hours trying to get the script to run.


    Sent from my Phablet. Please excuse typos... and bad ideas.

    Aaron Maller
    Director
    Parallax Team, Inc.

  8. #8
    Forum Addict GMcDowellJr's Avatar
    Join Date
    December 21, 2010
    Location
    Phoenix, AZ
    Posts
    2,599
    Current Local Time
    02:37 PM
    Well yeah, but not as much fun!


    Sent from my iPhone using Tapatalk
    amoursol likes this.

  9. #9
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    10:37 PM
    Quote Originally Posted by Twiceroadsfool View Post
    Just buy the CTC batch suite. It does this (and much more) and is only a couple hundred dollars. You've probably burned through that just in man hours trying to get the script to run.
    I simply play with this stuff to learn man!

  10. #10
    New Member
    Join Date
    September 6, 2015
    Location
    London
    Posts
    1
    Current Local Time
    12:37 AM
    Aaron, there is definitely a place for hardwired addins, if only for the consistent, ‘canned’ result. Dynamo has a great place but still some library of code/node bits short. I may not know where to save the code blocks so I can quickly assemble larger bits together. I have a number of suites, and don’t use the whole suite because another one does it better.

Page 1 of 2 12 LastLast

Similar Threads

  1. "views are too large to export"
    By snowyweston in forum Architecture and General Revit Questions
    Replies: 3
    Last Post: November 20th, 2017, 12:27 AM
  2. Replies: 1
    Last Post: November 4th, 2017, 04:09 PM
  3. Revit Export to IFC - Cant export to global coords?
    By BigIdiot in forum Structure - Interoperability
    Replies: 4
    Last Post: January 21st, 2016, 05:36 AM
  4. Replies: 0
    Last Post: January 3rd, 2015, 11:45 PM
  5. Replies: 0
    Last Post: November 17th, 2014, 12:15 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
  •