Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

C-Hooks and VB


Guest
 Share

Recommended Posts

OK, I see all of this information traveling around in the developers forum my curiousity has been piqued.

 

How automated can all of this stuff really make Mastercam?

 

If there is such a time savings why does it appear that it is a major minority of users who are using them?

 

What can you do, what are people doing with them?

Link to comment
Share on other sites

quote:

If there is such a time savings why does it appear that it is a major minority of users who are using them?

John, I would guess that most people don't know how to use it, myself included. I've attempted to write chooks by trying to understand what's going on in some existing ones. Since I have no code writing background, it doesn't take long and I'm bleeding from the ears. biggrin.gif

 

Thad

Link to comment
Share on other sites

Hi John,

 

We use the VB scripts quite a bit to automate certain tasks that we do quite often. We also use Chooks/NetHooks for more advanced features. Here are some examples of the types of VBScripts we run:

 

Documents - We have several VB Scripts that generate setup sheets in Microsoft Word. The advantage to this is that we get to place data and graphics exactly where we want them. When the script runs, the user is prompted with a series of dialog boxes that they can input data in. Then the Script builds a Word document and populates the fields.

 

Dovetails - We have a script that creates a geometric pattern on lines of a certain length. We seperate the lines onto a level, run the script and it creates our geometry.

 

Table Grid - We have a script that creates a grid of points in Mastercam that represents the tooling pin locations on our table. We create these points for our setup documents.

 

CHooks/NetHooks would be used for more advanced applications. ProDrill, ATP, and the Zip to Go utility are all good examples of the functionality that can be added by a Hook.

 

The only real limitation to using a CHook or NetHook is your level of computer programming experience and your knowledge of the programming language you are using. Visual Basic is probably the easiest to get started with. The nice thing about a VB script is that you don't have to complile anything. Just create the script and run it. VB does have more limitations as to what functions you can use with Mastercam though.

 

If you are interested in learning VB you should check out:

 

"Microsoft Visual Basic .NET Step by Step"

By Michael Halvorson, Published by Microsoft Press

 

Its a great tutorial/reference and it starts at the very beginning (which is where I'm at). I'm about half way through the book and its really opening my eyes. Very easy to understand and there are no typos at all. The other language I would like to start learning is "C" because that is what the MP Post language is based on. Learning "C" would really add to anyone's post knowledge.

 

HTH,

 

Colin Gilchrist

IRC NC Programming

The Boeing Company

Link to comment
Share on other sites
Guest SAIPEM

It would be really nice if CNC Software would completely Open the API via COM and implemented VBA from Microsoft.

 

Even with the advent of .Net, true ANSI C++ and COM will be around for along time to come.

 

Since Version X is a true Windows App, it would sure be nice to have the MS VBA IDE for writing utilities.

 

The Mastercam implementation of VBScript isn't complete as certain VBScript functions and most Mastercam Classes aren't supported at all.

 

Using C and the Watcom compiler takes far longer to develop utilities than using VBA.

Link to comment
Share on other sites

quote:

How automated can all of this stuff really make Mastercam?

a lot. I've seen chooks eliminate hours off of individual steels and days off of entire designs. On both the toolpathing and design side of things.

quote:

If there is such a time savings why does it appear that it is a major minority of users who are using them?

Well for one writing a chook requires a knowledgeable programmer. Also Mastercams sdk, while getting better, is still a mess. The full api is missing and the documentation is spotty or outright missing is places. Also given the variation in industries, individuals, and companies it is nearly impossible to write a general 'program' that would be effective for everybody or even a small subset. Each program or chook has to be customized for each customer's need. Think custom postprocessor but a hundred times worse.

 

quote:

What can you do, what are people doing with them?

Tweaking mastercam. Automatic toolpathing is a biggie. Automatically generating 'parts' from a variable list is another. Since a chook is just a program it can combined with any other kind of software. Scripting languages, web servers, data bases, tracking software, accounting software, simulation, etc. It's just data it can be exported, imported, created, processed, formated, saved, loaded, modified, etc. Just limited by your needs, mastecams api, and the programmers ability.

 

Bryan smile.gif

Link to comment
Share on other sites

Hello

I made some tweaker chook/shell extension dlls for fun.

 

can anybody here try my chooks,

and see if they run with no problems under english OS?

 

I dont have english version of Windows XP.

 

Thanks in advance.

 

 

AI_Utility_1_00_en.exe will install following files.

 

Shell extension dlls under system32

Ai_MCXPreview.dll

.mcx file thumbnail preview in explorer

Ai_McxViewerExt.dll

.mcx file thumbnail preview in right-click popup menu.

 

Chook dlls under c:mcamxchooks folder.

Ai_XMenu.dll

V9 like menu. You have to edit Ai_XMenu.txt as you like.

to run it, click the top/left corner of operation manager.(Xmenu toggle to switch on/off)

 

Ai_KeyEvent.dll

this chook is called by Ai_XMenu.dll.

it have FT commands to send Key stroke event to Mastercam window,

and commads to pressing Ribbon bar buttons.

 

Ai_bkcolor.dll

this chook have a lot of features.

operation manager's background color changer by mouse middle button menu.

gradient colored menu.(if you use XP and your menu color setting is white, it looks white...not gradient)

display clock at ribbon bar.

advanced calculator (it calculates formula like (sin(60)*10+25)/100 )

to switch spinning/panning ,press Middle click+Right click.

to zoom in/out,press ctrl+shift with mouse move up/down

to rotate about Z-axis,press ctrl+alt with mouse move left/right

FT commands to rotation about X,Y or Z axis.

FT command to Copy Screen image to clipboard with white background.

 

 

Ai_backupcpy.dll

redo/undo like backup file chook.

read help file for detail.

 

Please read this before downlaod.

 

WARRANTY DISCLAIMER AND COPYRIGHT NOTICE

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, WE MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE

Copyright © 2006 by Ai Solutions co.,ltd. All Rights Reserved

 

http://www.ai-sols.co.jp/eng/download/AI_Utility_1_00_en.exe smile.gif

 

http://www.ai-sols.co.jp/eng/index_eng.htm

Link to comment
Share on other sites

It seems all you need is some imagination and knowledge of what you what to automate. I have a Idea for a tool that will help my company a great deal but am struggling with the language very much. I have the GUI designed and the flow of the program drafted out but am having a hard time with C++ putting it to a working program. I'm hoping to start some classes soon. I'm kind of curious are you guys that are writing hook's machinist's or are your skills in computers helping the machinist's? I see some very bright people in the developer forum and alot of people like me (Very glad there are helpfull people in there).

Link to comment
Share on other sites

MasterShake,

 

Could you give more instructions on how to access the following features:

 

1. Advanced Calculator

 

2. FT commands to rotation about X,Y or Z axis.

 

3. FT command to Copy Screen image to clipboard with white background.

 

 

Also, I don't understand what Ai_KeyEvent.dll does or how to use it.

 

I really like the panning using click scroll and RMB at the same time (just like UG). I also like how I can change the zoom wheel speed. VERY NICE!

 

Nice work!

 

Thad

 

[ 08-30-2006, 10:38 AM: Message edited by: Thad ]

Link to comment
Share on other sites

OK, more instruction

1. Advanced Calculator

How to use?

1)run from toolbar icon/keymaping

