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:

Translating Ops With Surface Geometry


Recommended Posts

Are these solid surfaces, selected by clicking a solid face or faces?

I'm pretty sure such surfaces don't really exist.

They are derived from the solid each time you hit regen... and if they don't exist, you can't translate them 

Link to comment
Share on other sites
2 minutes ago, gcode said:

Are these solid surfaces, selected by clicking a solid face or faces?

I'm pretty sure such surfaces don't really exist.

They are derived from the solid each time you hit regen... and if they don't exist, you can't translate them 

Solid surfaces are store as toolpath entities the way drill points are or chains, they contain parasolid ids for the toolpath api to lookup the geometry,

translating the geometry with a chook call and regenerating the operation should work, however,

 

if the op is using the nethook API, calling .Commit() on the solid could invalidate the associated toolpath entities. Sometime calling Commit(false) solves the issue, however i would recomment using the chook api for advanced operations like unified

in the older versions you could lookup the solid surfaces and other toolpath info by dumping the database 

Link to comment
Share on other sites
8 hours ago, DeuceNumeroUno said:

Sounds like that could help! Do I need access to the c-hook SDK to be able to view that example? Looks like I don't have permission to view the C++ downloads page on the mastercam website.

yes, you can ask the sdk team for access

Link to comment
Share on other sites
17 hours ago, gcode said:

Are these solid surfaces, selected by clicking a solid face or faces?

I'm pretty sure such surfaces don't really exist.

They are derived from the solid each time you hit regen... and if they don't exist, you can't translate them 

 

My reason for stating this is because..

 

If you import operations from another file that use solid surfaces and select

"Import Geometry", neither the solid nor the solid surface are imported into the new file.

At least that has been my experience.

 

Link to comment
Share on other sites
7 hours ago, gcode said:

 

My reason for stating this is because..

 

If you import operations from another file that use solid surfaces and select

"Import Geometry", neither the solid nor the solid surface are imported into the new file.

At least that has been my experience.

 

That's very true, however that's a limitation of the import manager not Mastercams API,

The Nesting Manager can import solids fine

Import Operations With Solids – myMastercam

Link to comment
Share on other sites
18 hours ago, byte said:

That's very true, however that's a limitation of the import manager not Mastercams API,

Thank's, as you may have noticed, all I know about Mastercam's API is how to spell it. LOL!

You'd think that with all the effort CNC is putting into using solids to drive toolpaths, they put some effort into making

the Import Manager support solids as well

 

Link to comment
Share on other sites
  • 4 weeks later...
On 2/22/2024 at 4:13 PM, byte said:

Mastercam C++/CLI New Project Template VS 2022 - Visual Studio Marketplace

This template contains a c# example of translating geometry using the chook api with an interop dll, which will likely mitigate your issue

Seem to still be having the same issue using this method. Unified morph op says the translated geometry is not a surface and going into the parameters and then regenerating the op places the cuts where the geometry was originally. Here is my code:

            var geometryFound = SearchManager.GetGeometry();
            var geoIDs = new List<int>();
            foreach (var entity in geometryFound)
            {
                geoIDs.Add(entity.GetEntityID());
            }
            foreach(var geo in geoIDs)
            {
                Mastercam.IO.Interop.SelectionManager.TranslateSelectedGeometry(geo);
            }

Link to comment
Share on other sites
On 3/20/2024 at 2:21 PM, DeuceNumeroUno said:

Seem to still be having the same issue using this method. Unified morph op says the translated geometry is not a surface and going into the parameters and then regenerating the op places the cuts where the geometry was originally. Here is my code:

            var geometryFound = SearchManager.GetGeometry();
            var geoIDs = new List<int>();
            foreach (var entity in geometryFound)
            {
                geoIDs.Add(entity.GetEntityID());
            }
            foreach(var geo in geoIDs)
            {
                Mastercam.IO.Interop.SelectionManager.TranslateSelectedGeometry(geo);
            }

you should use translate_silent

Link to comment
Share on other sites
19 hours ago, byte said:

you should use translate_silent

If I'm thinking correctly, the Mastercam.IO.Interop.SelectionManager.TranslateSelectedGeometry is using the translate_silent function.

 

bool SelectionManager::TranslateSelectedGeometry (int geometryId)
    {

    auto spEntity = std::make_unique <ent> ();
    bool succ = false;

    GetEntityByID (geometryId, *spEntity, &succ);

    if (succ)
        succ = MoveEntity (spEntity.get ());

    return succ;
    }

bool SelectionManager::MoveEntity (ent *entity)
    {
    bool succf = false;
    p_3d fpt = entity->u.sld.min;
    p_3d tpt;
    tpt.Set (fpt[0], fpt[1], fpt[2] + 1);
    translate_silent (&entity->eptr, true, 0, fpt, tpt, 1, 1, &succf, true);
    return succf;
    }

#pragma endregion
}

Link to comment
Share on other sites
4 hours ago, DeuceNumeroUno said:

If I'm thinking correctly, the Mastercam.IO.Interop.SelectionManager.TranslateSelectedGeometry is using the translate_silent function.

 

bool SelectionManager::TranslateSelectedGeometry (int geometryId)
    {

    auto spEntity = std::make_unique <ent> ();
    bool succ = false;

    GetEntityByID (geometryId, *spEntity, &succ);

    if (succ)
        succ = MoveEntity (spEntity.get ());

    return succ;
    }

bool SelectionManager::MoveEntity (ent *entity)
    {
    bool succf = false;
    p_3d fpt = entity->u.sld.min;
    p_3d tpt;
    tpt.Set (fpt[0], fpt[1], fpt[2] + 1);
    translate_silent (&entity->eptr, true, 0, fpt, tpt, 1, 1, &succf, true);
    return succf;
    }

#pragma endregion
}

Are you calling Commit() on the solid ay any point?

You will need to eliminate all commit() calls on solids from .net

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