使用Revit API在Revit Architecture 2014中打开Workshared文档

时间:2016-08-22 12:05:02

标签: autodesk revit-api revit

我是Revit API的新手。我正在尝试使用Revit API 2014打开revit文档。它适用于非工作共享的revit文件,但我无法使用API​​打开workshared revit文件。任何人都可以指出我是否使用正确的方法打开workshared revit文件?以下是我的代码段:

 Document _docCl = uiapp.Application.OpenDocumentFile(_revitFileToOpen);

 if (_docCl.IsWorkshared)
 {
      _docCl.Close();
      _docCl = null;
      ModelPath mdlPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(this._revitFileToOpen);
      OpenOptions opts = new OpenOptions();
      opts.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;

      _docClActive = uiapp.OpenAndActivateDocument(mdlPath, opts, false); //doesn't work
      //uiapp.Application.OpenDocumentFile(mdlPath, opts);   //doesn't work either
}
else
{
      _docClActive = uiapp.OpenAndActivateDocument(_revitFileToOpen);
}

下面是期刊日志文件的一部分似乎相关:

'  0.000032         7:<<<WorksharingLog::getSlog [\\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt] 
' 6:< Additional IP address/name found for host INLTAPPL034: 10.10.87.85  
' 6:< DBG_INFO: Get addresses failed (using getaddrinfo) for central server CBA01-SRV-FS01: The requested name is valid, but no data of the requested type was found. : line 626 of n:\build\2014_ship_x64_inst_20130308_1515\source\revit\revitdb\permissions\WorksharingLog.cpp. 
' 6:< SLOG  user="amitp" 
' 6:< SLOG  build="20130308_1515(x64)" 
' 6:< SLOG  server=??.??.??.?? "???.com" 
' 6:< SLOG  central="\\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt" 
' 6:< SLOG  local="E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt" 
' 6:< SLOG  timer="pulse-6e549c85.tmp" 
'  2.553593!!!!!!! 6:!!!BIG_GAP LoadSerialize 
' 7:< Threaded version of fileExists is enabled. 2.262 seconds elapsed for threaded fileExists \\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt 
'  2.252302         7:<<<fileExists? 
' 6:< SLOG $6e549c85 2016-08-22 20:29:58.408 >Open 
'  0.000237         7:<<<fileExists? 
' 6:< SLOG $6e549c85 2016-08-22 20:29:58.408 >Open:Local  "E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt" 
'  0.000223         7:<<<fileExists? 
' 6:< fileSizeOnOpen:89056KB 
 'E 22-Aug-2016 20:29:58.409;   7:< 
 ' [Jrn.BasicFileInfo] Rvt.Attr.Worksharing: Local Rvt.Attr.UserName: amitp Rvt.Attr.CentralModelPath: \\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.RevitBuildVersion: Autodesk Revit Architecture 2014 (Build: 20130308_1515(x64)) Rvt.Attr.LastSavePath: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.ProjectSpark: notProjectSpark Rvt.Attr.LocaleWhenSaved: ENU 
'  0.024759          8:<<<app infos and other global data 
' 7:< File was saved in Autodesk Revit Architecture 2014 (Build: 20130308_1515(x64)) 
'  1.071029           10:<<<updating dependencies in delayed deletion 
'  0.005856           10:<<<getAllNonexistentParents in delayed deletion 
'  0.050896           10:<<<findAppInfoNonexistentParents in delayed deletion 
'  1.128135           9:<<delayed deletion 
'  0.007749           9:<<<forceResetOfElemRecOwnerCache 
'  1.223763          8:<<ADocumentUpgrade::docUpgrade 
'  8.653545       5:<<LoadSerialize/ALL_GAPS   2.559036/TurnOff_GAPs 100% 
'  8.653719      4:<<LoadFromStorage 
' 4:< LPSTORAGE RELEASED: plpRootStg=0x14321818, lpRootStg=0x09778080 
' 4:< DummyStorage destroying DataStorageInterface 0x0000000014790090 
' 4:< DataStorageInterface destroyed 0x0000000014790090 
' 4:< AFTER RELEASE: plpRootStg=0x14321818, lpRootStg=0x00000000 
'  0.010065      4:<<<relinquishAllLocks 
' 3:< SLOG $6e549c85 2016-08-22 20:30:02.133 <Open:Local 
'  0.000248      4:<<<fileExists? 
' 3:< SLOG $6e549c85 2016-08-22 20:30:02.133 <Open 
'  0.000146      4:<<<fileExists? 
'  0.022058       5:<<<forceResetOfElemRecOwnerCache 
' 5:< Unnecessary nesting;Document\PostLoadDocument.cpp;160;String_Revit_DelayedPropagatoinRegen ;N++E(N); 

