Page 1 of 1

Application Framework Automation

Posted: Thu Jul 11, 2013 6:29 pm
by tsears
Sales,

Can the QCAD Application Framework be accessed through a Windows application like Excel VBA?

Proposal:
We would like to measure a product and dynamically send values to the QCAD Application Framework to create a DXF drawing with the objects and position required.
For example: Draw an arc and place small objects along the arc at specific distances or angles.
Include text at various positions of the objects.

If this application is a good fit for QCAD which product is required to access this functionality?
Is there an example Excel VBA application that demonstrates this functionality?

thanks,

Ted

Re: Application Framework Automation

Posted: Thu Jul 11, 2013 6:59 pm
by andrew
Thanks for your interest in QCAD.

I have no experience with Windows specific products or technologies such as Excel or VBA but I can answer the QCAD side of the question.

To launch QCAD from another process and hand over some data, one would typically use a file (DXF, CSV, XML or any other convenient file format to transfer the data in question) or an SQL database.

To dynamically interact with QCAD from another process while QCAD is already running there are several IPC (inter process communication) mechanisms that can be employed:

Use command line arguments to trigger an event

Generally, only one QCAD process can be running at a time. Launching QCAD again if it is already running will not start QCAD again but instead pass the command line arguments to the running instance of QCAD. This can be used for a simple way of IPC. For example if QCAD is already running and you launch it again, with these arguments:

Code: Select all

qcad.exe -exec scripts/File/NewFile/NewFile.js
This will create a new drawing in the already running instance of QCAD. Instead of running this existing script to create a new drawing, any other (custom) script can be run whenever needed to do virtually anything (import a file, add an entity, perform an auto zoom, etc).

Network (TCP/IP)

Since QCAD scripts have access to the Qt API, a network server / client protocol could be used to communicate with QCAD.

Polling

A QCAD script could be used to regularly check if a file on disk has changed, a new file has been created in a specific directory for processing or importing, etc.

Plugins

A QCAD C++ plugin could be used to make any (platform specific) technology available to interact with QCAD.

Re: Application Framework Automation

Posted: Thu Jul 11, 2013 7:10 pm
by tsears
Andrew,

Please look at the following URL that describes the QCAD Application Framework and how to create a drawing document and entities.

http://www.ribbonsoft.com/doc/qcad/3.0/ ... operations

Excerpt________
With the QCAD Application Framework it is not only possible to create interactive tools but also to construct entire drawings based on user input (dialog, command line arguments, ...), mathematical formulas, data bases, files or other sources.

This tutorial focuses on creating objects with the QCAD Application Framework and adding them to a drawing document. The example in this tutorial creates a drawing document from scratch, adds various objects to it and saves the document as a DXF file. No user interface is used for this example, so it can be run as a command line application without first starting the QCAD Application user interface.

End of excerpt____________

Microsoft Excel has a development environment called VBA.
Visual Basic for Applications.

VBA programs can be used for control of other application through various mechanisms.
The code example on the ribbonsoft website looks like VBA.

Please advise,

Ted

Re: Application Framework Automation

Posted: Thu Jul 11, 2013 7:19 pm
by andrew
QCAD scripts are written in ECMAScript (JavaScript). This is not related to VBA though it might look similar.

[Edit: Please note that I've removed your identical post in 'Chat' since double-posting will lead to redundant discussions]

Re: Application Framework Automation

Posted: Thu Jul 11, 2013 7:32 pm
by tsears
Andrew,

Whatever the programming environment, the following code invokes an automation reference to the QCAD application.

// init application name:qApp.applicationName = "MyApplication";
// init DWG / DXF exporter:RDwgExporterFactory.registerFileExporter();

Could you contact the QCAD Application Framework developers and ask if the framework is compliant with Windows automation class references?

If so, every object in the framework is available to a Windows application that can open the registered reference.

If you do not have Windows automation programming experience is there a QCAD developer I can send an email to?

thanks,

Ted

Re: Application Framework Automation

Posted: Thu Jul 11, 2013 9:06 pm
by andrew
I am the main developer of QCAD. Almost all of QCAD has been developed directly by me, including the script interface.

Please understand that QCAD is a cross-platform software that works on Windows, Mac OS X and Unix systems. This means that it is using cross-platform technologies whenever possible. There is in fact very little code in QCAD that is platform dependent.

Unfortunately, I have never heard of the "Windows automation class reference" (= "Windows automation API"?). The best lead I can provide is that QCAD is developed using the Qt framework (http://www.qt-project.org). It is possible that either Qt or the Windows API provide some standard interfaces to communicate with a Qt / Windows application through the Windows automation API. However, that would not be something that has been tested or I would have any experience with.

I hope that helps.

Re: Application Framework Automation

Posted: Fri Jul 12, 2013 2:22 pm
by tsears
Hello Andrew,

Is there an ActiveX or .NET class library to access the QCAD functionality from Windows applications?
thanks,

Ted

Re: Application Framework Automation

Posted: Fri Jul 12, 2013 3:29 pm
by tsears
Hello Andrew,

The Open Design Alliance provides an API for application development.

Excerpt from the site_____

Introducing Teigha®
The development platform for creating engineering applications on Windows, Macintosh OS X & iOS, UNIX/Linux, and Android.

Teigha
C++ development environment that includes full support for .dwg/.dxf and DGN files, a powerful object-oriented C++ API, and a rich feature set for editing, manipulating and rendering CAD data. Also supports Teigha Xtensions for building custom objects and custom commands.

Teigha.NET
A set of SWIG-generated .NET wrappers that encapsulate the Teigha C++ API. Teigha.NET API class and function names are identical to the underlying C++ names, making the transition to .NET easy for Teigha C++ developers.

Hope this helps to clarify the automation concept.

Ted

Re: Application Framework Automation

Posted: Fri Jul 12, 2013 8:26 pm
by andrew
Qt offers some support for ActiveX, so this would be technically possible:
http://qt-project.org/doc/qt-4.8/active ... -framework

However, QCAD does not use any of this at this point and there are no plans to support this technology unless there would be a certain demand or sponsorship for it.