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:

entity mask for chaining


Recommended Posts

hello members,

 

I have a problem with porting a c-hook to Mastercam X(1,2,3,4), original written for Mastercam V9.

 

Everything is running well, but one function does not work. In VC 6.0 for Mastercam V9 I used a function to set the selection-mask, that the user can only select defined entities.

The code looks like these:

 

chain_use_ent_mask=TRUE; // yes, use selection mask

chain_ent_mask=134; //only lines, arcs and splines are allowed to select

 

In Mastercam X(1,2,3,4) SDK-help I cannot find this function and I've searched this forum and tried some weeks to find a solution but without success.

 

Perhaps somebody here can help and give me a short sample, what I have to do in C++ (I use VS2010) to get this chaining mask working.

 

thank you in advance

Karsten

Link to comment
Share on other sites

You (your CHook) is setting the mask and then you Chain how?

The users selects or...?

 

BTW, If you compile your CHook with the VS 2010 it may or may not work.

VS 2010 is not officially supported for X5.

(Though it will be the required setup for X6)

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

Visual Studio Requirements for X5

For X5, you must compile CHooks using the C++ Compiler included with VS 2008.

You cannot create CHooks with the “Express” version of Visual Studio as it does not have the required MFC support.

*This is no different than in X4.*

Now with Visual Studio 2010 out we are getting the question: “Can I use VS 2010 for building CHooks?”

No, not really, but…

You can use VS 2010 as your IDE and still build using the VS 2008 compiler.

* You must have both VS 2008 and VS 2010 installed on your system.

* You must be sure to set the “Platform Toolset” on your CHook project to v90.

After you have loaded your VS 2008 Solution into VS 2010 and allowed the Visual Studio Project Wizard to update you project,

you must reset the Platform Toolset, as the update wizard will have set it to v100.

In order to access the Platform Toolset, open the properties for your project and select the Configuration Properties | General node of the tree.

You'll notice the Platform Toolset option is set to v100 by default, which is the product version of Visual Studio 2010.

You must set to build your CHook with the Visual Studio 2008 tools, so change the drop-down to v90.

How to: Modify the Target Framework and Platform Toolset

VSPlatformToolSet.png

Please note that the CHook Wizard included with the X5 SDK does not support VS 2010, but you can still run the CHook Wizard under VS 2008

and then open and update your project in VS 2010.

* Just be sure to set the Platform Toolset to v90! *

Link to comment
Share on other sites

Hi Roger,

 

thank you for your reply.

 

My Mazatrol-C-hook is build with VS2010pro since May 2010 and it is running well in X2/X3/X4 and in X5Beta also. Formerly I have used VS2008pro and VS2005pro for X2/3/4. VS2003pro I used only for X1, which I don't want support anymore.

 

But the problem I have is in all versions the same. I don't get a function to set selection-mask working.

 

I have some mfc-dialogs to choose some options and then the user have to select the geometry for chaining, because I need the coordinates. In this function I want to allow the user only to select geometry I want, for instance, if in the dialogs the option drilling is chosen, then the user should only be allowed to select points or arcs for geometry.

 

In VS6 for Mastercam V9 I used following code:

 

chain_use_ent_mask=TRUE; // yes, use selection mask

chain_ent_mask=5; // only points and arcs are allowed

 

then in Mastercam V9 the user can select only points or arcs, no lines, splines or other things.

 

This selection-mask setting is not working in Mastercam X and above. In the SDK-Help I cannot find the command "chain_use_ent_mask" or something like that. Is there a possibility to do a similiar thing in the chaining dialog from Mastercam X like in V9? When yes, can you give me a small codesample please, how I have to do.

 

thanks in advance

Karsten

Link to comment
Share on other sites

Hi Roger,

 

the code for points looks like these sample:

 

short Punkte()
{
 ...
 CHAIN_ENT *ketten_elem;
 CHAIN *akt_kette,*ges_kette;
 ent entity;
 CString str;
 short succf;
 ...

// V9 code begin
 chain_use_ent_mask=TRUE; // yes use selection mask
 chain_ent_mask=5; // only pints and arcs are allowed
// V9 code end

 alloc_chain(&ges_kette,TRUE);
 {
   str = _T("Punkte");
   succf=(chain_it_point(str,&ges_kette));
   if(succf==CHAIN_OK && ges_kette!=NULL)
   {
     ...
     akt_kette=ges_kette;
     do
     {
       ketten_elem=akt_kette->start;
       do
       {
         get_ent_from_eptr(ketten_elem->e_ptr,&entity);
         switch (entity.id)
         {
           case P_ID:
           {
             ...
             break;
           }
           case A_ID:
           {
             ...
             break;
           }
           default:
           break;
         }
         ketten_elem=(ketten_elem->next);
       }
       while(ketten_elem!=NULL);
       akt_kette=(akt_kette->next);
     }
     while(akt_kette!=NULL);
     ...
   }
 }
 free_chains(&ges_kette);

// V9 code begin
 chain_ent_mask=8191; // all entities are allowed again
// V9 code end

 ...
 return(succf);
}

 

the code for contour is mostly the same, but there i use "chain_it" instead "chain_it_point". I 've taken the codesample from my original X4-code, the problem I have you can see it in V9-code remarks on start and end of my function.

I hope you understand my question.

 

thanks in advance

 

Karsten

Link to comment
Share on other sites

Karsten,

 

Thanks for the reminder.

I was looking into last Friday and...

Let's just say it was forgotten about on the Monday.

It has been a crazy week. :blink:

 

So far... It is not looking promising.

I'm still looking at this, but what I'm seeing is any settings made before the Chaining dialog is displayed are wiped out (they are reset to 'defaults' = All) when the Chaining dialog opens. The user can then open Chaining Options (sub)dialog where they can set the desired "Mask" options.

That's all well and good, but doesn't help us in this case as we cannot "inject" Entity Masking settings from the outside with our CHook.

Link to comment
Share on other sites

Hello Roger,

 

thank you for answering.

 

If the masking functionality like Mastercam V9 is not possible for the moment, then I leave my code like it is. I live since Mastercam X1 with this problem, it's ok for me.

 

I posted now and asked for a solution because a customer, which I've updated from V9 to X4, asked me about this functionality.

 

Perhaps in a future version may I get this masking work again.

 

Thank you again and have a nice week without trouble.

 

greetings

Karsten

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