' 6:< Element Expansion Statistics: 
' 6:<  0% Opening Plans                    (0) 
' 6:<  0% Opening RC Plans                 (0) 
' 6:<  0% Opening 3d Views                 (0) 
' 6:<  0% Opening Elevations and Sections  (0) 
' 6:<  0% In Regnerate                     (0) 
' 6:<  0% In Autojoin                      (0) 
' 6:<  0% In Overlap Checking              (0) 
' 6:<  0% Reviewing PostedWarnings         (0) 
' 6:<  100% Other                            (1560439) 
' 6:< total bytes expanded: 1560439 
' 6:< ;EES;0;0;0;0;0;0;0;0;100; 
'  0.000330         7:<<<ppg constructor 
'  0.000011         7:<<<updating dependencies in dp 
'  0.000031         7:<<<notifyAppInfosOfDP(0) 
'  0.000002          8:<<<updating dependencies in delayed deletion 
'  0.005908          8:<<<getAllNonexistentParents in delayed deletion 
'  0.063470          8:<<<findAppInfoNonexistentParents in delayed deletion 
'  0.000016          8:<<<notifyAppInfosOfDP(1) 
'  0.069706         7:<<delayed deletion 
'  0.176552        6:<<ADocumentMerge::delayedPropagation 
'  0.000262         7:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000032         7:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
' 7:< ::2:: Delta VM: Avail 8384631 MB, Used 534 MB; RAM: Avail +11 -> 2810 MB, Used +0 -> 612 MB 
'  0.000005          8:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000031           9:<<<;PERF;MISC;regenerating 
'  0.000570         7:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000534/TurnOff_GAPs 17% 
'  0.619823        6:<<EndOrAbortUndoTransaction();DOPT; 
'  0.810964       5:<<delayed propagation on open 
'  0.000014       5:<<<updating dependencies on open 
' 5:< ::2:: Delta VM: Avail 8384631 MB, Used 534 MB; RAM: Avail +126 -> 2936 MB, Used 612 MB 
' 5:< Threaded version of fileExists is enabled. 2.559 seconds elapsed for threaded fileExists \\DENHV12P\PROJECTS\TCH-FITZ.338\338.081 East Tower\6 Drawings\Revit Working\__CAD Underlays\KITCHEN BACKGROUND - EXT.dwg 
'  2.557757!!!!!!! 6:!!!BIG_GAP reloadLinkedInstances [5/6] 

' 5:< No Keynote File: R:\TCH-FITZ.338\338.081 East Tower\6 Drawings\Revit Working\IMFM Keynotes User.txt 
' 5:< DBG_INFO: Couldn't obtain time/date stamp for R:\TCH-FITZ.338\338.081 East Tower\6 Drawings\Revit Working\IMFM Keynotes User.txt so that cannot correct file create/access/modify time!, the GetLastError is 6: line 1951 of FileUtil.cpp. 

' 4:< Document save history --> : 
' 4:<   Revit Architecture 2014 2014 (2014.000) : 20140709_2115(x64) 
' 4:<   Revit Architecture 2014 2014 (2014.000) : 20130709_2115(x64) 
' 4:<   Revit 2014 2014 (2014.000) : 20131024_2115(x64) 
' 4:<   Revit Architecture 2014 2014 (2014.000) : 20130308_1515(x64) 
' 4:< Document save history <-- 
'  3.448459      4:<<[Cloud]postLoadDocument 
' 12.119349     3:<<DocumentStorage::onOpenDocument [E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt] 
'H 22-Aug-2016 20:30:05.625;   2:< 
Jrn.Directive "DocSymbol"  _
        , "[AMCFM_C_AI_R14_HL.rvt]"
' 2:< DBG_INFO: When constructing ElementRecord, elem 0 not found: line 24 of n:\build\2014_ship_x64_inst_20130308_1515\source\revit\revitdb\elemtable\ElementRecord.cpp. 
' 3:< TaskDialog "Doc opened... Document Name : E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt"
'CommonButtons : Close
'DefaultButton : Close 
'H 22-Aug-2016 20:30:07.541;   3:< 
Jrn.Data "TaskDialogResult"  _
        , "Doc opened... Document Name : E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt",  _
         "Close", "IDCLOSE"
' 2:< SLOG $6e549c85 2016-08-22 20:30:07.710 >WSConfig 
'  1.983669!!!! 3:!!!BIG_GAP [Cloud]handWrittenOpenDocumentFile 
' 2:<  0 ModelServerState "Created": Current server = "Not Queried", Model server = "", Model server state = "Not Applicable" 
' 2:< DataStorageInterface created 0x0000000014A46750 
' 3:< MasterLocks 0x000000000012CD70 ensureAppropriateStorage DataStorageInterface WAS m_oDataStorage 0x0000000014A46750 m_pDataStorage 0x0000000014A46750 
' 3:< DataStorageInterface created 0x0000000014A467D0 
' 3:< DataStorageInterface destroyed 0x0000000014A46750 
' 3:< MasterLocks 0x000000000012CD70 ensureAppropriateStorage DataStorageInterface m_oDataStorage 0x0000000014A467D0 m_pDataStorage 0x0000000014A467D0 
' 3:< SLOG $6e549c85 2016-08-22 20:30:07.715 .WSConfig:LockRoot  R SCODE=0x80070035 
' 2:< initTransactionStatus unable to refresh permissions 
' 2:< DataStorageInterface destroyed 0x0000000014A467D0 
' 2:<  0 ModelServerState "Destroyed": Current server = "Not Queried", Model server = "", Model server state = "Not Applicable" 
' 2:< SLOG $6e549c85 2016-08-22 20:30:07.717 <WSConfig 

' 2:< Element Expansion Statistics: 
' 2:<  0% Opening Plans                    (0) 
' 2:<  0% Opening RC Plans                 (0) 
' 2:<  0% Opening 3d Views                 (0) 
' 2:<  0% Opening Elevations and Sections  (0) 
' 2:<  0% In Regnerate                     (0) 
' 2:<  0% In Autojoin                      (0) 
' 2:<  0% In Overlap Checking              (0) 
' 2:<  13% Reviewing PostedWarnings         (257178) 
' 2:<  87% Other                            (1715892) 
' 2:< total bytes expanded: 1973070 
' 2:< ;EES;0;0;0;0;0;0;0;13;87; 
' 14.282558    2:<<[Cloud]handWrittenOpenDocumentFile/ALL_GAPS   2.163209/TurnOff_GAPs 83% 
' 1:< TaskDialog "Requested document is a workshared document...."
'CommonButtons : Close
'DefaultButton : Close 
'H 22-Aug-2016 20:30:08.872;   1:< 
Jrn.Data "TaskDialogResult"  _
        , "Requested document is a workshared document....",  _
         "Close", "IDCLOSE"
