[mxcad_3d API Document](../README. md)/Mx3dDbDocument
Class: Mx3dDbDocument 
Document class, inherited from Mx3dDbObject.
Hierarchy 
- ↳ - Mx3dDbDocument
Table of contents 
Constructors 
Methods 
- abortCommand
- addColorLabel
- addShapeLabel
- commitCommand
- getAccessLabel
- getColorsLabel
- getDocName
- getLayersLabel
- getShapesLabel
- getTopFreeLabels
- getView
- newCommand
- read
- readFile
- redo
- removeComponent
- removeShapeLabel
- undo
- write
Constructors 
constructor 
• new Mx3dDbDocument()
Constructor, used to initialize Mx3dDbDocument instance.
Overrides 
Methods 
abortCommand 
▸ abortCommand(): void
Suspend the current transaction.
Returns 
void
addColorLabel 
▸ addColorLabel(theColor): Mx3dDbLabel
Add a new color label.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | Color object | 
Returns 
Return the newly added color label object.
addShapeLabel 
▸ addShapeLabel(): Mx3dDbLabel
Add a new shape label.
Returns 
Return the newly added shape label object.
commitCommand 
▸ commitCommand(): boolean
Submit the current transaction.
Returns 
boolean
Return a Boolean value indicating whether the submission was successful.
getAccessLabel 
▸ getAccessLabel(): Mx3dDbLabel
Obtain the access entry tag.
Returns 
Return the access entry label object.
getColorsLabel 
▸ getColorsLabel(): Mx3dDbLabel
Obtain the entrance color label.
Returns 
Return the entry color label object.
getDocName 
▸ getDocName(): string
Get the document name.
Returns 
string
Returns a string of the document name.
getLayersLabel 
▸ getLayersLabel(): Mx3dDbLabel
Obtain the entry layer label.
Returns 
Return the entry layer label object.
getShapesLabel 
▸ getShapesLabel(): Mx3dDbLabel
Obtain the entrance shape label.
Returns 
Return the entrance shape label object.
getTopFreeLabels 
▸ getTopFreeLabels(): Mx3dDbLabel[]
Get a list of top free labels.
Returns 
Return an array of top-level free labels.
getView 
▸ getView(): Mx3dView
Retrieve the view object.
Returns 
Return the view object.
newCommand 
▸ newCommand(): void
Start a transaction.
Returns 
void
read 
▸ read(theFile, theFormat): Promise<boolean>
Read the model file and parse it into a document.
Parameters 
| Name | Type | Description | 
|---|---|---|
| theFile | [ File]( https://developer.mozilla.org/docs/Web/API/File )The file object to be read. | |
| TheFormat | [MxFormat] (../enums/MdGe. MxFormat. md) | Model file format | 
Returns 
Promise<boolean>
Return a Promise, parsed as a Boolean value, indicating success or failure.
readFile 
▸ readFile(theFilePath, theFormat): boolean
Parameters 
| Name | Type | 
|---|---|
| theFilePath | string | 
| theFormat | MxFormat | 
Returns 
boolean
redo 
▸ redo(): boolean
Redo the last revoked transaction.
Returns 
boolean
Returns a Boolean value indicating whether the redo was successful.
removeComponent 
▸ removeComponent(theLabel): void
Delete the specified component.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheLabel | [Mx3dDbLabel] (Mx3dDbLabel. md) | The label object to be deleted | 
Returns 
void
removeShapeLabel 
▸ removeShapeLabel(theLabel): boolean
Delete the specified shape label.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheLabel | [Mx3dDbLabel] (Mx3dDbLabel. md) | The shape label object to be deleted | 
Returns 
boolean
Return a Boolean value indicating whether the deletion was successful.
undo 
▸ undo(): boolean
Revoke the transaction of the last record.
Returns 
boolean
Return a Boolean value indicating whether the revocation was successful.
write 
▸ write(theFilePath, theFormat): boolean
Write the document to the specified path.
Parameters 
| Name | Type | Description | 
|---|---|---|
| The FilePath | string | file path | 
| TheFormat | [MxFormat] (../enums/MdGe. MxFormat. md) | File format | 
Returns 
boolean
Returns a Boolean value indicating whether the write was successful.