Welcome, Guest. Please login or register.
May 16, 2012, 03:07:20 pm
Home Help Search Login Register
News: When replying to a specific statement be sure to quote the previous post.

+  TurboCAD Forums
|-+  SDK Corner
| |-+  SDK General Discussion
| | |-+  Start tool...
« previous next »
Pages: [1] Go Down Print
Author Topic: Start tool...  (Read 1965 times)
ibruethsch
Jr. Member
**
Posts: 85

Bernd


« on: May 18, 2009, 11:21:34 am »

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
kchapman
Administrator
Full Member
*****
Posts: 201


« Reply #1 on: May 18, 2009, 04:37:35 pm »

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
Logged
ibruethsch
Jr. Member
**
Posts: 85

Bernd


« Reply #2 on: May 19, 2009, 12:06:58 am »

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, 01:11:41 am by ibruethsch » Logged
kchapman
Administrator
Full Member
*****
Posts: 201


« Reply #3 on: May 19, 2009, 08:10:41 am »

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
« Last Edit: May 19, 2009, 09:18:07 am by kchapman » Logged
ibruethsch
Jr. Member
**
Posts: 85

Bernd


« Reply #4 on: May 20, 2009, 01:02:22 am »

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
kchapman
Administrator
Full Member
*****
Posts: 201


« Reply #5 on: May 22, 2009, 08:06:13 am »

I have booted this up to programming for comment. I'll report back when I have more information.
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.064 seconds with 17 queries.