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:

Plz Advise, C++, Script, Need more Info


Recommended Posts

I would like to put together a program that will open the view manager (WCS) allow me to select a WCS close the view manager and based on which WCS selected turn off all levels and turn on a specific level (relative to which wcs is selected) the association between WCS and level to be on can be determined ahead of time in the program or maybe even customizable from running the program if possible. Can anyone confirm wheater this can be done? And what what type of programming is easiest to do it in? The scripting looks easy but don't know if it is possible. Please give me some advise at least. I'm easily taught and very willing to learn a new programming language. Currently have no computer programing other that posts and some ideas , read a few books, nothing to tie it all together.

 

 

Thanks to anyone willing to give advice,

Chad Perkins

Link to comment
Share on other sites

It should be possible. I've done something similar in the past. Mine prompted for a level and looked for an associated view.

 

A simple way for your chook to associate the view with a level either by naming the view the same as the level. Or sticking the level(s) in the views comment.

 

Is this for V9 or X?

 

Bryan smile.gif

Link to comment
Share on other sites

Here's some code for a function for a v9 chook that should get you started. It only works for mill not design. For some reason the named_view_manager function is disabled in design.

 

It prompts the user to selects a named view icon. I don't know how to get to do a list. sorry. When I call named_view_manager with VWMGR_MENU it doesn't return a view. frown.gif

 

Sets the tool, construction, and graphic views. Then looks for and parses a list of levels in the comment section of the view.

 

comment example:

231, 240, 250

 

code:

 void my_wcs(void)

{

view_ent v;

boolean succf = FALSE;

byte new_level = 0;

char comment_copy[256];

char * comment_ptr;

int i;

 

memset (&v, 0, sizeof (view_ent));

 

/* draw named view icons and select */

named_view_manager (&v, VWMGR_SELECT, "", &succf);

if (succf == TRUE)

{

/* set system views to selected view */

named_view_manager (&v, VWMGR_CPLANE, "", &succf);

if (!succf) return;

named_view_manager (&v, VWMGR_TPLANE, "", &succf);

if (!succf) return;

named_view_manager (&v, VWMGR_GVIEW, "", &succf);

if (!succf) return;

 

/* turn off all levels */

for (i=1;i<255;i++)

vis_level
= FALSE;

 

/* does comment have levels? */

if (strlen(v.comment) > 0)

{

strcpy(comment_copy, v.comment);

 

/* parse comment */

comment_ptr = strtok(comment_copy, ",");

if (comment_ptr != NULL)

{

/* set first number as main level */

new_level = atoi(comment_ptr);

if (new_level >= 1 && new_level <= 255)

main_level = new_level;

 

/* turn on other levels */

comment_ptr = strtok(NULL, ",");

while(comment_ptr)

{

new_level = atoi(comment_ptr);

if (new_level >= 1 && new_level <= 255)

vis_level[new_level] = TRUE;

 

comment_ptr = strtok(NULL, ",");

}

}

}

 

/* make sure main level is always visible */

vis_level[main_level] = TRUE;

 

rebuild_graphics();

fit();

}

 

}

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