TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
All posts discussing pricing or where to buy TurboCAD will be deleted.

Start tool...
Read 4380 times
* May 18, 2009, 12:21:34 PM
Hi  Kevan

Great to read that the SDK is in your focus.
I have a special question:
Is it possible to start a tool via VB?
e.g. in macrorecorder  Start "Insert|Line|Single"
or Start "Insert|Curve|Spline|ByFitPoints"

I haven’t found out how to do this in VB.

Any help is appreciated.

Bernd

Logged


* May 18, 2009, 05:37:35 PM
#1
Hi Bernd,

Are you wanting to initiate a drawing tool interactively, or draw a graphic with preset points?

If you already know the points and just want to draw the line, this example here might be helpful:
http://www3.turbocadcommunity.com/tiki-index.php?page=External+Com+VB6+Example
There's a lot of extra boilerplate here for absolute beginners, but it may help you out. See the attached ExternalCOMVB6Sample.zip

If you want to interactively collect points from the user, I think things are a bit more complicated (and I'll address that situation as soon as I have a better grasp on it.) However, there is an existing VB6 SDK example that does this with two-point lines: see the attached SDKLineTool project.


Kevan

[attachment deleted by admin]

Logged


* May 19, 2009, 01:06:58 AM
#2
Hi Kevan
With
Dim t As Tool
For Each t In Application.Tools
   Debug.Print t.CommandName
Next

You get a list like that

Tools name und ID

Tools|Architecture|T&errain|&Import 32943
Insert|Light|Ambient 32944
Insert|Light|Point 32945
Insert|Light|Directional 32946
Insert|Light|Headlight 32947
Insert|Light|Spot 32948
Insert|Light|Sky 32949
Insert|Line|Single 32950
Insert|Line|Polyline 32951
Insert|Line|Polygon 32952
….

But a code like

Application.Tools(“Insert|Line|Polyline”) .Activate
Or
Application.Tools(32952) .Activate

Is not accepted

I use the sendkeys method. But that is not reliable.
I use this when I get a drawing from someone else and want to add some dims, lines or whatever.
Then I select an item e.g a dim, hit the shortcut F9 and the vb-routine set the "normal dimstyle" to a copy from the selected item and start the Dim-Tool.
Works fine so far, but the sendkeys sometimes start the dim-tool, but sometimes start something else.

I was going thru the SDKLine and ExternalCOMVB6Sample
that is far bejond my horizont. (Classmodul and Related document and so on)
I am seeking something easy like in the macrorecorder START "Insert|Line|Single"

Bernd

P.S the macrorecorder is not a solution in this case.
Each time I start the routine in the macrorecorder I have time to get me a new coffee.
In VB or vba it takes less then a second.


« Last Edit: May 19, 2009, 02:11:41 AM by ibruethsch »

Logged


* May 19, 2009, 09:10:41 AM
#3
Great question Bernd, and I don't have the answer just yet. It seems that some of the tools can be activated from VB but many can not. I'll have to get back to you on this one. Please stand by.

EDIT: I have attached a text file listing which tools I can and cannot activate using VB. More on this as my understanding grows.

EDIT2: Hmm... Only the tools where the type is imsiSrvDisp appear to be activated in VB. The only srvdisp tool I can't start this way is in an SDK example and isn't fully implemented.

Kevan

[attachment deleted by admin]
« Last Edit: May 19, 2009, 10:18:07 AM by kchapman »

Logged


* May 20, 2009, 02:02:22 AM
#4
Hi Kevan
Thx for your efforts.
On the one hand I am happy to read that my problem is not a result of my limited knowledge.
On the other hand would be a smarter solution then “sendkeys”  be  appreciated.

Maybe a api-function bears a smarter way to start a tool?
But there again I need the support of experts like you.

Bernd

Logged


* May 22, 2009, 09:06:13 AM
#5
I have booted this up to programming for comment. I'll report back when I have more information.

Logged