' 1:< INVISIBLE timing block  
' 1:<  0 ModelServerState "Created": Current server = "Not Queried", Model server = "", Model server state = "Not Applicable" 
'  0.000071    2:<<<saveModifiedRvtLinkSymbols 
'  0.000025      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000004      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000003       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000014        6:<<<;PERF;MISC;regenerating 
'  0.000292      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000275/TurnOff_GAPs 29% 
'  0.129988     3:<<EndOrAbortUndoTransaction();DOPT; 
'  0.000014      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000004      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000002       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000011        6:<<<;PERF;MISC;regenerating 
'  0.000270      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000257/TurnOff_GAPs 30% 
'  0.002592     3:<<EndOrAbortUndoTransaction();DOPT; 
'  0.000009      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000003      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000002       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000006        6:<<<;PERF;MISC;regenerating 
'  0.000174      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000167/TurnOff_GAPs 28% 
'  0.001768     3:<<EndOrAbortUndoTransaction();DOPT;/ALL_GAPS   0.001581/TurnOff_GAPs 1% 
'  0.000007      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000001      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000001       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000005        6:<<<;PERF;MISC;regenerating 
'  0.000156      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000150/TurnOff_GAPs 31% 
'  0.001319     3:<<EndOrAbortUndoTransaction();DOPT; 
'  0.000007      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000001      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000001       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000006        6:<<<;PERF;MISC;regenerating 
'  0.000162      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000155/TurnOff_GAPs 30% 
'  0.001432     3:<<EndOrAbortUndoTransaction();DOPT;/ALL_GAPS   0.001262/TurnOff_GAPs 1% 
'  0.000007      4:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000002      4:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000001       5:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000005        6:<<<;PERF;MISC;regenerating 
'  0.000150      4:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000144/TurnOff_GAPs 32% 
'  0.001306     3:<<EndOrAbortUndoTransaction();DOPT; 
'  0.140553    2:<<saveModifiedImportSymbols 
' 1:< DataStorageInterface created 0x0000000014A467D0 
' 1:< DataStorageInterface created 0x0000000014A46750 
' 1:< MasterLocks 0x000000000012CEA0 ensureAppropriateStorage DataStorageInterface WAS m_oDataStorage 0x0000000014A46750 m_pDataStorage 0x0000000014A46750 
' 1:< DataStorageInterface created 0x0000000014A46850 
' 1:< DataStorageInterface destroyed 0x0000000014A46750 
' 1:< MasterLocks 0x000000000012CEA0 ensureAppropriateStorage DataStorageInterface m_oDataStorage 0x0000000014A46850 m_pDataStorage 0x0000000014A46850 
'  0.000005    2:<<<relinquishAllLocks 
' 1:< DataStorageInterface destroyed 0x0000000014A46850 
'  0.000022     3:<<<EndOrAbortUndoTransaction() -- trackers regen;DOPT; 
'  0.000002     3:<<<EndOrAbortUndoTransaction()--AtomViewReferencingUpdate();DOPT; 
'  0.000002      4:<<<EndOrAbortUndoTransaction()--end of transaction checks--invisible elements;DOPT; 
'  0.000011       5:<<<;PERF;MISC;regenerating 
'  0.000249     3:<<EndOrAbortUndoTransaction()--end of transaction checks;DOPT;/ALL_GAPS   0.000236/TurnOff_GAPs 32% 
'  0.001897    2:<<EndOrAbortUndoTransaction();DOPT; 
' 2:< MasterLocks 0x00000000574F0080 ensureAppropriateStorage DataStorageInterface WAS m_oDataStorage 0x0000000014A467D0 m_pDataStorage 0x0000000014A467D0 
' 2:< DataStorageInterface created 0x0000000014A46850 
' 2:< DataStorageInterface destroyed 0x0000000014A467D0 
' 2:< MasterLocks 0x00000000574F0080 ensureAppropriateStorage DataStorageInterface m_oDataStorage 0x0000000014A46850 m_pDataStorage 0x0000000014A46850 
' 4:< ::2:: Delta VM: Avail -175 -> 8384455 MB, Used +2 -> 537 MB; RAM: Avail +0 -> 2947 MB, Used +1 -> 615 MB 
' 4:< MasterLocks 0x00000000574F0080 DummyStorage stole m_oDataStorage 0x0000000014A46850 but left m_pDataStorage 0x0000000014A46850 
' 4:< LPSTORAGE ACQUIRED: DocumentStorage=0x14321750, plpRootStg=0x14321818, lpRootStg=0x09778080 
'  0.003546      4:<<acquireFileLock 
'  0.003637     3:<<acquiring lock 
' 3:< DataStorageInterface created 0x0000000014A467D0 
'C 22-Aug-2016 20:30:09.087;   4:< File: Open 
'  0.000002       5:<<<OpenDocumentTask::acquireFileLock 
'  0.030179          8:<<<loadAllClasses 
'  0.000038          8:<<<RegisterPreDocLoadCallback::invokeCallbacks 
'  0.000769           9:<<<LoadModel DSI 
'  0.000833          8:<<loading DocumentStorageIndex 
 'E 22-Aug-2016 20:30:09.119;   8:< 
 ' [Jrn.BasicFileInfo] Rvt.Attr.Worksharing: Local Rvt.Attr.UserName: amitp Rvt.Attr.CentralModelPath: \\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.RevitBuildVersion: Autodesk Revit Architecture 2014 (Build: 20130308_1515(x64)) Rvt.Attr.LastSavePath: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.ProjectSpark: notProjectSpark Rvt.Attr.LocaleWhenSaved: ENU 
