[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADPluginSampleCode
Class: MxCADPluginSampleCode
2d.MxCADPluginSampleCode
MxCADPluginSampleCode represents a plugin sample code item.
Description
This class is used to describe a sample code in a plugin configuration or sample set, including its type, sample name, and code content. Commonly used for document display, example management, or providing replicable reference code snippets in plugin configuration interfaces. Summary of usage: Create an instance and fill in the 'type', 'name', and 'code' fields, then add them to the 'sampleCode' list in the plugin configuration.
Example
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);`;
//Add examples to plugin configuration
// plugin.sampleCode = [ sample ];Table of contents
Constructors
Properties
Constructors
constructor
• new MxCADPluginSampleCode()
Properties
code
• code: string = ""
Example code content
name
• name: string = ""
Example code in name
type
• type: string = ""
Which type is the sample code in
