-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revit crashes from REPL but not from #43
Comments
How are you executing it in the REPL? Line-by-line? Or with the editor pad below the actual REPL? |
Can you try to wrap the code in a |
Thank you for the quick response! 'C 02-Feb-2017 12:26:57.089; 3:< view printed
'E 02-Feb-2017 12:26:57.098; 3:<
Jrn.Size 0 , 836 , 433
'E 02-Feb-2017 12:26:57.098; 3:<
Jrn.Size 0 , 816 , 413
'E 02-Feb-2017 12:26:57.100; 3:<
Jrn.Size 0 , 1042 , 658
'E 02-Feb-2017 12:26:57.100; 3:<
Jrn.Size 0 , 1022 , 638
'E 02-Feb-2017 12:26:57.102; 3:<
Jrn.Activate "[]" , "Legend: 00.1_MODEL DISTRIBUTION SHEET"
' 3:< CrsTimer event occurred for 0 times in DesktopMFCView [Sheet: 1104 - Grundriss Obergeschoss 2]
' 3:< ::92:: Delta VM: Avail 8384127 MB, Used 1056 MB, Peak +3 -> 1081 MB; RAM: Avail -24 -> 8513 MB, Used -1 -> 1185 MB, Peak +1 -> 1209 MB
' 1.135326!!! 2:!!!BIG_GAP API External Command Time
' 1:< Exception occurred
'C 02-Feb-2017 12:26:58.270; 1:< ExceptionCode=0xc0000005 ExceptionFlags=0x00000000 ExceptionAddress=000000000060A5AF
' 1:< System (MB) [Available / Total ] [Revit Memory Usage (MB) ]
' 1:< RAM Statistics: 8515 / 16341 1184=InUse 1209=Peak
' 1:< VM Statistics: 8384128 / 8388607 1054=InUse 1081=Peak
' 1:< Unconverted MessageBox "A fatal error has occurred. The application will be terminated. You have the opportunity to save recovery files for all of your changed projects.
'
'Would you like to save a recovery file?"
' 1:< ::92:: Delta VM: Avail -11 -> 8384116 MB, Used -2 -> 1054 MB; RAM: Avail +4 -> 8518 MB, Used -2 -> 1184 MB
'E 02-Feb-2017 12:27:06.163; 1:<
' [Jrn.AutoConvertedMessageBox] Rvt.Attr.MessageId: IDS_UNRECOVERABLE_ERROR Rvt.Attr.MessageAnswer: IDNO
'C 02-Feb-2017 12:27:06.163; 1:< program terminated |
I put it into a try: except: like below, and it did not hit the except. # Start transaction
t = Transaction(doc, 'export_DWFs')
t.Start()
try:
for view_sheet_set in view_sheet_sets:
if view_sheet_set.Name == "Auto_PDF_DWF":
view_set = ViewSet()
for view in view_sheet_set.Views:
view_set.Insert(view)
dwf_opt = DWFExportOptions()
dwf_opt.ExportingAreas = True
doc.Export(path_today, view.Name, view_set, dwf_opt)
except:
print("did not work")
# End transaction
t.Commit() |
side note: @hdm-dt-fb happy to see I am the only person in the world using rpw! 😄 |
Could you try removing the transaction? You're not performing any document changing actions and shouldn't need one. It might interfering Revit's internal cleanup methods that are happening during the export process. |
Try adding Revit has a poorly designed interface. When exporting, it needs to constantly activate the views to be able to read the contents and export them. Maybe it somehow can't handle the Modal RPS window. |
Thanks for all the replies and ideas!! Ultimately this export script will be run from a button, from a journal file as an automated service (weekly exports) in a VM. So for that matter I actually do not need to get it to work in the REPL, but I was very surprised something would not run in REPL but from a script file/button. |
Hm. I wonder if @PMoureu 's fix for crashes in the REPL, which he is currently backporting to RPS 2015 and 2016 might fix this. @hdm-dt-fb if you have time to dig into the RPS code, in fact, you wouldn't need to dig in much, you could try building the most recent version of the source. @PMoureu also has a pre-compiled DLL available for 2015. Check issue #39 |
Thank you Daren, I will defenitively look into that, when it gets less busy here than currently. |
@hdm-dt-fb I think, at least for RPS2015, you could just download the dll mentioned in #39 and replace it. Then you could come back and mention if it worked or not? |
Sure. I just did that, unfortunately it still crashes the same way. |
Maybe you could catch the error at another level, at least get some leads to follow, # script that is run when Revit starts in the IExternalApplication.Startup event.
try:
# add your code here
# ...
#__window__.Close()
def post_failure(sender, event):
fail_access = event.GetFailuresAccessor()
fail_mess = fail_access.GetFailureMessages()
for mess in fail_mess:
print('FAILURE\n{}'.format(mess.GetDescriptionText()))
print('Resolution possible : {}'.format( mess.HasResolutions()))
# see doc for FailureMessage class to get more details
#mess.GetFailingElements() > associated elementId
#mess.GetAdditionalElements()
__uiControlledApplication__.ControlledApplication.FailuresProcessing += post_failure
except:
import traceback # note: add a python27 library to your search path first!
traceback.print_exc() # helps you debug when things go wrong |
@PMoureu thank you! Yes, I definitively would love to understand better what is causing the issue. |
The more I try, I get the impression, that the topic is not an RPS issue. So it produced crashes on pyRevit and RPS-Buttons as well. The script works like 5% of the time if I had to guess. on SO the answer at the bottom suggest to create a view set for each individual sheet, on adsk the suggestion was to t.RollBack() which did not help: on google groups it was solved by an "Idling Event" not sure, what I would pass into sender (uiapp?) and event there? def export (sender, event):
doc.Export(folder, str(sheet.Name), collection, dwgOption)
__revit__.Idling -= export
__revit__.Idling += export @daren-thomas you seem to have used it with the http revit server as well(?) I once had a similar problem with PDF exports, where the solution was to create every setting and the export for each sheet separately but in one transaction. I will post it if I can successfully apply it here.. P.S. the aforementioned Dynamo python code #proposed by Julien Benoit @jbenoit44
#http://aecuandme.wordpress.com/
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
views = []
for i in IN[0]:
views.append(UnwrapElement(i))
folder=UnwrapElement(IN[1])
name=UnwrapElement(IN[2])
# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
a=ViewSet()
for v in views:
b= a.Insert(v)
x=DWFExportOptions()
c=doc.Export(folder,name,a,x)
# End Transaction
TransactionManager.Instance.TransactionTaskDone() |
The consistency seems to be tied to the ActiveView, i can't tell which guilty step follows the transaction inside the Export function, regeneration ?
Closing the window is very efficient, not very verbose, i agree.. |
Thank you @PMoureu !! |
Dear @daren-thomas ,
the following script - to export a sheet set as dwfs -
runs fine when defined as external script but crashes every time
when executed from RPS-REPL. (on RVT Arch2015 and 2016)
Any idea why?
I usually prototype in the (awesome) REPL and would hope to get
the same effects as when code was run from button/journal.
Best,
Frederic
The text was updated successfully, but these errors were encountered: