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:

rocheey1

Verified Members
  • Posts

    341
  • Joined

  • Last visited

Posts posted by rocheey1

  1. I was unable to 'jig' geometry using the nethook API. What I was attempting to do was have the user box select some geometry, then overlay our company drawing template to the geometry.

     

    I also wanted the user to be able to drag/resize the template for a more accurate positioning / resizing of the MasterCam geometry around the title blocks/rev blocks, etc.

     

    What I ended up doing was creating an invisible userform, with the visible borders / titleblocks / etc made from labels. The interior was transparent, and allowed the geometry underneath to be visible thru the interior. I restricted the form drag/resize to the extents of the drawing window.

  2. I had a LOT of problems with the X7 betas. The current X7 is more stable for me than X6, or X5.

    X8 beta seems stable for me so far, but I've never been a fan of Metro/WPF interfaces :/

  3. It does the same thing the old editor does

     

    It wasn't really "upgraded," it was written from scratch.

     

    Aren't these two statements mutually exclusive ?

     

    As a developer, and Beta tester (but not for MasterCam) I can can tell you that error messages do not necessarily originate from the error point, but percolate up. And as a contract software programmer who has been given a plate of spaghetti code (complete with spaghetti modules and spaghetti classes and with spaghetti events), I can see how this would slip thru.

     

    But you are saying a .Net app, written from scratch, will pop up this DOS error code?

    I searched thru the system error message archive at http://msdn.microsof...1(v=vs.85).aspx and was unable to find this error. Every error message has a code/value, could you please share this value ?

     

    Note to self: forget now ever becoming a MasterCam beta tester :/

  4. Rocheey - In isolation I understand every word you have written.

    As sentences I haven't a bloody clue what you're talking about :hrhr:

     

    Unfortunately I hear this a lot at work - but usually supply the Secret Decoder Ring before i open my mouth :/

    • Like 1
  5. OMG ... I'm stunned not just because it references DOS (do we have to save as 8 * 3 as well ?) but that the app was upgraded from std windows to .net winforms, at the expense of speed. We use a .net GCode editor here, which can keep up with all but the best of unmanaged apps, speed wise, but can save to all SORTS of devices, URLs, etc.

     

    Sounds like this app needs some TLC.

  6. NCSimul and VERICUT have Apps. The first has been released last July and VERICUT's is close to be released.

     

    http://www.springplm...sbis.php?ID=521

     

    https://twitter.com/...5575553/photo/1

     

    Verification is not that simplistic either, but it seems they found their way.

     

    I'm very careful before I say something is impossible or not effective. We never know what kind of fools and idiots are coding for these devices.

     

    In fact, I always consider myself part of the idiots/fools group, because I know very little about development for mobile platforms. They are the thing now, so it makes sense that their APIs and hardware is getting the whole attention these days.

     

    10 years ago I could never imagine I'd calculate right angle triangles on my cellphone.

     

    I'd say a viewer for Mastercam, covering all layers and showing toolpaths as wireframe, per operation or group, it's a very realistic request.

     

    Toolpath crunching? No, we're not there yet... but a lot of other things are possible...

     

    JM2C

     

    Ive been sticking my toe into that pool recently, as well. But for the Android platform :p

  7. Im using MasterCam X7, 64 bit, Windows 7 64bit, Visual Studio 10, .Net FrameWork 4, NetHook3_0

     

    if I have a simple form open in my nethook, the entire application freezes if I create a new tool.

     

    To reproduce the problem:

    1) Create a new nethook using the supplied template.

    2) add a new form to the application. leave all the default settings for the form in place

    3) In the default NetHook Namespace, in the Mastercam RUN function (Public Overrides Function Run(ByVal param As Integer) As MCamReturn)

    launch your form:

    Dim MyForm as new Form1

    MyForm.show

    4) Run your Nethook, and load a Mastercam file with toolpaths (no matter what order)

    5) Launch ToolManager, and create a new tool - the defaults are fine (Click "Next", click "Finish")

     

    Once you close the Create New Tool window, Mastercam freezes.

     

    Is this reproducible on newer versions of Visual Studio ? And if so, is there a workaround ?

  8. I had thought, rightly or wrongly (is that a real word?) that he wanted the window to remain visible, and without .TopMost, the window will disappear behind MasterCam on user selection, much like hiding the form. And once .Topmost is used, I needed an extra click to set the focus back to MasterCam.

     

    Also, the IDE gives me the error that "Geometry' is not a member of 'Form.Form1". The only non-mcx reference I could find in the object browser for 'Geometry' was "System.Windows.Media.Geometry", but it doesn't contain any Public Members.

     

    A search for .Showdata in the Object browser didn't return any references. :(

  9. If you dont show the form modally, then your form will disappear behind Mastercam when the user selects.

    So, you set your form to TopMost, but then you lose the first click when the user is prompted to select onscreen.

     

     

    Here is a module I use for such things. Create a new module in VB, erase all text in it, and paste this in:

     

    Imports System.Runtime.InteropServices
    Imports System.Diagnostics
    
    Module modMcxHwnd
    Delegate Function EnumChildWindProc(ByVal hWnd As System.IntPtr, ByVal lParam As Integer) As Boolean
    
    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Function EnumChildWindows(ByVal hWndParent As System.IntPtr, ByVal lpEnumFunc As EnumChildWindProc, ByVal lParam As Integer) As Boolean
    End Function
    
    <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Private Function GetWindowText(ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer
    End Function
    
    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Function GetClassName(ByVal hWnd As System.IntPtr, ByVal lpClassName As System.Text.StringBuilder, ByVal nMaxCount As Integer) As Integer
    End Function
    
    <DllImport("user32.dll", SetLastError:=True)> _
    Function SetActiveWindow(ByVal hWnd As IntPtr) As IntPtr
    End Function
    
    Private lstChildrenHandles As New System.Collections.Generic.List(Of IntPtr)
    Public McxMainHwnd As IntPtr = IntPtr.Zero	 ' Handle to main MasterCam window
    Public McxOpMgrHwnd As IntPtr = IntPtr.Zero	 ' Handle to the Op Manager
    Public McxGfxHwnd As IntPtr = IntPtr.Zero	 ' Handle to the Graphics Window
    
    Sub GetMcxHandles()
     Dim RetVal As Integer
     Dim procC As New EnumChildWindProc(AddressOf EnumChild)
     Dim procD As New EnumChildWindProc(AddressOf EnumChild)
     Dim stringBuffer As String = New String(Chr(0), 256)
    
     ' get the current MasterCam Process
     Dim myProcess As System.Diagnostics.Process = System.Diagnostics.Process.GetCurrentProcess()
    
     ' Get the window handle to main mastercam window
     McxMainHwnd = myProcess.MainWindowHandle
    
     ' loop thru and look at all the Mcx Child Windows
     lstChildrenHandles.Clear()
     EnumChildWindows(McxMainHwnd, procC, 0)
    
     For Each wHndChild As IntPtr In lstChildrenHandles
    	 RetVal = GetWindowText(wHndChild, stringBuffer, 256)
    	 ' Get the window title of each window
    	 Dim sClassName As New System.Text.StringBuilder("", 256)
    	 Dim childTitle As String = stringBuffer.Substring(0, RetVal)
    	 Call GetClassName(wHndChild, sClassName, 256)
    
    	 If childTitle = "Op Manager" Then ' found Op Manager
    		 McxOpMgrHwnd = wHndChild
    	 ElseIf childTitle = "" And sClassName.ToString = "Afx:0000000140000000:ab:0000000000000000:0000000001900011:0000000000000000" Then ' main ghraphics window
    		 McxGfxHwnd = wHndChild
    	 End If
    
     Next
    End Sub
    
    Private Function EnumChild(ByVal hWnd As IntPtr, ByVal lParam As Int32) As Boolean
     lstChildrenHandles.Add(hWnd)
     EnumChild = True
    End Function
    
    End Module
    

     

     

    When you call the sub "GetMcxHandles", it finds Mastercam in memory, and, specifically, the Graphics window.

     

    To use in your code, modify your sub like the following:

     

     Dim GeoMask As GeometryMask = New GeometryMask(False)
     GeoMask.Lines = True
    
     GetMcxHandles()				 ' call main routine to find mastercam in memory
     SetActiveWindow(McxGfxHwnd)	 ' set the focus to MasterCam gfx window
    
     Dim SelectedGeo As Mastercam.Database.Geometry = SelectionManager.AskForGeometry("Select one line", GeoMask)
    
     SetActiveWindow(Me.Handle)	 ' set the focus back to your form
    
    

     

    This code was tested under MasterCam X7, and 64bit. The calls should work in 32 bit, tho.

    • Like 2

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