-
Posts
2,870 -
Joined
-
Last visited
-
Days Won
6
Content Type
Profiles
Forums
Downloads
Store
eMastercam Wiki
Blogs
Gallery
Events
Everything posted by Roger Martin from CNC Software
-
You're referring to "Create Relative Views" ? What you be the workflow that triggers the add-on to know "this is your WCS, now do this..."?
-
While this is true -> That does not mean that you cannot have a NETHook or CHook that can execute something every time there is a File-New (or on some other “event”). A NETHook (or CHook) add-on can "subscribe" to event notifications from Mastercam and... when it receives an event notification it's interested in - take some action. I whipped up a FileNewView NETHook for X7 last night that demonstrates this. When this FileNewView add-on is installed it watches for "File-New" and when it sees one it-> Creates a new View (that you've pre-defined) and sets that View as the active Graphics View. Does this sound like what NeonDad was looking for?
-
Open Quiet
Roger Martin from CNC Software replied to rocheey1's topic in Mastercam C-Hook, NET-Hook and VBScript Development
Hmmmm.... I tried "manually" opening X6 files in X7 and never got that message. -
Open Quiet
Roger Martin from CNC Software replied to rocheey1's topic in Mastercam C-Hook, NET-Hook and VBScript Development
I would say probably not. EDIT... So you do not get these warning from GetOpGroupDataInExternalFile, but you get them when you actually "open" file? Exactly how are you opening the file? And what version is the file you are opening when you see these messages? -
The GroupData and OpData varaibes are "out" variables, as the GetOpGroupDataInExternalFile method fills them in with data. Here they are set to "nothing" (or null for you non VB programmers). That's not going to work, as they need to be intialzied to "someting" So instead of this --> Dim FileSpec As String = "C:\TMP\TEST.MCX-7" Dim success As Boolean = False Dim OpData() As ExternalOpsFileData = nothing Dim GroupData() As ExternalGroupsFileData = nothing Success = SearchManager.GetOpGroupDataInExternalFile(FileSpec, GroupData, OpData) You need to initialize them as "empty" -> Dim FileSpec As String = "C:\TMP\TEST.MCX-7" Dim success As Boolean = False Dim OpData() As ExternalOpsFileData = {} Dim GroupData() As ExternalGroupsFileData = {} Success = SearchManager.GetOpGroupDataInExternalFile(FileSpec, GroupData, OpData) A side note: GetOpGroupDataInExternalFile allows one or the other to be nothing (null), which tells this method not to bother retrieve that (Group or Op) data. If both are null, you've told it to not bother with either, so you get nothing in the (2) output variables and the return in False. It should only return False, if… • The supplied file name “bad” (does not exist). • Both of the supplied GroupData and OpData variables are null. • Mastercam is not in a Machine Mode (it will not work if only in ‘Design’). • Something horribly unexpected has gone wrong. If you really need to use the GetOpGroupDataInExternalFile method in X7 - please contact me -> SDK <at> mastercam >dot> com
-
X6/X7 is the same in regards to the .NET Framework requirements. *And you don't have the newer NETHook3 in X6. Hmmmm.... Not something I'd usually go for, but maybe the v4.0 Framework is "messed up" (that's the technical term) on the non-working system? Maybe try uninstalling / re-installing the v4 .NET Framework on the "bad" system.
-
For X7 you do want the NET Framework v4.0, as that is the version that the NETHook2 (and NETHook3) that shipped with X7 targets. So Visual Studio was correct in telling you that - "You're doing something wrong". Even though Mastercam can be 32-bit or 64-bit, we're working in .NET here and... We can build our NETHook AddOn using the "AnyCPU" platform. This way the (.NET) DLL we generate can be used for either 32-bit or 64-bit Mastercam. If you do the use the "AnyCPU" platform, you will see this warning when you build your project -> Warning - There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "NETHook2_0", "AMD64". blah, blah blah... If your NETHook project only references Mastercam's NETHook2_0.DLL (or NETHook3_0.DLL) you can safely ignore this warning. If this warning really bothers you, there is a way to (manually) add a line in the .csproj (project) file that will tell Visual Studio to stop complaining about this. I just built and ran this code using 64-bit Mastercam X7 (SP2) -> *I added some input validity checking so that it won't throw an Exception just because the file doesn't exist.* The only way I can get the "Unknown File Type" error (using this code) is if I build the project using the "X86" platform. If I buld it using "AnyCPU" or "X64", it runs fine*. "Fine" in that I see the error message telling me that the EXE file doesn't exist on my system. using System.Windows.Forms; using Mastercam.App; using Mastercam.App.Types; namespace Program_Run_Nethook { #region class NETHOOK public class Program_Run_Nethook : NetHook2App { public override MCamReturn Run(int param) { bool ret = true; // Assume success MessageBox.Show("your in!"); const string exe = @"Z:\Mastercam X6 Files\Machines\Mazak 510C-II\Tool Sequencer.exe"; if (System.IO.File.Exists(exe)) { System.Diagnostics.Process.Start(exe); } else { MessageBox.Show("File to execute was not found! ->\n" + exe, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); ret = false; } return (ret ? MCamReturn.NoErrors : MCamReturn.ErrorOccurred); } } #endregion class NETHOOK }
-
>> I am in the process of migrating our add-on software package from X6 to X7(using X7 SDK, VS2012, C++) When building CHooks (which are MFC "extension" style) DLLs, they must be built using the same compiler "tool set" as the version used to build the version of Mastercam being targeted. For X6/X7 that would be tine tool set from Visual Studio 2010 ( which is the v100 toolset). Visual Studio 2012 by default used the v110 toolset. To find this setting in your C++ Project Open the Project Properties and under Configuration Properties select the General category On this dialog you should see the setting for -> Platform Toolset ^^^ This does not mean that you cannot use Visual Studio 2012 "as your IDE" ^^^ Just make sure that the Platform Toolset in your X6/X7 CHook Project is v100 and you should be good.
-
opening X6 files with X7
Roger Martin from CNC Software replied to Thoob's topic in Industrial Forum
Another suggestion... Files Type Manager I use this free utility from NirSoft. With this you easily see and edit the file type <-> program associations on your system. -
When Mastercam starts up it reads all of the FT files in the CHooks folder. ALL of the CHook/NETHook DLLs referenced in these FTs are "loaded" (and added to an internal list). Now whenever Mastercam has an Event, it goes thru that list of AddOns and passes that Event to each of them. Of course only those CHooks/NETHooks that have a "notify" method are going to actually receive the notification. You can still leave your DLL in your bin/debug folder. Your. FT specifies where Mastercam looks for the DLL.
-
Does your NETHook have an .FT file? (That "loads" your NETHook) Is your Notify method getting any notifications? When you "load" your Form, how are you running it? - Modal or Non-Modal (hint: you want Modal) I just tried this code in X7 (SP2) and I am getting these events. Public Overrides Function Notify(eventCode As MCamEvent) As MCamReturn ' Checking just some of the MCamEvents that get sent from Mastercam. System.Diagnostics.Debug.WriteLine(String.Format("EventCode:{0}", eventCode)) Select Case eventCode Case MCamEvent.File_New MessageBox.Show("MCamEvent.File_New", "Notify") Exit Select Case MCamEvent.Pre_File_Open MessageBox.Show("MCamEvent.Pre_File_Open", "Notify") Exit Select Case MCamEvent.File_Open MessageBox.Show("MCamEvent.File_Open", "Notify") Exit Select Case MCamEvent.Pre_File_Save MessageBox.Show("MCamEvent.Pre_File_Save", "Notify") Exit Select Case MCamEvent.Post_File_Save MessageBox.Show("MCamEvent.Post_File_Save", "Notify") Exit Select End Select Return MyBase.Notify(eventCode) End Function
-
Post expiration date
Roger Martin from CNC Software replied to PcRobotic's topic in Post Processor Development Forum
The MP Language has the predefined variable that returns the current date -> date$ You create a new user defined variable in your PST files(s) with your expiration date. Then within the PST you would do a check using the current date$ against your expiration date. If the post is "expired" you could then output a string to the NC file and/or display a message on screen when the PST is used. Obviously this is not very "secure" (if you need that), as anyone can just change your expiration date in the PST. But... If you really need to prevent that, you could put the expiration date in "binned" post file using MPBIN. -
Actually it is the new NETHook v3 that comes with X7. *** Also please note that the NETHook v2 (NETHook2_0.DLL) has been deprecated and will not be included with Mastercam after X7 *** It'll will be NETHook v3 going forward... Got the bottom of this page and you will find more detailed info in the NETHook v3 API As for what language to use for creating NETHooks? You can use VB.NET, C# or even C++/CLI (though this would be unusual). If you know VB and are comfortable with it - use it. If someone is just starting out, I always suggest C#
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.