By continuing to browse this site, you are agreeing to our use of cookies.
Menu
Standard CADEditorX interface:
regsvr32 <full path to the CADEditorLib.ocx library>
For instance, to register the 64-bit version of CADEditorX in 64-bit Windows 7 execute the following:
regsvr32 "c:\Program Files\CADSoftTools\CADEditorX 11\CADEditorLib.ocx"
Please note: the CADEditorLib.ocx component is registered in the system during its installation. If you test different CADEditorX versions, it may be required to register the component manually in the system. Find out more about the Regsvr32 utility program at https://support.microsoft.com/en-us/kb/249873
The programmatic interaction with the CADEditorX control element is based on the usage of the ProcessXML function and the OnProcess event.
ProcessXML Function
The ProcessXML function is used to process XML instructions. It receives the input XML as the parameter, processes it and returns the result as XML. The XML IDE demo application includes examples of XML instructions.
Syntax:
Delphi function ProcessXML(const AInput: WideString): WideString C# public string ProcessXML(string AInput) VB.NET Public Function ProcessXML(aInput As String) As String C++ BSTR ProcessXML(BSTR AInput) JScript public function ProcessXML(AInput : String) : String
AInput is the input XML document; the return value is the XML document containing some input data.
C# example:
private void button1_Click(object sender, EventArgs e) { string command ="<?xml version =\"1.0\" encoding=\"utf-8\"?><cadsofttools version =\"2\">" + "<command text =\"HideAllInterface\"/>" + "</cadsofttools>"; Process(command); } private void Process(string arg) { string result = axSgCADEditor1.ProcessXML(arg); label1.Text = result; }
OnProcess Event
The OnProcess event is activated in the following cases:
It makes the OnProcess event useful for processing of the data returned as XML.
Syntax:
Delphi property OnProcess = procedure(ASender: TObject; const AXML: WideString) of object C# public event AxCADEditorLib.ISgCADEditorEvents_OnProcessEventHandler OnProcess public delegate void ISgCADEditorEvents_OnProcessEventHandler(object ASender,AxCADEditorLib.ISgCADEditorEvents_OnProcessEvent e) VB.NET Public Event OnProcess(ByVal aSender As Object, ByVal e As AxCADEditorLib.ISgCADEditorEvents_OnProcessEvent) C++ public IDispEventSimpleImpl<1, CCADEditorXEvents, &__uuidof(CADEditorLib::ISgCADEditorEvents)> JScript public event OnProcess(ASender : Object, AXML: String)
ASender is the control providing the data; AXML is the XML document containing the output data.
C# example:
public Form1() { InitializeComponent(); axSgCADEditor1.OnProcess += new AxCADEditorLib.ISgCADEditorEvents_OnProcessEventHandler(axSgCADEditor1_OnProcess); } private void axSgCADEditor1_OnProcess(object sender, AxCADEditorLib.ISgCADEditorEvents_OnProcessEvent e) { label2.Text = e.aXML; } private void button2_Click(object sender, EventArgs e) { string sMouseDown = "<?xml version =\"1.0\" encoding=\"UTF-8\"?><cadsofttools version =\"2\">" + "<signtoevent Event =\"OnMouseDown\" Enabled =\"True\"/>" + "</cadsofttools>"; Process(sMouseDown); // The OnMouseDown event is an internal CADEditorX event }
To implement complex tasks with the help of CAD XML API it is recommended to use an XML parser for processing of the output XML. There is a large number of XML parsers for all popular programming languages. Microsoft Windows offers the DOM technology to process XML; this technology is quite powerful but it is rather slow. Besides, there are a lot of simple and fast XML parsers that are offered as OpenSource for different programming languages.