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:

Geometry Selection


Recommended Posts

Ok, I've struggled way too long with this. All I'm trying to do is select 3 lines and a point among a bunch of other geometry on the screen and move the selected geometry to a Level. Mastercam X7 MU2 Sp1, NetHook3_0, VS2010Express

 

It doesn't like the AskForMultipleGeometry line. I know it's me asking it to do something it's not supposed to do but I'm too new at this I guess. This is my first attempt at interacting with Mastercam using a NETHook. Everything else I've done has been mostly "outside" of Mastercam's interface.

 

        private void ChgGdGeoLvl()
        {
            Mastercam.Database.Types.GeometryMask gdGeoMask = new Mastercam.Database.Types.GeometryMask(true);

            Mastercam.Database.Types.SelectionMask gdSelMask = new Mastercam.Database.Types.SelectionMask(true);
            gdSelMask.Selected = true;

            Mastercam.Database.Geometry[] gdGeom = SelectionManager.AskForMultipleGeometry("Select GD to be moved to Level 9004", Mastercam.Database.Types.GeometryMask gdSelMask);
            foreach (var item in gdGeom)
            {
                item.Level = 9004;
                item.Commit();  
            }
        }

        private void GdWcsLvl_Click(object sender, EventArgs e)
        {
            ChgGdGeoLvl();
        }

 
Link to comment
Share on other sites
Mastercam.Database.Geometry[] gdGeom = SelectionManager.AskForMultipleGeometry("Select GD to be moved to Level 9004", gdGeoMask);

Taking a quick look at this, it appears that you need to pass in the Geometry Mask, not the Selection Mask to the method.

 

You can also restrict selection to points and lines thus:

var gdGeoMask = new Mastercam.Database.Types.GeometryMask()
                                {
                                    Lines = true, Points = true
                                };
Edited by Mick from CNC Software Inc.
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...