CadSheetSetFile
from OpenCAD2D.SheetSets import CadSheetSetFile
class CadSheetSetFile(System.Object) ยท CadSheetSetFile in the .NET reference
A sheet set data file (.dst), AutoCAD 2021's own format, opened, changed and saved. The file is UTF-8 XML under a one-byte cipher; its XML tree is kept whole in memory and the model (CadSheetSetFile.SheetSet and what hangs from it) reads and writes through that tree, so every element and property this program does not know (the sheet selections, the transmittal setups, the callout block lists, the DWF options) is saved as it was read. A set made here opens in AutoCAD and one made in AutoCAD opens here.
Properties and fields
DbFingerPrint
@property
def DbFingerPrint(self) -> str
Gets the fingerprint of the database (DbFingerPrint, a g and a GUID), which AutoCAD keeps from the day the set was made.
DbVersion
@property
def DbVersion(self) -> str
Gets the version of the format the file says it is (DbVersion); "1.1" for a set made here, as AutoCAD 2021 writes a new one.
FileRevision
@property
def FileRevision(self) -> int
Gets how many times the file has been saved (FileRevision).
Folder
@property
def Folder(self) -> str
Gets the folder of the .dst, which the relative form of every file reference in it is relative to.
HasChangedOnDisk
@property
def HasChangedOnDisk(self) -> bool
Gets whether the file's time stamp or length is not what it was when it was read or last saved here. False where the file is gone.
HoldsLock
@property
def HoldsLock(self) -> bool
Gets whether this copy holds the lock file of the set (CadSheetSetFile.OpenForEditing wrote it and CadSheetSetFile.ReleaseLock has not deleted it).
IsReadOnly
@property
def IsReadOnly(self) -> bool
Gets whether the set is read-only (CadSheetSetFile.ReadOnlyReason is not null): every CadSheetSetFile.Change is refused.
LockedBy
@property
def LockedBy(self) -> CadSheetSetLock | None
Gets the lock of another user that makes the set read-only; null where there is none, or the file was not opened with CadSheetSetFile.OpenForEditing.
Path
@property
def Path(self) -> str
Gets the full path of the .dst.
ReadOnlyReason
@property
def ReadOnlyReason(self) -> str | None
Gets why the set cannot be changed, or null where it can: the file is read-only ("The sheet set data file is read-only."), another user holds its lock ("Locked for Edit by InuYasha on INUYASHA-MEV.") or the lock file could not be written. Asked again each time, so a file made read-only after it was opened shows.
SheetSet
@property
def SheetSet(self) -> CadSheetSet
Gets the sheet set, the root of the model. It is new after every CadSheetSetFile.Change that reloads.
Methods
Change
def Change(self, edit: System.Action[CadSheetSet]) -> None
Changes the sheet set and saves it: reloads the file first where it has moved on disk, runs the edit on the (fresh) CadSheetSetFile.SheetSet, and where the edit changed anything writes the file at once and raises the CadSheetSetFile.FileRevision by one. An edit that throws, or a save that fails, leaves the file and the tree as they were and the exception goes on.
CheckLayouts
@staticmethod
def CheckLayouts(drawingFile: str) -> System.Collections.Generic.IReadOnlyList[CadSheetImportLayout]
Checks the layouts of a drawing for the wizard's Choose Layouts page, before any set is there: as CadSheetSet.CheckLayouts does for a set, without the check against its sheets.
Create
@staticmethod
def Create(path: str, name: str, description: str | None = ...) -> CadSheetSetFile
Makes an empty sheet set and saves it, as AutoCAD's New Sheet Set.dst is: no template (so a new sheet asks for one), new sheets going to the folder of the .dst, one default view category, PDF publish options asking for a name. CadSheetSetFile.DbVersion is "1.1" and CadSheetSetFile.FileRevision 1.
CreateFromDrawings
@staticmethod
def CreateFromDrawings(
path: str,
name: str,
description: str,
sources: System.Collections.Generic.IEnumerable[CadSheetImportSource],
options: CadSheetImportOptions,
) -> CadSheetSetFile
Makes a sheet set of layouts of drawings that exist, as the wizard's second route does: an empty set, then the layouts of each source imported as sheets in the order given (with the set marks written into the drawings), into subsets made from the folders where the options say so. Nothing is left behind where an import is refused: the .dst is deleted again (drawings already marked keep a mark that names a set that is not there).
CreateFromExample
@staticmethod
def CreateFromExample(
path: str,
name: str,
description: str,
examplePath: str,
createFolderHierarchy: bool,
) -> CadSheetSetFile
Makes a sheet set from an example, as the wizard's first route does: the example's organisation and settings are kept (its subsets, nested as they are, its custom properties, sheet creation template and folder, publish options, view categories and the parts this program does not model) and its sheets are left out. Every part has an ID of its own, every file the example names is named again relative to the new .dst, a folder that was the example's own folder becomes the new one, and the file is saved with CadSheetSetFile.DbVersion "1.1" and CadSheetSetFile.FileRevision 1.
Open
@staticmethod
def Open(path: str) -> CadSheetSetFile
Reads a sheet set data file.
OpenForEditing
@staticmethod
def OpenForEditing(path: str) -> CadSheetSetFile
Opens a sheet set data file as the Sheet Set Manager does to work in it (D21): the file is read, and the lock file beside it is looked at. A set whose file is read-only, or whose lock is another user's, opens read-only (CadSheetSetFile.IsReadOnly, CadSheetSetFile.LockedBy) and no lock file is written. Otherwise this user takes the lock: the .DBL file is written (CadSheetSetLock) and stays until CadSheetSetFile.ReleaseLock. A folder the lock file cannot be written in makes the set read-only too.
ReleaseLock
def ReleaseLock(self) -> None
Lets go of the lock the set was opened with (CadSheetSetFile.OpenForEditing): the lock file is deleted. Does nothing where this copy holds none.
ReloadIfChanged
def ReloadIfChanged(self) -> bool
Reloads the file where its time stamp or length has moved since it was read or last saved here.