'  0.000510           9:<<<History 
'  0.001148           9:<<<increment table 
'  0.015164          8:<<DocumentStorageIndexImpl::loadDocument()  
'  0.047160        6:<<LoadSerialize 
'  0.047289       5:<<LoadFromStorage 
'  0.047553      4:<<DocumentStorage::onOpenDocument [E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt] 
' 3:< compare GUIDs; creation c18fea7b-7fd5-40e0-9b77-3ccb92fe3eeb; detach c2effc75-eec7-4a68-9985-7cb8985cc740; upgrade 80d9c28b-d7e7-4013-8d2d-edd4c21d435a; DIFF prevUpgrade c18fea7b-7fd5-40e0-9b77-3ccb92fe3eeb != 80d9c28b-d7e7-4013-8d2d-edd4c21d435a 
'  0.000004      4:<<<relinquishAllLocks 
' 3:< DataStorageInterface destroyed 0x0000000014A467D0 

' 2:< Revit Graphics Information 
' 2:<   Current Mode : DirectX Hardware 
' 2:<   Use Hardware: ON 
' 2:<   Use Overlays : ON 
' 2:< After : Create Display Manager 

'  0.123757    2:<<OpenFileForSave::openFileForSave 
'  0.000002      4:<<<storePreviewImage 
'  0.003901      4:<<<storeValidation 
'  0.064306       5:<<<ElementSender::createDocSaveSwapout 
'  0.000127         7:<<<Reconsolidater::getAllLiveElementCounts 
' 6:< [ISL] Stream#266 (0 live/0 total elements) marked for deletion during reconsolidation 
'  0.000248        6:<<Reconsolidater::getStreamsToReconsolidate 
'  0.000281       5:<<pre-swapout reconsolidate 
'  0.000620       5:<<<ElemTable::updateETforSave 
'  0.000001       5:<<<ElementSender::swapOut()  
' 5:< updateDITforSave increment 267L has 12782 (+0) episodes 
'  0.000358       5:<<Updating increment and partition tables for save (quick) 
'  0.003116        6:<<<Storing increment table  [#obsolete=15, first#=212, last#=267] 
'  0.062210        6:<<<Storing DocumentHistory  [#episodes=12783, #valid=11257, max ep id#=12782] 
'  0.011262        6:<<<Storing PartitionTable  [#partitions=1512, #deleted=815, max id#=43818] 
'  0.001607        6:<<<Storing Content Documents 
'  0.181542        6:<<<Storing ElemTable  [#elts=137923, #graveyard=928, max id#=12483562] 
'  0.035586        6:<<<Storing global stream 
'  0.000048         7:<<<OLEStgLock::commit overwrite=yes consolidate=no 
'  0.304950        6:<<commitAllGlobalStreams/ALL_GAPS   0.304902/TurnOff_GAPs 100% 
'  0.615831       5:<<Storing tables 
'  0.000024          8:<<<OLEStgLock::commit overwrite=yes consolidate=no 
'  0.031170       5:<<ModelStorer::storeStreams() /ALL_GAPS   0.031146/TurnOff_GAPs 99% 
'  0.713105      4:<<ModelStorer::storeDocument()  
' 3:< GETLOADSTOREOPTIONS in GET Project\OleStorage.cpp(240) despite m_dontFetch 
'  0.000224       5:<<<storeSelf DocumentStorageIndexBackup 
'  0.001857       5:<<<storeSelf updateDSIforSave 
'  0.005144      4:<<DocumentStorageIndex::storeSelf [12781] 
' 3:< GETLOADSTOREOPTIONS in GET n:\build\2014_ship_x64_inst_20130308_1515\source\revit\revitdb\document\Document.cpp(6024) despite m_dontFetch 
' 3:< GETLOADSTOREOPTIONS in GET Project\ProjectExtras.cpp(122) despite m_dontFetch 
' 4:< GETLOADSTOREOPTIONS in GET Project\OleStorage.cpp(240) despite m_dontFetch 
' 4:< GETLOADSTOREOPTIONS in GET Project\ProjectExtras.cpp(140) despite m_dontFetch 
' 4:< GETLOADSTOREOPTIONS in GET Project\ProjectExtras.cpp(159) despite m_dontFetch 
'  0.030804      4:<<storeBasicFileInfoStream 
'  0.000007      4:<<<storePartAtomStream 
'  0.168626      4:<<storeProjectXMLInfoStream 
'  1.006264     3:<<TrustedUtility::SaveToStorage - serialize block/ALL_GAPS   0.084674/TurnOff_GAPs 65% 
'  0.032333     3:<<TrustedUtility::SaveToStorage - commit format/contents locks 
' 3:< ::3:: Delta VM: Avail +11 -> 8384467 MB, Used 537 MB; RAM: Avail -14 -> 2933 MB, Used +12 -> 628 MB 
'  0.268941      4:<<<OLEStgLock::commit overwrite=yes consolidate=yes 
'  0.269292     3:<<TrustedUtility::SaveToStorage - commitStorage 
'  1.309396    2:<<TrustedUtility::saveToStorage 
'H 22-Aug-2016 20:30:10.550;   1:< 
Jrn.Directive "DocSymbol"  _
        , "[AMCFM_C_AI_R14_HL.rvt]"
