sapin
-
Posts
15 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
eMastercam Wiki
Blogs
Gallery
Events
Posts posted by sapin
-
-
Sorry, but what is iCentral system ?
When I log into user.mastercam, I only have acces to a forum.
Thanks -
Hi,
I still got this issue. Someone have any idea to fix this ?
Thanks -
Is my issues more clear ?
Does anyone have an idea to fix it ? or have the same issues ? -
-
Hi,
I am running a modeless dialog box througth "public override MCamReturn Run(int param)".
In this dialog box, I got some edit text. While my dialog box have the focus, if the user press "space" or "suppr", this will interact with mastercam ("suppr" key will launch the delete entity scenario for exemple).
Did I miss any trick to fix this point ?
Regards, -
Ok, so.
First of all, my english is not really good, sorry for that. I probably don't understand your request.
Second, when I say "close this topic", it's not "delete this topic". It's something as "mark as resolved" to explain this point is resolved.Third, my question was "How to get the tool custom stored profiled ?" and the code sample given by Roger Martin is just good. I just copy and past it and I can access to the stored profil.
So, is someone need help, just take a look to Roger Martin answer. So the community can have all benefit to Roger Martin precious help, and I don't keep anything too me as I wasn't able to solve this problem alone.
Regards,
-
6 minutes ago, C^Millman said:
Are you going to share your results so someone else can see what you cam up with?
For example :
-
Thanks for your help, I am now able to get the stored profil.
You can close this topic if you want. -
Well, thank you very much for you help Roger.
I will try this during this week but I am sure this will work.
Best regards -
Hello,
I am still not able to get the stored profil of a tool.
Join to my post a sample, a simple mcam file with only one tool (a pic of this tool is in my first post).
This tool as a stored profile ( HasStoredProfile() return an TlProfile) but without any segment ( profile.GetSegmentCount() == 0).
So, I am really confused, and now I don't know what to do.
Here is the code I made,
Quoteprivate XML_Profil _GetProfile(Mastercam.Database.Tool Tool)
{
Cnc.Tool.Interop.ToolLibrarySystem mTlib = new ToolLibrarySystem();
if ( mTlib.OpenLibrary(Mastercam.IO.FileManager.CurrentFileName, true) )
{
List<TlAssembly> listAssembly = new List<TlAssembly>();
mTlib.GetAllTlAssemblies(listAssembly);foreach (TlAssembly assembly in listAssembly)
{
if (assembly.HasMainTool())
{
TlToolMill tlToolMill = new TlToolMill();
tlToolMill = assembly.GetMillTool();
if (tlToolMill != null && tlToolMill.ToolNumber == Tool.Number)
{
try
{
if (tlToolMill.HasStoredProfile())
{
TlProfile profile = tlToolMill.StoredProfile;
int sgmentCount = profile.GetSegmentCount();
MessageBox.Show(sgmentCount.ToString());
}
else
{
TlProfileResult result = tlToolMill.GetProfile();
TlProfile profile;if (result.resultCode == TlProfileResultCode.NoError)
{
profile = result.profile; // Profile data back to caller
int sgmentCount = profile.GetSegmentCount();
MessageBox.Show(sgmentCount.ToString());
}
}
}
catch (Exception oException)
{
MessageBox.Show(oException.Message);
__oLog.ForceLog(oException.Message);
}
}
}
}
}return null;
}By the way, I also get an expection in the "tlToolMill.GetProfile();" call.
Can anyone help me to solve this problem ?
Thank you. -
"I would also check profile for null before calling GetSegmentCount just to be safe, if it is null that could be an indication of a problem."
Done, but the exception is in the "tlToolMill.GetProfile();" function.
"Try restarting Mastercam and see if you can reproduce this issue."
I can reproduce the issue every time.
I try my code with some other mastercam files. I got 3 kinds of result.
- The listAssembly count = 0 in some case. Even if got some assemblies in my toolManager.
-
The listAssembly != 0, then I trying to access to the tool profile -> 2 cases :
- Everything is going fine, my profile.GetSegmentCount() > 0
- Or I got an exception during GetProfile(); function.
I think I am not doing this in the rigth way. Any documentation about the ToolNetApi.dll ? I didn't find any manual or samples in the mastercam website.
Regards, -
So, I made some quick test and got something really strage.
In some case, I get the TlProfile, and in other case I got a C# exception during the "GetProfile()" function.
Here is my code.private void _GetProfile(Mastercam.Database.Tool Tool) { Cnc.Tool.Interop.ToolLibrarySystem mTlib = new ToolLibrarySystem(); if ( mTlib.OpenLibrary(Mastercam.IO.FileManager.CurrentFileName, false) ) { List<TlAssembly> listAssembly = new List<TlAssembly>(); mTlib.GetAllTlAssemblies(listAssembly); foreach (TlAssembly assembly in listAssembly) { if (assembly.HasMainTool()) { TlToolMill tlToolMill = new TlToolMill(); tlToolMill = assembly.GetMillTool(); if (tlToolMill != null && tlToolMill.ToolNumber == Tool.Number) { try { TlProfileResult result = tlToolMill.GetProfile(); TlProfile profile; if (result.resultCode == TlProfileResultCode.NoError) { profile = result.profile; // Profile data back to caller int sgmentCount = profile.GetSegmentCount(); } } catch (Exception oException) { __oLog.ForceLog(oException.Message); } } } } }
The exception message is :
"Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée." who is probably "Attempted to read or write protected memory. This is often an indication that other memory is corrupt"Any idea for how to fix this error ?
Thank again. -
Looks great.
I wil try this solution. I just need to find who to retrieve an TlAssembly from a MasterCam.Data.Tool.
Thank for your help. -
Hi,
I am trying to get the stored profile of a tool from the mastercam NET-Hook or C-Hook.
In Net-hook, I think the profile is in the Cnc.Tool.TlProfile but i don't know how to access it from the Mastercam namespace.
In C-Hook, I think I can access to the profile by the GetStoredProfile() function in TlProfilePtr but I actually don't know how to get an TlProfilePtr from a tool number.
Is there any samples or documentation to help me ? I checked the 3rd party developers data but I probably miss something.
Thanks !
Cnc.Tool.Interop.TlToolFunctions removed in MCam2021
in Mastercam C-Hook, NET-Hook and VBScript Development
Posted
Hi.
I notice the class Cnc.Tool.Interop.TlToolFunctions was removed in Mastercam 2021 version.
In a previous topic, Roger Martin send me a code sample using this class.
Any advice to replace this "TlToolFunctions.GetToolSystem();" with mcam 2021 ?
Thanks !