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:

Recommended Posts

Hello.

 

I'm writing v9 chook now

and trying to add drive surface to new operation.

all surfaces are selected with SELECT_BIT.

but when I called code below,

selected surfaces are added as check surface...not drive surf... confused.gif

 

any idea?

 

Thank you

code:

	surface_manager (

op.op_idn, // I: operation id to edit

&chains, // IO: ptr to list of chains if using SRFMGR_CHN_***

SRFMGR_SRF_ADD, // I: what you want to do

1, // I: 0=drive & check, 1=drive, 2=check

&succf); // O: TRUE = everything went ok

(Instead, I'm using SRFMGR_SRF_SEL&&sending key event to main window.. mmmmm)

Link to comment
Share on other sites

Never used the function myself. I'm assuming you already tried calling with 0 or 2 instead of one.

 

0=drive & check looks like you can designate a surf as check or drive. So shooting in the dark try flipping other sel bits. I'd try

#define TEMP_BIT 0x40 /* bit 6 */

first.

Link to comment
Share on other sites
  • 3 months later...

MasterShake (or anybody else),

 

what is CHAIN **chns argument in the surface_manager function? In my case I have got the operation and the trimmed surface, so what do I pass? The comment next to the argument leads me to believe that I should pass chains only if I am using one of the SRFMGR_CHN_* "modes", but what to use with SRFMGR_SRF_ values?

Link to comment
Share on other sites

hello

I think CHAIN **chns argument is boundary chain.

when you add a chain to operation ,try SRFMGR_CHN_ADD.

 

 

adding a surface to an operation...

code:

 

 

//set SELECT_BIT or select by select_ents

e.id=SURF_ID;

store_ent (&e, &e_ptr, ALIVE_BIT, main_color, main_level, main_attrib, &succf);

 

sel_bit_turn_on (&e, SELECT_BIT);

rewrite_ent(&e);

 

surface_manager (

op.op_idn, // I: operation id to edit

NULL, // IO: ptr to list of chains if using SRFMGR_CHN_***

SRFMGR_SRF_ADD, // I: what you want to do

1, // I: 0=drive & check, 1=drive, 2=check

&succf); // O: TRUE = everything went ok

 

 


Link to comment
Share on other sites

No, it does not work for me. Here is the complete source, I ran it on the geometry with couple of surfaces and one operation already set up. The surface is not added to the operation after the C-hook executes.

code:

extern "C" __declspec(dllexport) int m_main(int not_used) {

DB_LIST_ENT_PTR eptr;

MC_BOOL succf;

p_2d sel_pt;

double t[2];

ent srf;

select_ent("Select surface",//LPCTSTR cs,

&srf, //ent * entity,

&eptr,//DB_LIST_ENT_PTR * eptr,

sel_pt,

t,

ALIVE_BIT,//short smask,

SURF_ID,//long emask,

RED,//int s_color,

&succf

);

if (succf)

MessageBox (NULL, "Selected", "Test", MB_OK);

 

op_list *op_head = 0;

list_manager(OP_ID, "", LSTMGR_GET, (void**)&op_head);

if (!op_head || op_head->next_ptr) {

MessageBox (NULL, "No or more that one operations", "Test", MB_OK);

return MC_NOERROR | MC_UNLOADAPP;

}

 

surface_manager (

op_head->op.op_idn, // I: operation id to edit

NULL, // IO: ptr to list of chains if using SRFMGR_CHN_***

SRFMGR_SRF_ADD, // I: what you want to do

1, // I: 0=drive & check, 1=drive, 2=check

&succf); // O: TRUE = everything went ok

MessageBox (NULL, succf? "Add OK": "Add failed", "Test", MB_OK);

return MC_NOERROR | MC_UNLOADAPP;

}

Link to comment
Share on other sites

it seems that select_ent does not set SELECT_BIT..

 

 

code:

 

 

if (succf)

MessageBox (NULL, "Selected", "Test", MB_OK);

sel_bit_turn_on (&srf, SELECT_BIT);

rewrite_ent(&srf);

operation op;

operation_manager(&op, OPMGR_GET_FIRST_LIST, &eptr, &succf);

surface_manager (

op.op_idn, // I: operation id to edit

NULL, // IO: ptr to list of chains if using SRFMGR_CHN_***

SRFMGR_SRF_ADD, // I: what you want to do

1, // I: 0=drive & check, 1=drive, 2=check

&succf); // O: TRUE = everything went ok

MessageBox (NULL, succf? "Add OK": "Add failed", "Test", MB_OK);

 


or use SRFMGR_SRF_SEL

code:

 

 

 

extern "C" __declspec(dllexport) int m_main(int not_used)

{

DB_LIST_ENT_PTR eptr;

MC_BOOL succf;

operation op;

operation_manager(&op, OPMGR_GET_FIRST_LIST, &eptr, &succf);

surface_manager (

op.op_idn, // I: operation id to edit

NULL, // IO: ptr to list of chains if using SRFMGR_CHN_***

SRFMGR_SRF_SEL, // I: what you want to do

1, // I: 0=drive & check, 1=drive, 2=check

&succf); // O: TRUE = everything went ok

MessageBox (NULL, succf? "Add OK": "Add failed", "Test", MB_OK);

return MC_NOERROR | MC_UNLOADAPP;

}


Link to comment
Share on other sites
  • 1 month later...

Let's add a couple of calls to the above program:

code:

chain_1("Boundaries",  &chains);

surface_manager(op_head->op.op_idn, &chains, SRFMGR_CHN_ADD, 0, &succf);

When the C-hook terminates, I only see the surface in the operation manager, and not the boundary. But there is something even more interesting: if I save the MCX file, and reload it again, I can see both the surface and the chain in the operation manager.

 

This means that I need somehow to refresh the content of the operation manager, but I do not know how. Any ideas?

 

Marko

Link to comment
Share on other sites

.. flame.gif

 

I thought SRFMGR_CHN_ADD is to add the bounday chain.. but it seems not...

 

chain manager worked for me anyway.

 

code:

	chain_manager_info cmi;

memset (&cmi, 0, sizeof (chain_manager_info));

cmi.op_idn = op.op_idn;

cmi.mode = CHNMGR_ADD;

chain_manager (&cmi, TP_CHN_TCB, &succf);

SRFMGR_CHN_ADD may be used for adding swarf toolpath chain or something... just a guess

 

 

And undocumented refresh functions.. banghead.gif

extern DllImpExp group_list * OMrefreshGroup(long a0,char a1);

extern DllImpExp int OMrefreshOpManTree(void);

extern DllImpExp op_list * OMrefreshOperation(long a0,char a1);

Link to comment
Share on other sites

Hi MasterShake,

 

I'm interested in those functions.

>extern DllImpExp group_list * OMrefreshGroup(long a0,char a1);

>extern DllImpExp int OMrefreshOpManTree(void);

>extern DllImpExp op_list * OMrefreshOperation(long a0,char a1);

 

In which header are those functions written?

I wasn't able to find those...

confused.gif

 

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

Kaoru Naruse

Link to comment
Share on other sites

MasterShake,

 

OMrefreshOpManTree did not work, and the same applies to OMrefreshOperation, although I passed 0 for the second argument, not knowing a better value. I did not try the third refresh function.

 

Your chain_manager trick does work, but it does not apply to my case. In the sample code I presented here I used chain_1 function, but that is just for the sake of question simplicity. In the reality, I am building the chain myself from within the C-hook, so I need to know how to add an already defined chain as a boundary to the surface operation.

 

Marko

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