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:

Mick from CNC Software Inc.

CNC Software
  • Posts

    1,012
  • Joined

  • Last visited

Everything posted by Mick from CNC Software Inc.

  1. Not sure why you are not able to debug the first project but something must be out of sync somewhere. I would double check to make sure the post build steps are correct as the files are copied but might only be copied to the x64\Debug folder and not to your Mastercam CHooks folder. I'll post some images of my setup for your other project so you can see how it all comes together. In regards to your other project it is working fine for me, you are only updating the Stock Z and StockOrigin Z values nothing else so only the Z will reflect the changes (see images) Select Case StockSize.z Case 400 StockSize.z = 200 StockOrigin.z = 200 Case 200 StockSize.z = 400 StockOrigin.z = 400 Case Else
  2. The control Data_NAME was missing from the main report this was causing the exception, I added it back to your report (see images) The two sub reports where also pointing to the original reports so I edited the names to match yours (see images) I have attached the reports below, worked fine for me. SST.zip
  3. Can you zip up the reports and attach them here and I'll take a look. There is also a good ActiveReports tutorial at https://www.mastercam.com/en-us/Support/Tutorials/Mastercam
  4. Make sure you are running Visual Studio as Administrator to do so create a short cut to Visual Studio on your desktop and then right click properties check 'Run As Administrator'. Start Visual Studio via the short cut then browse to the project to open it. Windows 8 and possibly Windows 7 doesn't allow copying files to the Program Files folder so you need to be running Visual Studio as an Administrator to bypass this. In Visual Studio make sure you are building a debug version and not a release version of the project, Build->Configuration Manager set configuration to debug and platform to x64. After this if you still can not debug check the Output Window (View->Output) and make sure it is compiling successfully and that 2 files are copied, that is the NETHook and the FT: ------ Rebuild All started: Project: MergeIGS, Configuration: Debug x64 ------ MergeIGS -> D:\_DEV\support\Misc\MergeIGS\MergeIGS\bin\x64\Debug\MergeIGS.dll 1 file(s) copied. 1 file(s) copied. ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== As for the JobSetupStockSize issues, can you post a snippet of code so I can see what it is you are doing, thanks.
  5. Make sure the controls named Data_NAME (textbox) and IMAGE_LIST (label) exist in the Detail of the report as they are being referenced in this code. public void Detail_Format() { string m_machine = ((TextBox)rpt.ParentReport.Sections["Detail"].Controls["Data_NAME"]).Text; string m_imx = ((Label)rpt.Sections["Detail"].Controls["IMAGE_LIST"]).Text; rpt.Sections["Detail"].AddBookmark (m_machine + "\\" + m_imx); }
  6. System.ArgumentException: Control name doesn't exist or invalid Parameter name: name Did you delete or rename any controls on that report? Open the report in the designer and at the bottom there are two tabs, one named Script, click that and see if there is some code in there referencing a control that does not exist on the report.
  7. Because it is a class library it can not be started directly so it needs a host application. For debugging purposes it should not really be an issue, when you stop debugging Mastercam will exit. In some cases you may need to have Mastercam start fresh because of initialization code that may need to be called etc.
  8. I created a quick VB.NET NETHook for X8 that prompts for an IGES file and merges the file into an existing MCX file, renames the NCI for all selected operations and then saves the file to another file name. Hopefully this will help. VB.NET source code and NETHook attached. Copy the NETHook (DLL) and FT file to your X8 chooks folder, you may need to unblock the NETHook (right click the DLL and go to properties and unblock) Start Mastercam, go to Settings-> Customize and under the Category select NETHook, you should see the Merge IGS in the list, drag that to a toolbar or a menu. Click on the button or menu you just created to execute the NETHook, it will check to see if you have at least one operation in the operations manager and if so it will prompt your for an IGES file. Public Overrides Function Run(ByVal param As Integer) As MCamReturn ' Check that we have a drawing Dim ops = SearchManager.GetOperations() If Not ops.Any Then Return MCamReturn.FunctionExit End If Dim iges As String = String.Empty ' Prompt for IGS Using selectIgs As New OpenFileDialog With selectIgs .CheckFileExists = True .CheckPathExists = True .DefaultExt = "igs" .Filter = "IGES Files (*.igs;*.iges)|*.igs;*.iges" .Multiselect = False .Title = "Merge IGES" ' User failed to select a file so just bail If Not .ShowDialog() = DialogResult.OK Then Return MCamReturn.FunctionExit End If ' Store the selection iges = .FileName End With End Using ' Merge If Not FileManager.Open(False, iges, True) Then MessageBox.Show("Failed to merge file " & iges, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Dim nci As String = Path.Combine(SettingsManager.CurrentDirectory, "merged.nci") ' Iterate all operations For Each op In ops ' Only selected operations If op.Selected Then ' Set the NCI name op.NCIName = nci op.Commit() op.Regenerate() End If Next Dim name As String = Path.Combine(Mastercam.IO.SettingsManager.CurrentDirectory, "merged.mcx-8") ' Save As If Mastercam.IO.FileManager.SaveAs(name, True) Then ' Switch to ISO ViewManager.GraphicsView = SearchManager.GetSystemView(GraphicsViewType.Iso) ' and fit screen GraphicsManager.FitScreen() MessageBox.Show("Saved file to " & name, "Save As", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("Failed to save file " & name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Return MCamReturn.NoErrors End Function MergeIGS_VBNETSource.zip X8NETHook.zip
  9. Getting started should be pretty straight forward, just follow the document installed with the project template and look at some of the examples on the website. If you get stuck feel free to reply to this thread or email.
  10. Unfortunately the MergeMC function you need does not support merging IGS file, however in X8 it was found that the MergeMC function was not working at all so that is not going to help you i'm afraid. I did test a quick script in X9 and it is working but I had to import the igs file first then merge the mcx file as shown below. Call Main Sub Main Dim igs igs = "C:\Users\Public\Documents\shared mcamx8\mcx\base.igs" Dim mcx mcx = "C:\Users\Public\Documents\shared mcamx8\mcx\T.mcx-8" Dim saveAs saveAs = "C:\Users\Public\Documents\shared mcamx9\mcx\baseT.mcx-9" NewMC false If (ImportFile(igs)) Then If (MergeMC(mcx)) Then RepaintScreen true ' -- TODO: Update NCI ' -- SaveAs If SaveMCAs(saveAs, true) Then ShowString "File saved " & saveAs Else ShowString "Failed to save as " & saveAs End If Else ShowString "Failed to merge " & mcx End If Else ShowString "Failed to import " & igs End If End Sub If you are not upgrading to X9 any-time soon and you feel a little adventurous I would recommend you taking a look at creating a VB.NET Mastercam NETHook. You can download the free Community Edition of Visual Studio and then download and install a Mastercam NETHook project template for Visual Studio (see the sticky threads in this forum) to set up all the necessary boiler plate code ready to get started. There is also a document that is included in the project that walks you through the steps of setting up the project to deploy and debug with Mastercam. Visual Studio Community Edition (Free): https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx Visual Studio C# and VB.NET Project Templates: Install from within Visual Studio under Tools->Extensions and Updates search for online for Mastercam. VB.NET and C# Example projects: https://www.mastercam.com/en-us/Communities/3rd-Party- API Documentation: https://www.mastercam.com/en-us/Communities/3rd-Party-Developers/NET-Hook-Downloads If you have any other questions don't hesitate to reply to this thread.
  11. It can also be done in a NETHook too if thats of interest, ATP uses this approach when it creates images for it's reports.
  12. I whipped up a quick NETHook that you or some one might like to play around with. Unzip the NETHook.zip into your X9 CHooks folder then right click the NETHook (PostToDrawingFolder.dll) goto properties and make sure to unblock it if it is blocked (likely). Fire up Mastercam and goto Settings Customize, under the Category NETHook you should see Post NC button, drag that to a tool-bar or add it to a menu. Load a drawing then click the button you just added to open up a dialog, click OK to post to the drawing NC Program sub folder. This is not an officially supported CNC Software NETHook but feel free to post to this thread if you have any questions etc. NETHook.zip PostToDrawingFolderVBNETSource.zip
  13. Ron, I would imagine that might be possible, have some code to test for axis combo (assuming the data is in the source file) and add some logic to the report start event and show/hide report elements as needed. I am pretty swamped at the moment with our reseller event looming and just released X9 but feel free to send me what you have and I'll take a look.
  14. I'm certainly not an expert with Active-reports but I'll do my best to explain and I am sure there are other ways to accomplish the same result but this works for me. The XML source file generated by Mastercam contains multiple sections of data each contained within a tag (node) , some of this data only appears once in the file like the NCFILE tag, others like TOOL can appear multiple times as a drawing can contain multiple tools. Active-reports viewer fetches data from its source when launched, in this case the XML file created by Mastercam, the top node being SETUPSHEET. A sub report with a record-set of NCFILE will only fetch once because there is only one in the source, a sub-report with a record set of TOOLS will also only fetch once as there is only one, a sub-report of TOOL may fire multiple times depending on the number of entries.
  15. You need to add any additional fields to the report you want and set each DataField property to to the appropriate XML tag in the setup sheet xml file that is created by Mastercam when you run a setup sheet. For example: -<TOOL> <SPACER>SJV</SPACER> <COMMENT>Roca Ø63</COMMENT> <TIME-LONG>0 HOURS, 0 MINUTES, 14 SECONDS</TIME-LONG> <TIME-SHORT>00:00:14</TIME-SHORT> <COOLANT-OP>Flood</COOLANT-OP> <COOLANT-TL>Off</COOLANT-TL> <COOLANT>Flood</COOLANT> <CORNER-RADIUS>0.0</CORNER-RADIUS> <CORNER-RADIUS-TYPE>None</CORNER-RADIUS-TYPE> <DESCRIPTION>#1 - M63.00 FACE MILL - ROCA Ø63</DESCRIPTION> <NAME>Roca Ø63</NAME> <DIAMETER>63.0</DIAMETER> <RADIUS>31.5</RADIUS> <DIAMETER-OFFSET>1</DIAMETER-OFFSET> <FLUTES>6</FLUTES> <LENGTH-OFFSET>1</LENGTH-OFFSET> <MATERIAL>Carbide</MATERIAL> <METRIC>YES</METRIC> <MC>C:\users\public\documents\shared mcamx9\MILL\TOOLS\FACEMILL.mcx-9</MC> <NUMBER>1</NUMBER> <ALIAS>T0101</ALIAS> <STATION>-1</STATION> <ACTIVE-SPINDLE>Left</ACTIVE-SPINDLE> <ACTIVE-TURRET>Right</ACTIVE-TURRET> A list of all setup sheet and tool list XML tags and their meaning are in the Activereports Designer Help documentation accessible from the Designer. I highly suggest reading through the Activereports tutorial @ https://www.mastercam.com/en-us/Support/Tutorials/Mastercam as it explains how to do this and much more. Just register on the website, you don't need active maintenance and you should be able to access the tutorial.
  16. Andy, I had to implement two additional sub reports to enable drilling down into the tools list. (see attachment) t(mcam) implements t(ncfile) implements t(tools) implements t(tool) Andy.zip
  17. Kevin, Is there a reason you want to develop with CHooks? Knowing Visual Basic you may find it easier to use our NETHook API with Visual Basic.NET There are a number of project examples downloadable from mastercam.com and yes you can use the community edition of Visual Studio for development.
  18. I realize this is a blast from the past but I am going through all the active reports posts here and answering what I can seeing I am now responsible for the active reports projects. I edited your record set and update the data fields to get what you are after. The images attached show your output with the duplicate tools then the new output using the updated source data fields.
  19. Just to update you on this, yes you can pull the Tools Code into an Active Report and bind it to a barcode. I just created a quick and dirty sub report and added a barcode control to it, I then bound the control's data-field to the XML data-source tag Code that contains the actual Tool Code. I used code 128 font to test. Edit: Updated images with the correct ones
  20. Apologies for the late response but I just saw this. There is on-line help for ActiveReports, for example: http://arhelp.grapecity.com/webhelp/AR9/index.html#UseFieldsInReports.html
  21. Jon, do a search on these forums for "active reports", "reports" or "setuup sheet" etc as there is a lot of postings on the matter that should also help. It occurred to me with all the Set-up sheets and Report posts that it might make sense to condense them all into one stickied thread.
  22. be, Are you using the script above? I am not exactly clear on your problem, can you shed a little more light on the exact steps you take etc.

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