'  0.000395     3:<<<preCommit finding backup files 
' 2:< GETLOADSTOREOPTIONS in GET Project\OleStorage.cpp(240) despite m_dontFetch 
'  0.000177     3:<<<findFileAndWorksetVersionsToKeep 
'  0.000387     3:<<<BackupPaths::DocumentVersionIterator 
' 2:< GETLOADSTOREOPTIONS in GET Project\OleStorage.cpp(240) despite m_dontFetch 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\265_0.rws 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\global.7070.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\history.7070.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\elemtable.7070.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\contentdocuments.0431.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\partitiontable.7070.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\incrementtable.7099.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\basicfileinfo.7065.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\transmissiondata.0431.dat 
' 3:< Marking file for quick purge: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL_backup\projectinformation.0431.dat 
'  0.001184     3:<<<findFilesToDeleteBasedOnIncrements 
'  0.003227    2:<<BackupFileManager::preUnlockPreCommit 
'  0.000006    2:<<<BackupFileManager::postUnlockPreCommit 
'  0.013889    2:<<<BackupFileManager::commit 
' 2:< ::3:: Delta VM: Avail +176 -> 8384643 MB, Used 537 MB; RAM: Avail +3 -> 2937 MB, Used -4 -> 624 MB 
' 2:< LPSTORAGE RELEASED: plpRootStg=0x14321818, lpRootStg=0x09778080 
' 2:< DummyStorage destroying DataStorageInterface 0x0000000014A46850 
' 2:< DataStorageInterface destroyed 0x0000000014A46850 
' 2:< AFTER RELEASE: plpRootStg=0x14321818, lpRootStg=0x00000000 
'  0.005317    2:<<<relinquishAllLocks 
' 1:< DataStorageInterface created 0x0000000014A46850 
'  0.000004    2:<<<temporaryEffects.destroy(DoSave) 
'  0.000255    2:<<<commit/cleanup 
'  0.000005    2:<<<relinquishAllLocks 
' 1:< DataStorageInterface destroyed 0x0000000014A46850 

