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:

chooks examples/documentation


Recommended Posts

Hi,

 

Does anyone know of any examples for the chooks. I am able to create chook dll's but now I am struggling with the chook routines. It looks like documentation examples are non existent!!! Is anyone aware of any documentation either free or for a fee. A good book would be nice but I know there is so little chook stuff that I dont expect that. How about all of the chooks that are provided with MC?? is the source for those availble???

 

TIA,

Girus

Link to comment
Share on other sites

Sadly, there is very little in the way of C-Hook samples and documentation in the public domain. But there is this forum, which is a good place to ask questions wink.gif

 

It should be noted that examples in the VBS realm for Mastercam are very good and available. Hopefully the Net Hooks will follow suit.

Link to comment
Share on other sites

Ok, here are some of questions:

 

1. What is the easiest way to draw a line? Anyone have a good routine so that a one simple call does all of the mundane tasks.

 

2. "Job Setup" I need to do a complet job setup programmatically. The main thing is setting up the stock size, material, and feed calcs.

 

3. A simple example of creating a tool path. I am just interested in the "Contour" at this time. I dont understand how you would designate which line gets the path and how you would know in which direction it was going to travel. (basic things I just dont understand yet.)

 

That's it for now.

 

TIA.

 

Girus

Link to comment
Share on other sites

1. Here's a function to create a line:

 

code:

// Purpose: transform a line to world coordinates and save in the database

static void make_line(p_2d point1, p_2d point2, real z, byte ent_level, byte ent_colour, boolean *succf)

// I: endpoint in 2D view coordinates

// I: endpoint in 2D view coordinates

// I: depth in view coordinates

// I: level

// I: colour

// O: FALSE = error saving entity in database

{

ent entity;

p_3d pt1, pt2;

db_ptr_type d_ptr;

 

entity.id = L_ID;

entity.refs = 0;

vec_3d(point1[X], point1[Y], z, pt1);

vec_3d(point2[X], point2[Y], z, pt2);

 

view_to_world(pt1, 1, entity.u.li.e1);

view_to_world(pt2, 1, entity.u.li.e2);

store_ent(&entity, &d_ptr, 0, main_color, ent_level, ent_level, succf);

}

2. All of the variables that contain that info are in m_ncvars.h.

 

3. Non-interactively contouring arcs and lines would be a matter of looping through the database and making calls to gr_arc_mill() and gr_lin_mill() for the current entity.

Link to comment
Share on other sites

All that just for a measley line?? I saw that in the shapes example but I just though that MC would have or should have a much simpleler way.

 

I guess that is the way it has to be.

 

Do you have a small example for the Job setup. I dont know how to activate it. In other words once the structure is filled how do I sen it to MC. What routine do I call? Also my plan was to read what was already in Job setup and make a few modification and then update it.

 

How do you loop through the DB? and how do you know which line or arc you are on if you have say 20 lines and 20 arcs.?

 

Girus

Link to comment
Share on other sites

quote:

I just though that MC would have or should have a much simpleler way.

Lol. Through chooks it's usually 10x more complicated.

 

Job Setup:

Job setup is the variable job_setup in M_NCVARS.H

From struct assoc_setup defined in M_ATYPES.h

 

Bryan smile.gif

Link to comment
Share on other sites

quote:

--------------------------------------------------------------------------------

I just though that MC would have or should have a much simpleler way.

--------------------------------------------------------------------------------

LOL...

Just like Microsoft always claims to have a 'better' way...

We just haven't found it yet!!

biggrin.gif

Link to comment
Share on other sites

job_setup is a global variable just set/get as you would normal variables.

 

code:

 /* stock lengths */

job_setup.x = 5.25;

job_setup.y = 3.0;

job_setup.z = 1.0;

Also, One time, I had a small problem with the stock not immediately being drawn right after setting xyz like above and I had manualy recalculate job_setup.stock_ln myself. Don't remember why anymore it was several years ago. frown.gif

 

Bryan smile.gif

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...