go to setting->custamize/keymap->category='Ai Solutions',

and select calculator button, and put it on toolbar or assign it to some key.

 

supported functions are as follows

PI

ABS()

SQRT()

LN()

LOG()

EXP()

SIN()

COS()

TAN()

COT()

ARCSIN()

ARCCOS()

ARCTAN()

SINH()

COSH()

TANH()

ARSINH()

ARCOSH()

ARTANH()

INT()

RAD()

DEG()

DMS()

 

used angle format is in degrees not radians.

 

when you run it,small edit control popups.

for example, input text "sin(30)*10" and press enter key.

it will return 5.0. because sin(30)=0.5, and 0.5*10=5.0 ...

 

2^3 = 8 = 2*2*2

 

returned value is copyed to clipboard.

 

2)run in existing edit control...

Mastercam can also do calculation like "(5*3)*2",

but you cant use functions like sin(),cos(),atan()..

for example, if you want sin(),cos() functions, input text "=sin(30)*10" and press enter key.

it will return 5.0.

you need prefix '=' like excel function..

 

 

2. FT commands to rotation about X,Y or Z axis.

3. FT command to Copy Screen image to clipboard with white background.

1)run from toolbar icon/keymaping

go to setting->custamize/keymap->category='Ai Solutions', and you will find icons.

 

 

You can also right click on our company logo to call the dialog of ai_bkcolor.dll..

left click to go to our web site.

 

 

Ai_KeyEvent.dll.. it's hard to explain..

It is something like virtual keyboard.

 

Go to setting->custamize/keymap->category='KeyEvent',

You will find a lot of VK_.... icons, VK=Virtual Key Codes.

for example, Go to right mouse button menu.

and add VK_RETURN_ESCAPE and VK_ESCAPE to right mouse button menu. on click OK button.

 

and click right mouse button to popup menu,and click VK_ESCAPE,

it is the same thing to press ESC key in keyboard.

 

However, KeyEvent chook will be called by XMenu chook,

when you open Ai_XMenu.txt, you will see these lines around line #80..

 

sketcher_trim_1 is Trim/Break button,

and KeyEvent EVENT_RB_4 is clicking button #4.

when you click Trim1 in XMenu, 'Trim 1 entity' button is already clicked..

 

 

BEGIN COMMAND Trim1

