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

When using VBScript, more precisely the 'StartDBSearch' function, I can easily find draft entities  by isolating entites by looking for entities where GetEntityType = 64.

 

I cannot find similar functionality using the new C# NetHook API.  Is there a way more similar to the referenced VBScript to locate and select only drafting entities.  Am I missing something simple?

 

I attempted to circumvent the problem by firing an FT command using the ExternalAppsManager class to "QuickMaskAllDraftingAll"

This works to select all drafting entities, but attempting to move them or work with them as normal geometry results in the following error message.

Box Title - "Error: Typecaster::GeometryCaster"

Box Text - "One or more of the geometry entities could not be added - Typecaster encountered an unknown geometry type

 

I dont see (I could be missing it) any other entity types in the API, nor do I see any methods for dealing with drafting entities directly.

 

Thank you again for your time.

Link to comment
Share on other sites

I want to move them to another level and or plane as part of a larger 'Hook' that will sort all entities in a cad file.  

 

The normal geometry isnt an issue, and can be sorted with a wide range of filters.

 

 I can easily leverage my old vbscript to handle grabbing all the drafting entities and shifting all of them to another level.  I was just hoping there was an updated way to perform the same task, with the possibility of doing aome filtering along the way.

 

Do drafting entities have any kind of recognizable type?  Is there currently any way to get the underlying integer value of  "EntityType" on a given entity?  

 

Perhaps I can implement or override a method to pre filter entities.  Currently any method that implements the 'Typecaster' will throw an exception upon finding unknown geometry types.  

 

Solution for now seems to be isolating draft entities first, then filtering remaining entities to avoid this.

Link to comment
Share on other sites

You are not going to be able to turn these Drafting Entities into high-level “NET-Hook style” Geometry objects, as this API does not deal with those types.  GeometryCaster will complain, as you’ve discovered.

If you have the items that you wish to move to another level.
This method does not care about the type of the entity. 
It just moves anything that is currently "selected" ->
int GeometryManipulationManager.MoveSelectedGeometryToLevel (int destinationLevel, bool clearSelectBit);
Since you are manipulating the placement of items on levels “behind Mastercam’s back”, you may want to make this call after you do this the move to level call.
Mastercam.IO.LevelsManager.RefreshLevelsManager();

Mastercam's Level Manager display will ultimately update to reflect  the changes, but by doing this you can tell it to do it now.
 

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