Pyrevit: Copy Sheets to Open Documents is Throwing Back an Error

Created on 4 Jun 2019  ·  7Comments  ·  Source: eirannejad/pyRevit

When trying to copy sheets with only legends, drafting views, and schedules to open documents; the command fails and throws an error.

To Reproduce
Steps to reproduce the behavior:

  1. Open two Revit files in 2019
  2. Click on Copy Sheets to Open Documents
  3. Click on the desired sheet to copy
  4. Un-click titleblock
  5. Complete task
  6. Error thrown

Expected behavior
Sheet to be copied to open document.

Desktop (please complete the following information):

  • OS: [Windows 10]
  • pyRevit Version [4.6.19]
  • pyRevit Environment:
C:\Users\qlevine>pyrevit env
==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive)
master | Deploy: "basepublic" | Branch: "master" | Version: "4.6.17" | Path: "C:\Users\*\AppData\Roaming\pyRevit-Master"
==> Attachments
Autodesk Revit 2016 Update 7 for R2 | Clone: "master" | Engine: "277"
Autodesk Revit 2017.2.3 | Clone: "master" | Engine: "277"
Autodesk Revit 2018 First Customer Ship | Clone: "master" | Engine: "277"
Autodesk Revit 2019.2 (Update) | Clone: "master" | Engine: "277"
==> Installed UI Extensions
==> Installed Library Extensions
==> Default Extension Search Path
C:\Users\qlevine\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
==> Extension Sources - Default
https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2016 Update 7 for R2 | Version: 16.0.1185.0 | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2016\"
Autodesk Revit 2017.2.3 | Version: 17.0.1150.0 | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2017\"
Autodesk Revit 2018 First Customer Ship | Version: 18.0.0.420 | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2018\"
Autodesk Revit 2019.2 (Update) | Version: 19.2.0.65 | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2019\"
==> Running Revit Instances
PID: 10144 | Autodesk Revit 2017.2.3 | Version: 17.0.1150.0 | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2017"
==> User Environment
Microsoft Windows 10 [Version 10.0.17763]
Executing User: *\qlevine
Active User: *\qlevine
Adming Access: No
%APPDATA%: "C:\Users\*\AppData\Roaming"
Latest Installed .Net Framework: "4.7.2"
No .Net Target Packs are installed.
pyRevit CLI 0.9.0.0

Additional context

Copying Sheet(s) to Document: 19085_Staples-Connect_Somerville_central_apapadakis

Copying Sheet: G002 - GENERAL, LIFE SAFETY & ACCESSIBILTY NOTES
  Copying/updating Sheet: GENERAL, LIFE SAFETY & ACCESSIBILTY NOTES
    Copying/updating view: GENERAL - SYMBOLS
      View/Sheet already exists in document.
      Placing copied view on sheet.
    Copying/updating view: GENERAL - ACCESSIBILITY CLEARANCES
      View/Sheet already exists in document.
      Placing copied view on sheet.
    Copying/updating view: GENERAL - ABBREVIATIONS
      View/Sheet already exists in document.
      Placing copied view on sheet.
    Copying/updating view: GENERAL - MATERIAL LEGEND
      View/Sheet already exists in document.
      Placing copied view on sheet.
    Copying/updating view: LEGEND - MOUNTING HEIGHTS
      View/Sheet already exists in document.
      Placing copied view on sheet.
    Copying/updating view: GENERAL NOTES - LIFE SAFETY
      View/Sheet already exists in document.
      Placing copied view on sheet.
ERROR: [pyrevit.revit.db.transaction] Error in Transaction Context. Rolling back changes. | <type 'exceptions.Exception'>:viewId cannot be added to the ViewSheet. 
Parameter name: viewId
ERROR: [pyrevit.revit.db.transaction] Error in TransactionGroup Context. Rolling back changes. | <type 'exceptions.Exception'>:viewId cannot be added to the ViewSheet. 
Parameter name: viewId
IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\apapadakis\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Sheets.pulldown\Copy Sheets to Open Documents.pushbutton\script.py", line 465, in 
File "C:\Users\apapadakis\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Sheets.pulldown\Copy Sheets to Open Documents.pushbutton\script.py", line 424, in copy_sheet
File "C:\Users\apapadakis\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Sheets.pulldown\Copy Sheets to Open Documents.pushbutton\script.py", line 349, in copy_sheet_viewports
Exception: viewId cannot be added to the ViewSheet.
Parameter name: viewId


Script Executor Traceback:
Autodesk.Revit.Exceptions.ArgumentException: viewId cannot be added to the ViewSheet.
Parameter name: viewId
at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction function, Object arg0, Object arg1, Object arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at Microsoft.Scripting.Interpreter.DynamicInstruction`6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at PyRevitBaseClasses.ScriptExecutor.ExecuteScript(PyRevitCommandRuntime& pyrvtCmd)'
Under Review

All 7 comments

What kind of views are placed on the source G002 - GENERAL, LIFE SAFETY & ACCESSIBILTY NOTES? is GENERAL NOTES - LIFE SAFETY a legend?

Legends, drafting views, and schedules are placed on that sheet along with an imported image. Screenshot attached.
image
@eirannejad

I'm thinking the GENERAL NOTES - LIFE SAFETY view already exists in the destination model and can not be added to the new sheet again. Drafting views can only be placed on a single sheet.

I can replicate the error using this scenario

2019-06-05 08_11_20-Copy Sheets to Open Documents

I was also able to reproduce it with the same steps as you. Thanks for following up! Is there a toggle for updating drafting views that already exist vs altering the name to avoid this error?

I'll think of something :)

Thanks!

Resolved and will be pushed with 4.6.24

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexVilaOrtega picture AlexVilaOrtega  ·  3Comments

kuldeep3618x picture kuldeep3618x  ·  4Comments

pihglez picture pihglez  ·  4Comments

Arsany123 picture Arsany123  ·  4Comments

jkcameron picture jkcameron  ·  5Comments