Mastercam sketcher_trim_1

KeyEvent EVENT_RB_4

END

 

BEGIN COMMAND Trim2

Mastercam sketcher_trim_1

KeyEvent EVENT_RB_5

END

 

 

charactor '&' is hotkey prefix.

when you press 'O', FT command "Mastercam OnFileOpen" will be excuted.

 

BEGIN MENU Test

">Menu&2" MENU Menu2

">Menu&3" MENU Menu3

">Menu&4" MENU Menu4

"&Line" Mastercam sketcher_line_1

"&Open" Mastercam OnFileOpen

"Trim1" COMMAND Trim1

"Trim2" COMMAND Trim2

"Trim3" COMMAND Trim3

"Trim Divide" COMMAND TrimDivide

"Trim to point" COMMAND TrimToPt

END

 

XMenu can run from clicking the top/left corner of operation manager..

 

..

Can I sleep now? it's already 8/31 0:00 AM..

 

and I have a questions, Are all dialog's texts in english under english OS?

and tell me when you find bugs...

 

thanks and sorry for my poor english and good night and see you later..

 

P.S.

I forgot to say these chooks are for MR2.

and they may work under MR1 or X2..

Link to comment
Share on other sites

MasterShake,

 

Very good job on the Chooks. I really like the Zoom/Rotate/Pan functionality. The only thing I would like to see changed would be the ability for the "Rotate about Z function" (Ctrl + Alt) to use the Z axis of the current system WCS. Right now it rotates about the system Z axis origin. Thank you for the free utilities. I think they will be used more at my work than the X+ utilities (Sorry Gunther, X+ is still cool!). I really like the ablilty to customize the "AI X menu". Very Handy. Is there a way to setup keyboard shortcuts for the functions listed on the AI X menu? That would be really nice.

 

Thank you,

 

Colin Gilchrist

The Boeing Company

Link to comment
Share on other sites

The other thing that would be really nice for your Zoom utlitity would be the ablility to zoom in/out from the mouse pointer location on the screen. This is the same functionality that the center scroll wheel currently has in X. Right now your Ctrl + Shift function zooms in/out from the screen center.

 

Thank you,

 

Colin Gilchrist

The Boeing Company

Link to comment
Share on other sites

hi

quote:

Yes.

 

Thad

Thank you. Thad

I was wondering if that works or not.

 

quote:

Is there a way to setup keyboard shortcuts for the functions listed on the AI X menu? That would be really nice.

yes, assign the black Xmenu icon to a some key.

and open Ai_XMenu.txt

add a character '&' in menu text,

and the following character is shortcut key.

 

when you press 'M', the menu "Menu name1" will popup.

 

BEGIN MENU "Menu name0"

"&Menu text1" MENU "Menu name1"

"M&enu text2" MENU "Menu name2"

"Meν text3" APPLICATION FUNCTION

"Men&u text4" COMMAND "Command name1"

END

 

BEGIN COMMAND "Command name1"

APPLICATION FUNCTION1

APPLICATION FUNCTION2

APPLICATION FUNCTION3

APPLICATION FUNCTION4

END

 

if you want to add more new chook functions,

open *.ft file and find text APPLICATION and FUNCTION for Application name and function name..

Link to comment
Share on other sites

Thanks MasterShake, This is going to be great. I'm going to have to buy Resource Tuner so I can create custom icon images for some of the "Key Event" generic buttons. I can see these options being very handy. Thank you for the quick response.

 

Did you see my question above about rotating about the current WCS and using Cursor placement for the Zoom In/Out functionality?

 

Again, Thank you.

 

Colin Gilchrist

The Boeing Company

Link to comment
Share on other sites

I'd like to make a request also. While it's perfectly logical for you to have a link to your website by clicking on your logo, being a US resident, it would be more useful for me if it would link to this forum. smile.gif I hope that doesn't sound too dumb.

 

Thad

Link to comment
Share on other sites

If you try to relocate the AI tool bar, the tool bar disappears, then MCX starts acting real bad, lagging hard and once to the point I had to do a hard reset.

Maybe it's just my system?

I would like to see the Ai tool bar be able to be modified, as it takes up too much empty space for me.

 

I do really like the Rotate Pan modification from a millturn side. Anyway to add this to my system as a stand alone?

 

To slightly highjack this thread I was wondering if anyone has been able to get the C-View C-hook that worked so nicely in V9 to work in X.

Link to comment
Share on other sites

HI

I did some update to my chook, as you requested.

 

 

ftp://mastercam:[email protected]/Ma...ity_1_00_en.exe

 

quote:

Did you see my question above about rotating about the current WCS

This request seems hard to accomplish, I need more time to think of it.

Pease wait for a while...

 

 

I don't have the right to modify the file on our web site right now..

So, I put it on cadcam's ftp..

I will update the file on our web site next week.

 

thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...