Skip to content

mxcad_2d API 文档 / 2d / MxCADPluginSampleCode

Class: MxCADPluginSampleCode ​

2d.MxCADPluginSampleCode

MxCADPluginSampleCode 表示插件示例代码项。

Description

该类用于在插件配置或样例集中描述一段示例代码,包含所属类型、示例名称以及代码内容。 常用于文档展示、示例管理或在插件配置界面提供可复制的参考代码片段。 使用方法总结:创建实例并填充 type、name、code 字段,随后将其加入插件配置的 sampleCode 列表中。

Example

ts
import { MxCADPluginSampleCode } from "mxcad";

const sample = new MxCADPluginSampleCode();
sample.type = "drawing";
sample.name = "draw-line";
sample.code = `const id = mxcad.drawLine(0,0,100,100);`;
// 将示例加入插件配置
// plugin.sampleCode = [ sample ];

Table of contents ​

Constructors ​

Properties ​

Constructors ​

constructor ​

• new MxCADPluginSampleCode()

Properties ​

code ​

• code: string = ""

示例代码内容


name ​

• name: string = ""

示例代码在名称


type ​

• type: string = ""

示例代码在那个类型中