'C 22-Aug-2016 20:30:11.048;   3:< File: Open 
' 4:< DataStorageInterface created 0x000000001478E590 
' 4:< Connecting session [$404fa1d3] to Worksharing Log [C:\Users\amitp\AppData\Local\Autodesk\Revit\Autodesk Revit Architecture 2014\Journals\journal.0001.txt] 
'  0.000013       5:<<<WorksharingLog::getSlog [] 
' 4:< Additional IP address/name found for host INLTAPPL034: 10.10.87.85  
' 5:< MasterLocks 0x0000000046654730 ensureAppropriateStorage DataStorageInterface WAS m_oDataStorage 0x000000001478E590 m_pDataStorage 0x000000001478E590 
' 5:< DataStorageInterface created 0x000000001478F510 
' 5:< DataStorageInterface destroyed 0x000000001478E590 
' 5:< MasterLocks 0x0000000046654730 ensureAppropriateStorage DataStorageInterface m_oDataStorage 0x000000001478F510 m_pDataStorage 0x000000001478F510 
' 5:< ::4:: Delta VM: Avail -169 -> 8384499 MB, Used 513 MB; RAM: Avail +4 -> 2960 MB, Used 601 MB 
' 5:< MasterLocks 0x0000000046654730 DummyStorage stole m_oDataStorage 0x000000001478F510 but left m_pDataStorage 0x000000001478F510 
' 5:< LPSTORAGE ACQUIRED: DocumentStorage=0x14321ab0, plpRootStg=0x14321b78, lpRootStg=0x14881ba0 
'  0.002869       5:<<acquireFileLock 
'  0.004018      4:<<OpenDocumentTask::acquireFileLock 
'  0.020358         7:<<<loadAllClasses 
'  0.000029         7:<<<RegisterPreDocLoadCallback::invokeCallbacks 
'  0.000506          8:<<<LoadModel DSI 
'  0.000557         7:<<loading DocumentStorageIndex 
 'E 22-Aug-2016 20:30:11.074;   7:< 
 ' [Jrn.BasicFileInfo] Rvt.Attr.Worksharing: Local Rvt.Attr.UserName: amitp Rvt.Attr.CentralModelPath: \\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.RevitBuildVersion: Autodesk Revit Architecture 2014 (Build: 20130308_1515(x64)) Rvt.Attr.LastSavePath: E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt Rvt.Attr.ProjectSpark: notProjectSpark Rvt.Attr.LocaleWhenSaved: ENU 
