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:

Operation Group Name - am I dense ?


Recommended Posts

Ive seen this 'answered' several times, but for the life of me, I still dont see the answer.

 

I can read in all the groups for all the machines, and for all the products.

I can recurse the array of groups (in case of nested toolpath groups) and assign the proper parent/child relationships.

I can read in all the operations in all the machines, and get their associated group numbers.

 

BUT WHERE DO YOU LINK THE OP GROUP NUMBER, TO THE ARRAY OF GROUPS ?

 

There is nothing I see as far as Group Properties goes, that stores some sort of index, number, or integer, that can be used to link to the Op.GroupNumber

 

I tried reading in ALL groups for ALL machines, hoping that the INDEX of the group into the array returned from SearchManager.GetGroups() would coincide with the Op.Groupnumber

 

It MIGHT, but its only coincidence. If you happen to whip a quick test toolpath, and make everything "top down", it seems to work.

But create another group anyplace before the last group, and you're beat. Move a group around, and you're beat. GetGroups appears to return an array in the order they appear

in the OpManager, and GetOperations seems to do the same. But the Op.GroupNumber appears to reference a group in THE ORDER IT WAS CREATED. So if you move Toolpath Group 2 in front of Toolpath group 1, your numbers are not reliable.

 

Is there another way?

Link to comment
Share on other sites

rocheey1,

 

Maybe I am the dense one...

I've read your post multiple times and I am still not sure to exactly what you are trying to do.

 

BUT WHERE DO YOU LINK THE OP GROUP NUMBER, TO THE ARRAY OF GROUPS ?

To the array of Groups => Huh?

 

But the Op.GroupNumber appears to reference a group in THE ORDER IT WAS CREATED

Yes, if you create a new part program the Operation Group numbers will be sequential

and each Operation in a Group will know that Group ID number (It's the ID# of its parent).

It does not matter if you reorder the Operation Groups, they maintain their original ID number,

and the operations within that Group still "point" to that ID#.

All that really matters is that the IDs are unique, the "order" really does not matter.

Link to comment
Share on other sites

rocheey1,

 

Maybe I am the dense one...

I've read your post multiple times and I am still not sure to exactly what you are trying to do.

 

 

To the array of Groups => Huh?

 

 

Yes, if you create a new part program the Operation Group numbers will be sequential

and each Operation in a Group will know that Group ID number (It's the ID# of its parent).

It does not matter if you reorder the Operation Groups, they maintain their original ID number,

and the operations within that Group still "point" to that ID#.

All that really matters is that the IDs are unique, the "order" really does not matter.

 

Its nice that the groups keep the same ID number, but I see no way for me to find out what each groups ID number is. I see nothing

in the Object Browser under the Group Object that looks like a valid Integer ... the 'Hash Code' maybe ?

 

This is what Im seeing here, simplified for posting. Hopefully the formatting will make it thru.

I loop thru the groups, getting and setting the tree order.

I have 3 Machine Groups, with one or more Toolpath groups.

One or more of the toolpath groups are nested as 'sub groups' inside of other toolpath groups.

Also, some of the the Toolpath groups are empty, containing no toolpaths.

 

I then loop thru the operations, getting both the Op, and the Group Number.

Ive placed each Ops Group Number in square brackets. While its obvious that

Ops 3 & 4 belong in the same Group, WHICH group?

How do I find which Toolpath group is group ID Number 7 ?

 

 

 

 

Machine Group 1                            Operation 1 [2]
 ToolPath Group 1                         Operation 2 [2]
 ToolPath Group 2                         Operation 3 [7]
    SubToolpath Group 1                   Operation 4 [7]
Machine Group 2
 ToolPath Group 3
Machine Group 3
 ToolPath Group 4
 ToolPath Group 5

Link to comment
Share on other sites

An Operation's GroupNumber is the ID of its parent Toolpath Group.

I'm not sure where you are getting the Machine/Toolpath Group ID values you show.

As it turns out, the GroupID value in the Group Class (which can be either a Machine or Toolpath Group) is marked as "internal"

Meaning even though you can see that value in the debugger, you cannot access it in your code. ;(

Link to comment
Share on other sites

An Operation's GroupNumber is the ID of its parent Toolpath Group.

I'm not sure where you are getting the Machine/Toolpath Group ID values you show.

As it turns out, the GroupID value in the Group Class (which can be either a Machine or Toolpath Group) is marked as "internal"

Meaning even though you can see that value in the debugger, you cannot access it in your code. ;(

 

That's what I thought. I just realized that despite how it appears, I did not print any Machine Group/ToolPath Group ID codes in the post above.

I only printed the Op.GroupID codes. The numbers next to each Machine/ToolPath group are not bracketed, and are part of the

naming scenario used in MasterCam. I need the Machine Group/Toolpath Group ID codes to link them TO the operations,

to see which Operations are in which Groups.

 

What I'm trying to do here is twofold: first, a 'Standards Check' app. To help keep certain company standards within each Program Setup

(which could be several in each machine Group, separated into TOOLPATH Groups). I dont want to have to rely on the operators

selections to guarantee that they have selected ALL ops in a particular group, or that they have selected ops from another group.

I had hoped to 'manually' set an active group as a Toolpath group using MakeGroupCurrent(), but it seems to work only for Machine Groups.

 

Secondly, a Tool Report app. Because we still have challenges here with multiple tools of the same type using the same tool number,

(when importing operations, for example), I have to remove, or at least filter, duplicate tools. GetTools() returns ALL tools, for all

Machine Ops, and I have no way of telling if two tools that have the same info are duplicate tools in the same Machine Op, or if they are

individiual tools used singly on EACH machine op. And of course, I cant call GetTools with a Machine Group ID cause I cant get AT the

Machine Group ID. And again, if I rely on a user selection, Im then relying on the same guy who created the problem, to be able to fix the problem.

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

A two-step process to retrieve a list of the Operations in a Toolpath Group,

selecting the Toolpath Group "by Name".

 

*Tested in X6-MU1

 

       /// <summary> Gets a list of the Operations in the specified Group. </summary>    
       /// <remarks> Note that the list of Groups returned from GetGroups() contains both; Machine & Toolpath "Groups"!</remarks>    
       /// <param name="grpName"> The name of the Toolpath Group to search for. </param>
       /// <returns> The Operations in the Group, or null if failed. </returns>
       public Mastercam.Database.Operation[] GetOperationsInToolPathGroup(string grpName)
       {                     
           Mastercam.Support.Group[] grps = Mastercam.Support.SearchManager.GetGroups(Mastercam.Database.Types.ProductType.Mill);
           if (grps != null)
           {                                
               for (int i = 0; i < grps.Length; i++)
               {                    
                   if (string.Compare(grps[i].Name, grpName, true) == 0)
                   {
                       return Mastercam.Support.SearchManager.GetOperations(grps[i].ID);
                   }
               }
           }

           return null;
       }

  • Like 2
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...