private static TSD.TSDDocument GetTSDDocument(bool Save) { TSD.TSDDocument aTSDDocument = null; try { object aObject = System.Runtime.InteropServices.Marshal.GetActiveObject("TSD.Document"); if (aObject != null && aObject is TSD.TSDDocument) { aTSDDocument = aObject as TSD.TSDDocument; if (Save) { aTSDDocument.save(); } aTSDDocument.close(); } } catch { } if (aTSDDocument == null) { aTSDDocument = new TSD.TSDDocument(); } return(aTSDDocument); }
/// <summary> /// Close TAS TSD Document. READ ME ============== /// Option 1 = File will be close when Dynamo is restarted /// if you use Dynamo with Revit you need to restart both /// Option 2 = when script is done and you confirmed it was saved just /// go to TaskManager and End Process for TSD.exe /// </summary> /// <param name="TSDDocument">TSD Document</param> /// <returns name="Boolean">Boolean</returns> /// <search> /// TAS, TSDDocument, tas, TSDDdocument, close tsddocument, closetsddocument /// </search> public static bool Close(TSDDocument TSDDocument) { TSDDocument.pTSDDocument.close(); TSDDocument.pTSDDocument = null; TSDDocument = null; return(true); }
public static WeatherData ToSAM_WeatherData(this TSD.TSDDocument tSDDocument, int year = 2018) { if (tSDDocument == null) { return(null); } return(ToSAM_WeatherData(tSDDocument.SimulationData, year)); }
void IDisposable.Dispose() { if (pTSDDocument != null) { if (pSave) { pTSDDocument.save(); } pTSDDocument.close(); pTSDDocument = null; } }
//Close and save the TSD Document private void CloseTsdDocument(bool save = true) { if (tsdDocument != null) { if (save == true) { tsdDocument.save(); } tsdDocument.close(); if (tsdDocument != null) { ClearCOMObject(tsdDocument); tsdDocument = null; } } }
//TODO: Do we need both of these? //To get the TSD Document private TSD.TSDDocument GetTsdDocumentReadOnly() { tsdDocument = new TSD.TSDDocument(); if (!String.IsNullOrEmpty(tsdFilePath) && System.IO.File.Exists(tsdFilePath)) { tsdDocument.openReadOnly(tsdFilePath); } else if (!String.IsNullOrEmpty(tsdFilePath)) { tsdDocument.create(tsdFilePath); //What if an existing file has the same name? } else { BH.Engine.Base.Compute.RecordError("The TSD file does not exist"); } return(tsdDocument); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { // TODO: dispose managed state (managed objects). if (tSDDocument != null) { tSDDocument.close(); Core.Modify.ReleaseCOMObject(tSDDocument); tSDDocument = null; } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposed = true; } }
public static TSD.TSDDocument TSDDocument() { TSD.TSDDocument tSDDocument = null; try { object aObject = Marshal.GetActiveObject("Document"); if (aObject != null) { tSDDocument = aObject as TSD.TSDDocument; Core.Modify.ReleaseCOMObject(aObject); tSDDocument = null; } } catch (Exception exception) { string message = exception.Message; } tSDDocument = new TSD.TSDDocument(); return(tSDDocument); }
protected override void Create() { Document = new TSD.TSDDocument(); }
private TSDDocument(TSD.TSDDocument TSDDocument, bool Save) { pSave = Save; pTSDDocument = TSDDocument; }
internal TSDDocument(string FilePath, bool Save) { pSave = Save; pTSDDocument = GetTSDDocument(Save); pTSDDocument.open(FilePath); }
/// <summary> /// Opens TAS TBD Document /// </summary> /// <param name="Path">Building Name</param> /// <returns name="TBDDocument">TBD Document</returns> /// <search> /// TAS, TBDDocument, tas, tbddocument, new tbddocument, newtbddocument /// </search> public static TSDDocument New(string Path) { TSD.TSDDocument aTSDDocument = GetTSDDocument(false); aTSDDocument.SimulationData.buildingPath = Path; return(new TSDDocument(aTSDDocument, false)); }