mxcad_3d API 文档 / Mx3dDbDocument
Class: Mx3dDbDocument 
文档类,继承自 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()
构造函数,用于初始化 Mx3dDbDocument 实例。
Overrides 
Methods 
abortCommand 
▸ abortCommand(): void
中止当前事务。
Returns 
void
addColorLabel 
▸ addColorLabel(theColor): Mx3dDbLabel
添加一个新的颜色标签。
Parameters 
| Name | Type | Description | 
|---|---|---|
| theColor | Mx3dGeColor | 颜色对象。 | 
Returns 
返回新增的颜色标签对象。
addShapeLabel 
▸ addShapeLabel(): Mx3dDbLabel
添加一个新的形状标签。
Returns 
返回新增的形状标签对象。
commitCommand 
▸ commitCommand(): boolean
提交当前事务。
Returns 
boolean
返回布尔值,表示是否成功提交。
getAccessLabel 
▸ getAccessLabel(): Mx3dDbLabel
获取访问入口标签。
Returns 
返回访问入口标签对象。
getColorsLabel 
▸ getColorsLabel(): Mx3dDbLabel
获取入口颜色标签。
Returns 
返回入口颜色标签对象。
getDocName 
▸ getDocName(): string
获取文档名称。
Returns 
string
返回文档名称的字符串。
getLayersLabel 
▸ getLayersLabel(): Mx3dDbLabel
获取入口图层标签。
Returns 
返回入口图层标签对象。
getShapesLabel 
▸ getShapesLabel(): Mx3dDbLabel
获取入口形状标签。
Returns 
返回入口形状标签对象。
getTopFreeLabels 
▸ getTopFreeLabels(): Mx3dDbLabel[]
获取顶级自由标签列表。
Returns 
返回顶级自由标签的数组。
getView 
▸ getView(): Mx3dView
获取视图对象。
Returns 
返回视图对象。
newCommand 
▸ newCommand(): void
开启一个事务开始。
Returns 
void
read 
▸ read(theFile, theFormat): Promise<boolean>
读取模型文件并解析为文档。
Parameters 
| Name | Type | Description | 
|---|---|---|
| theFile | File | 要读取的文件对象。 | 
| theFormat | MxFormat | 模型文件格式。 | 
Returns 
Promise<boolean>
返回一个 Promise,解析结果为布尔值,表示成功或失败。
readFile 
▸ readFile(theFilePath, theFormat): boolean
Parameters 
| Name | Type | 
|---|---|
| theFilePath | string | 
| theFormat | MxFormat | 
Returns 
boolean
redo 
▸ redo(): boolean
重做最后一个撤销的事务。
Returns 
boolean
返回布尔值,表示是否成功重做。
removeComponent 
▸ removeComponent(theLabel): void
删除指定的组件。
Parameters 
| Name | Type | Description | 
|---|---|---|
| theLabel | Mx3dDbLabel | 要删除的标签对象。 | 
Returns 
void
removeShapeLabel 
▸ removeShapeLabel(theLabel): boolean
删除指定的形状标签。
Parameters 
| Name | Type | Description | 
|---|---|---|
| theLabel | Mx3dDbLabel | 要删除的形状标签对象。 | 
Returns 
boolean
返回布尔值,表示是否成功删除。
undo 
▸ undo(): boolean
撤销最后一个记录的事务。
Returns 
boolean
返回布尔值,表示是否成功撤销。
write 
▸ write(theFilePath, theFormat): boolean
写入文档到指定路径。
Parameters 
| Name | Type | Description | 
|---|---|---|
| theFilePath | string | 文件路径。 | 
| theFormat | MxFormat | 文件格式。 | 
Returns 
boolean
返回布尔值,表示是否成功写入。