From: S-Y. Chen on

Dear All,

I am trying to control some CAD package through Tcl. The painful
thing is that, I have to control the CAD (only) through GUI.

What I need to do is actually fairly simple (for a human beings)

1. Launch a CAD in Tcl/tk
2. File > Open to Load a file into the CAD
3. Find out some specific items in one of the panels
4. Right-click the mouse on 3, which will pop-up a menu. Left-Click on
some specific item on the pull-down menu (which will bring up another
dialog box)
5. input/change parameters at the dialog box from 4.
6. close the dialog box. This will make some change to the model.
7. Save, or export, the CAD model into a new file. Some time-consuming
task may be done here, which will take some time.
8. Wait until 7 is done, exit the CAD
9. Return control to Tcl/Tk

I think TWAPI may be able to do that. However I can not find any
similar examples on its web site.

Can anyone point me to the correct direction here ?

Thanks in advance for any help.

Regards
S-Y. Chen







From: Harald Oehlmann on
On 11 Dez., 06:42, "S-Y. Chen" <shenyeh_c...(a)hotmail.com> wrote:
>  I am trying to control some CAD package through Tcl. The painful
> thing is that, I have to control the CAD (only) through GUI.
>
>  What I need to do is actually fairly simple (for a human beings)
>
> 1. Launch a CAD in Tcl/tk
> 2. File > Open to Load a file into the CAD
> 3. Find out some specific items in one of the panels
> 4. Right-click the mouse on 3, which will pop-up a menu. Left-Click on
> some specific item on the pull-down menu (which will bring up another
> dialog box)
> 5. input/change parameters at the dialog box from 4.
> 6. close the dialog box. This will make some change to the model.
> 7. Save, or export, the CAD model into a new file. Some time-consuming
> task may be done here, which will take some time.
> 8. Wait until 7 is done, exit the CAD
> 9. Return control to Tcl/Tk
>
> I think TWAPI may be able to do that. However I can not find any
> similar examples on its web site.

Hi S-Y. Chen,
IMHO this might be a very difficult task in general.

- Start the CAD using exec
- (use TWAPI to check if the main window is up)
- Send keys to CAD using TWAPI
- send mause clicks to CAD using TWAPI if they are at fix positions
(relative to a window at least).

- your point 3 seams to be very tough:
"3. Find out some specific items in one of the panels"
Is there a list on the screen which sould be read ?
Should someone do a screen shot - read what is on and decide or click
oin function of the contents ?
This is tough... Eventually, there is a special tool which does that.
If it is a standard windows control, one may read the contents for
example of a drop-down box by windows messages, but this is expert
work....

Hope this helps,
Harald
From: S-Y. Chen on
On Dec 11, 9:43 pm, Harald Oehlmann <wortka...(a)yahoo.de> wrote:
> On 11 Dez., 06:42, "S-Y. Chen" <shenyeh_c...(a)hotmail.com> wrote:
>
>
>
> >  I am trying to control some CAD package through Tcl. The painful
> > thing is that, I have to control the CAD (only) through GUI.
>
> >  What I need to do is actually fairly simple (for a human beings)
>
> > 1. Launch a CAD in Tcl/tk
> > 2. File > Open to Load a file into the CAD
> > 3. Find out some specific items in one of the panels
> > 4. Right-click the mouse on 3, which will pop-up a menu. Left-Click on
> > some specific item on the pull-down menu (which will bring up another
> > dialog box)
> > 5. input/change parameters at the dialog box from 4.
> > 6. close the dialog box. This will make some change to the model.
> > 7. Save, or export, the CAD model into a new file. Some time-consuming
> > task may be done here, which will take some time.
> > 8. Wait until 7 is done, exit the CAD
> > 9. Return control to Tcl/Tk
>
> > I think TWAPI may be able to do that. However I can not find any
> > similar examples on its web site.
>
> Hi S-Y. Chen,
> IMHO this might be a very difficult task in general.
>
> - Start the CAD using exec
> - (use TWAPI to check if the main window is up)
> - Send keys to CAD using TWAPI
> - send mause clicks to CAD using TWAPI if they are at fix positions
> (relative to a window at least).
>
> - your point 3 seams to be very tough:
>   "3. Find out some specific items in one of the panels"
> Is there a list on the screen which sould be read ?
> Should someone do a screen shot - read what is on and decide or click
> oin function of the contents ?
> This is tough... Eventually, there is a special tool which does that.
> If it is a standard windows control, one may read the contents for
> example of a drop-down box by windows messages, but this is expert
> work....
>
> Hope this helps,
> Harald

Thanks Harald.


There is a list of object on the "tree", and we know which one to get.
But, pointing to a screen position will not be a good solution,
because it may change from machine to machine.


So, you said there is a special tool which does that. Can you tell
which one it is ?


Regards
S-Y. Chen
From: oc_forums on
On 11 déc, 16:09, "S-Y. Chen" <shenyeh_c...(a)hotmail.com> wrote:
> On Dec 11, 9:43 pm, Harald Oehlmann <wortka...(a)yahoo.de> wrote:

>
> > >  I am trying to control some CAD package through Tcl. The painful
> > > thing is that, I have to control the CAD (only) through GUI.
>

Hello,

Does it have a COM exposition ? In that case you may have a look at :
http://wfr.tcl.tk/1012
where there is some examples using tcom extension (Autocad, Catia,...)
or see http://wiki.tcl.tk/13429
If so, you may have access to the "tree" directly ?

Olivier.
From: S-Y. Chen on
On Dec 12, 3:05 am, oc_forums <oliviercolin...(a)gmail.com> wrote:
> On 11 déc, 16:09, "S-Y. Chen" <shenyeh_c...(a)hotmail.com> wrote:
>
> > On Dec 11, 9:43 pm, Harald Oehlmann <wortka...(a)yahoo.de> wrote:
>
> > > >  I am trying to control some CAD package through Tcl. The painful
> > > > thing is that, I have to control the CAD (only) through GUI.
>
> Hello,
>
> Does it have a COM exposition ? In that case you may have a look at :http://wfr.tcl.tk/1012
> where there is some examples using tcom extension (Autocad, Catia,...)
> or seehttp://wiki.tcl.tk/13429
> If so, you may have access to the "tree" directly ?
>
> Olivier.

Unfortunately, some of them have COM, but some don't. A lot of these
packages (FEA, CAE,...) are written by people like me, who just want
to have a usable GUI for the users. COM is just far too complicate for
us.

I am thinking that, if there is a more systematic way in TWAPI to
invoke the simple actions like Clicking on File > Save as , or
something on the pull-down menu, without having to actually move the
mouse. I have been looking into AutoIt, but then that means I have to
include AutoIt in my application too.

Any idea how can I do this in a more convenient way ?

Regards
S-Y. Chen