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.Selected - not a Boolean ?


Recommended Posts

Are there different types of "selected" states for entities?

 

I ask because, other than using "SelectionManager.SelectAllGeometry()", which highlights the selected Geometry like manual selection, any other type of selection thru code does not highlight the entities.

 

It seems that only the highlighted entities will get erased by hitting the "delete" key. Selecting entities thru code, and verifying that they are selected, will not be erased when hitting the 'delete' key. And it is also the same for code requiring preselected geometry.

 

Im bringing this up because I need to preselect geometry thru code. Manually selecting beforehand, or using "SelectAllGeometry", works.

 

Ive tried 'SelectAllGeometryOnLevel', and SearchManager.GetGeometry. Ive then run a loop to debug.writeline geometry.selected, and it comes back TRUE. I can also rerun the loop and use Geometry.selected=False, and debug,writeline tells me the geometry is not selected.

 

Im trying to translate, and scale, a large amount of entities. The .net version is prohibitively slow, and Ive found that outputting some on-the-fly vbs works well. However, it only works on geometry that is preselected manually, or preselected using SelectAllGeometry, which highlights the geometry. The selection thru VBS "Chaining" fails the same way .... I either have to manually preselect, or use "SelectAll"

 

Is there another way ?

Link to comment
Share on other sites

If you haven’t downloaded this this yet, I suggest you do…

See the Reference for NETHook V3 - .zip file download (near the bottom) on this page

 

The “Selected” flag on a Geometry object is a Boolean.

It is the “Selected” state of the Geometry object in your .NETHook object.

If you change the “Selected” state on a .NET Geometry object, you need to .Commit that object in order for that to be reflected in the geometry entity in the active database.

 

You need to remember that not all of the geometry in the active part database is…

A .NET geometry object.

-or-

Every one of your .NET geometry objects exists in the active part database.

If the .NET object has not been .Commit(ed), it’s not in the database.

 

Im bringing this up because I need to preselect geometry thru code.

Exactly what are your desired selection criteria?

 

SelectAllGeometryOnLevel is a ‘fast’ Geometry selection method.

Note the remarks on this method ->

This only affects geometry that is already committed to Mastercam's database!

It does NOT affect the state of any .NET geometry objects.

That is why it can be "fast".

 

Im trying to translate, and scale, a large amount of entities…

Doing these type of operations looping through a large list of .NET geometry objects can be slow.

That is why there are some newer methods in the v3 .NET API to help out in these cases.

You select the geometry in the active database, without messing with the .NET geometry objects.

For “faster” XForm operations, see the XForm related methods of the GeometryManipulationManager class in the Mastercam.GeometryUtility namespace.

These are much faster when working with large sets of geometry than looping thru a list of .NET geometry objects and XForming each one individually.

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