'  0.057984          8:<<<History 
'  0.001012          8:<<<increment table 
'  0.002487          8:<<<WorksetTable 
'  0.086087         7:<<DocumentStorageIndexImpl::loadDocument()  
'  0.000027          8:<<<distributeKnownEpisodesToSubsets 
'  0.107716       5:<<LoadSerialize 
'  0.107821      4:<<LoadFromStorage 
' 4:< ::5:: Delta VM: Avail +174 -> 8384674 MB, Used 513 MB; RAM: Avail 2960 MB, Used 601 MB 
' 4:< LPSTORAGE RELEASED: plpRootStg=0x14321b78, lpRootStg=0x14881ba0 
' 4:< DummyStorage destroying DataStorageInterface 0x000000001478F510 
' 4:< DataStorageInterface destroyed 0x000000001478F510 
' 4:< AFTER RELEASE: plpRootStg=0x14321b78, lpRootStg=0x00000000 
'  0.001984      4:<<<relinquishAllLocks 
'  0.114172     3:<<DocumentStorage::onOpenDocument [E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt] 
' 2:< Connecting session [$1de94fdf] to Worksharing Log [C:\Users\amitp\AppData\Local\Autodesk\Revit\Autodesk Revit Architecture 2014\Journals\journal.0001.txt] 
' 2:< Additional IP address/name found for host INLTAPPL034: 10.10.87.85  
' 2:< SLOG $1de94fdf 2016-08-22 20:30:13.425 >Session  $1de94fdf 
' 2:< SLOG  user="amitp" 
' 2:< SLOG  build="20130308_1515(x64)" 
' 2:< SLOG  journal="C:\Users\amitp\AppData\Local\Autodesk\Revit\Autodesk Revit Architecture 2014\Journals\journal.0001.txt" 
' 2:< SLOG  host=fe80::59d8:cab6:ad7:5925%14 "INLTAPPL034.MPTDC1-India.MirrorPlus.com" 
' 2:< SLOG  server=??.??.??.?? "???.com" 
' 2:< SLOG  central="\\CBA01-SRV-FS01\EAD Files\C0190-ARC\15-0091-CHCO-Children's Hospital Colorado\80-CHCO-Revit Files\AMCFM_C_AI_R14_HL.rvt" 
' 2:< SLOG  local="E:\Test Dataset\Revit Files\AMCFM_C_AI_R14_HL.rvt" 
' 2:< SLOG  timer="pulse-1de94fdf.tmp" 
' 2:< SLOG  timebias=-330 
'  2.251970!!!! 3:!!!BIG_GAP MFCProjectAgent::getWorksetConfigForLoading 'Specify' = askUser 
' 2:< SLOG $1de94fdf 2016-08-22 20:30:13.426 >WSD 
' 3:<  0 ModelServerState "Created": Current server = "Not Queried", Model server = "", Model server state = "Not Applicable" 
' 3:< DataStorageInterface created 0x000000001478E590 
' 4:< MasterLocks 0x000000000012C2F0 ensureAppropriateStorage DataStorageInterface WAS m_oDataStorage 0x000000001478E590 m_pDataStorage 0x000000001478E590 
' 4:< DataStorageInterface created 0x0000000014A4CD50 
' 4:< DataStorageInterface destroyed 0x000000001478E590 
' 4:< MasterLocks 0x000000000012C2F0 ensureAppropriateStorage DataStorageInterface m_oDataStorage 0x0000000014A4CD50 m_pDataStorage 0x0000000014A4CD50 
' 4:< SLOG $1de94fdf 2016-08-22 20:30:13.434 .WSD:LockRoot  R SCODE=0x80070035 
' 3:< initTransactionStatus unable to refresh permissions 
' 3:< DataStorageInterface destroyed 0x0000000014A4CD50 
**' 3:<  0 ModelServerState "Destroyed": Current server = "Not Queried", Model server = "", Model server state = "Not Applicable" 
'  2.407079=== 2:<<MFCProjectAgent::getWorksetConfigForLoading 'Specify' = askUser 
' 1:<  System.FormatException exception(Index (zero based) must be greater than or equal to zero and less than the size of the argument list.) was thrown from a handler of Idling event. The API event handler was registered by application Application RevitCommandListener (acf561d2-8c6c-4beb-be55-2346825b53a4). Changes made by this handler are going to be discarded. 
' 0:< The Idling event callback used 20 seconds 

正如@Matt所建议的那样尝试下面的代码但是也没有打开文档:

OpenOptions options = new OpenOptions();
options.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;
ModelPath mdlPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(_revitFileToOpen);
uiapp.OpenAndActivateDocument(mdlPath, options, false);

1 个答案:

答案 0 :(得分:1)

所以 - 您的代码中存在某些与工作集相关的问题,并且它会绊倒您所处的闲置事件回调。

那说 - 打开整个文件只是为了确定它是否是工作共享是一个非常昂贵的操作。相反,你可以打电话:

BasicFileInfo info = BasicFileInfo.Extract(filename);
if (info.IsWorkshared)...

另外 - 我认为使用OpenDetached选项调用OpenAndActivate方法可能也是有效的,即使模型不是工作共享。我相信我之前也做过。