How to customize CADEditorX?

Discuss and ask questions about CADEditorX and XML API.

Moderators: SDS, support, admin

Post Reply
odenlou
Posts: 11
Joined: 16 Jul 2014, 23:57

How to customize CADEditorX?

Post by odenlou » 29 Jul 2014, 15:57

I don't see how to customize/interact with CADEditorX programmatically under VisualStudio 2012. For example,

1) how do I add a button and create an associated event?
2) How do I iterate through all entities?
3) How do I view attributes of a block?

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to customize CADEditorX?

Post by support » 30 Jul 2014, 14:14

Hello,

CADEditorX provides an easy-to-use API based on the XML format. Actually, an API contains a single ProcessXML() function that takes some XML string as an argument, processes it and returns some result in XML format. The input XML string contains a set of XML instructions. In order to perform some operation(s), you should include the corresponding XML instruction(s) in the input XML string.

For example, to retrieve the drawing data, you should process <get/> instruction. In other words, you need to call the CADEditorX.ProcessXML() function passing the following XML string:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <get/> 
</cadsofttools>
The ProcessXML() function will return the drawing data in XML format. Then you need to parse the output XML and extract the needed information. You don't have to iterate through the entities, <get/> instruction can extract an information about the object specified by its path in the Converter. For example, to get a block by its name, process the following XML string:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <get PathName="BLOCKS;SMOKE-DETECTOR"/>
</cadsofttools>
where BLOCKS specifies the BLOCKS section in DWG/DXF file, SMOKE-DETECTOR - the block name. The block attributes can be found in the output XML as <cstAttdef/> nodes.

Do you need to add a button to CADEditorX toolbar? What events do you need?


Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

odenlou
Posts: 11
Joined: 16 Jul 2014, 23:57

Re: How to customize CADEditorX?

Post by odenlou » 30 Jul 2014, 15:11

I will need a button called "Scan" and an event HandleScan(object sender, object data).

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to customize CADEditorX?

Post by support » 31 Jul 2014, 12:37

Hello,

It is not possible to add user-defined buttons to CADEditorX toolbars. You can create a new toolbar and add some predefined buttons to it using "Ribbon editor" dialog box (right-click on the Ribbon > Customize ribbon).


Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

sen
Posts: 20
Joined: 24 Jun 2016, 12:08

Re: How to customize CADEditorX?

Post by sen » 29 Jun 2016, 10:26

Hi, I just starting CADEditorX

Prev using CAD .Net examples is very easy.

How to:
1. Hide all toolbar/menu/etc only to show the Image only like CAD .Net ImageControl
2. How to make the Image readonly user can only see/zoom no edit
3. I'm using trial version when I click ActiveX properties nothing happen is this inteded ? or something we could do in the ActiveX properties
4. How to query the entities like in CAD .Net imagecontrol.convert, I did not find this function in popup menu axSgCADEditor1 (CADEditorX)

Share the light please

Thank
Sen

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to customize CADEditorX?

Post by support » 30 Jun 2016, 17:57

Hello Sen,

To hide all CADEditorX UI elements, use the HideAllInterface command:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<cadsofttools version="2">
  <command text="HideAllInterface"/>
</cadsofttools>
To make the loaded drawing file(s) read-only, you should switch to the Viewer mode:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <command text="Viewer"/>
</cadsofttools>
As for the ActiveX -Properties item in the control context menu which is displayed in Visual Studio designer, this item actually does nothing.

To query the entities, you need to use the XML instruction <get> which allows to extract the drawing data in the XML format:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <get/>                                                                                      
</cadsofttools>
Let's say, you want to query only LINE and TEXT entities. In this case add the corresponding entity filters to the <get> instruction:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <get>                                                           
    <cstLine/>  
    <cstText/>          
  </get>
</cadsofttools>
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

sen
Posts: 20
Joined: 24 Jun 2016, 12:08

Re: How to customize CADEditorX?

Post by sen » 01 Jul 2016, 04:56

Thank for your information.

About no.4 since using XML to interact is new to us, how to do CADImage.Convert.Entitites in CADEditorX ?

I want to get all the entities (very simple in CAD.NET), and some entities inside the block I want to change the text and color how we do this ?

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to customize CADEditorX?

Post by support » 01 Jul 2016, 18:59

Hello Sen,

To query all entities in the Model space you can use the following XML code:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
  <get PathName="BLOCKS;*MODEL_SPACE"/>
</cadsofttools>
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply