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:

Lee1

Verified Members
  • Posts

    71
  • Joined

  • Last visited

Posts posted by Lee1

  1. Mastercam 2022 or late version, the CInterrogateMastercamFile function is change?

    chooks 2021 code update to 2022, the CInterrogateMastercamFile function error?

     

    how to fix this error, thanks.


       

        CInterrogateMastercamFile  fileInterrogator
    
    
        CString mcxFileName = _T("E:\\Mastercam\\mc\\2023-08-26.mcam");//full path
    
        CLibraryOperation::EntAllocation  entAllocation = CLibraryOperation::EntAllocation::LoadAndKeep;//LoadAndFree,LoadAndKeep
    
        bool kk = fileInterrogator.CInterrogateMastercamFile::Load(mcxFileName, entAllocation);
    
        bool isLoad = fileInterrogator.IsLoaded();
        bool isExterlfile = fileInterrogator.IsExternalFile();

     

  2. Below has NetHooks  get selection operation parameter shown MainView, but only get one operation, if selection other operation show error and the parameter not update, I don't know where is error

     

     

    'Option Infer On
    
    ' -----------------------------------------------------------------------
    ' <copyright file="NETHookMain.vb" company="CNC Software, Inc.">
    ' Copyright 2014 CNC Software, Inc..
    ' </copyright>
    ' -----------------------------------------------------------------------
    
    Imports Mastercam.Database.Types
    Imports Mastercam.IO
    Imports Mastercam.IO.Types
    Imports Mastercam.Math
    Imports Mastercam.Support
    Imports System.Globalization
    Imports Mastercam.App
    Imports Mastercam.App.Types
    Imports Mastercam.BasicGeometry
    Imports Mastercam.Database
    
    Imports System.Collections.Generic
    Imports System.Diagnostics.CodeAnalysis
    Imports System.IO
    Imports System.Windows.Forms
    Imports Mastercam.Operations
    Imports Mastercam.Support.Group
    Imports Mastercam.Tools
    Imports Mastercam.GeometryUtility.Types
    Imports System.Math
    
    
    Namespace QuickParameters
    
        Public Class NETHookMain
            Inherits NetHook3App
    
    #Region "System Public Methods"
    
            Public Overrides Function Init(ByVal param As Integer) As MCamReturn
                Return MCamReturn.NoErrors
            End Function
    
    
            Public Overrides Function Run(ByVal param As Integer) As MCamReturn
    
                Using f As New MainView()
                    'f.ShowDialog()
                End Using
                GetParameter()
                Return MCamReturn.NoErrors
    
            End Function
    
            Public Overrides Function Close(ByVal param As Integer) As MCamReturn
                Return MCamReturn.NoErrors
            End Function
    
            Public Overrides Function Notify(ByVal event_code As MCamEvent) As MCamReturn
                Select Case event_code
                    Case MCamEvent.OperationSelectionsChanged
                        Dim selectedOperations = SearchManager.GetOperations()
                        Dim ss = SearchManager.GetOperation(True)
                        Dim xx As Boolean = ss.Selected
    
                        If xx = True Then
                            GetParameter(xx)
    
                        End If
    
                        'End If
                        Return MCamReturn.NoErrors
                    Case Else
                        Return MCamReturn.NoErrors
                End Select
            End Function
    
    #End Region
            Public Function GetParameter(Optional onlySelectedOps As Boolean = True) As Integer
                Dim Main As New MainView
                Dim sTool_typ As String = String.Empty
                Dim sOp_typ As String = String.Empty
                Dim sTool_clc As Double
                'Dim ops = SearchManager.GetOperations(onlySelectedOps)
                Dim ops = SearchManager.GetOperations(onlySelectedOps)
                Main.Update()
                Try
                    For Each op As Operation In ops
                        Select Case op.OperationTool.ToolTypeID
                            Case 1
                                sTool_typ = "CenterDrillTool"
                            Case 2
                                sTool_typ = "SpotDrillTool"
                            Case 3
                                sTool_typ = "DrillTool"
                            Case 4
                                sTool_typ = "TapRHTool"
                            Case 5
                                sTool_typ = "TapLHTool"
                            Case 6
                                sTool_typ = "ReamerTool"
                            Case 7
                                sTool_typ = "BoreTool"
                            Case 8
                                sTool_typ = "CounterBoreTool"
                            Case 9
                                sTool_typ = "CounterSinkTool"
                            Case 10
                                sTool_typ = "EndMillFlatTool"
                            Case 11
                                sTool_typ = "EndMillSphericalTool"
                            Case 12
                                sTool_typ = "ChamferMillTool"
                            Case 13
                                sTool_typ = "FaceMillTool"
                            Case 14
                                sTool_typ = "SlotMillTool"
                            Case 15
                                sTool_typ = "RadiusMillTool"
                            Case 16
                                sTool_typ = "DoveMillTool"
                            Case 17
                                sTool_typ = "TaperedMillTool"
                            Case 18
                                sTool_typ = "LollipopMillTool"
                            Case 19
                                sTool_typ = "EndMillBullnoseTool"
                            Case 20
                                sTool_typ = "EngraveTool"
                            Case 21
                                sTool_typ = "BradPointDrillTool"
                            Case Else
                                sTool_typ = "UndefinedTool"
                        End Select
    
                        Select Case op.Type
                            Case 0
                                sOp_typ = "Unknown"
                            Case 1
                                sOp_typ = "Contour"
                            Case 2
                                sOp_typ = "Drilling 3-Axis Output Format"
                            Case 3
                                sOp_typ = "Pocket"
                            Case 4
                                sOp_typ = "Transform"
                            Case 5
                                sOp_typ = "Multisurface rough parallel"
                            Case 6
                                sOp_typ = "Multisurface rough radial"
                            Case 7
                                sOp_typ = "Multisurface rough project"
                            Case 8
                                sOp_typ = "Multisurface rough flowline"
                            Case 9
                                sOp_typ = "Multisurface rough contour"
                            Case 10
                                sOp_typ = "Multisurface rough pocket"
                            Case 11
                                sOp_typ = "Multisurface finish parallel"
                            Case 12
                                sOp_typ = "Multisurface finish radial"
                            Case 13
                                sOp_typ = "Multisurface finish project"
                            Case 14
                                sOp_typ = "Multisurface finish flowline"
                            Case 15
                                sOp_typ = "Multisurface finish contour"
                            Case 16
                                sOp_typ = "C-Hook Toolpath"
                            Case 17
                                sOp_typ = "Manual entry"
                            Case 18
                                sOp_typ = "Circle mill 3 Axis Output Format"
                            Case 19
                                sOp_typ = "Point"
                            Case 20
                                sOp_typ = "Trimmed"
                            Case 21
                                sOp_typ = "Ruled"
                            Case 22
                                sOp_typ = "Revolved"
                            Case 23
                                sOp_typ = "Letters"
                            Case 24
                                sOp_typ = "Swept 2D"
                            Case 25
                                sOp_typ = "Swept 3D"
                            Case 26
                                sOp_typ = "Coons"
                            Case 27
                                sOp_typ = "Lofted"
                            Case 28
                                sOp_typ = "Drilling 4 Axis or 5 Axis Output Format"
                            Case 29
                                sOp_typ = "-axis curve"
                            Case 30
                                sOp_typ = "Project toolpath onto a plane"
                            Case 31
                                sOp_typ = "Project toolpath onto a cylinder"
                            Case 32
                                sOp_typ = "Project toolpath onto a sphere"
                            Case 33
                                sOp_typ = "Project toolpath onto a cone"
                            Case 34
                                sOp_typ = "Project toolpath onto a cross section"
                            Case 35
                                sOp_typ = "Project toolpath onto a surface"
                            Case 36
                                sOp_typ = "Non-associative contour"
                            Case 37
                                sOp_typ = "Non-associative drilling"
                            Case 38
                                sOp_typ = "Non-associative pocketing"
                            Case 39
                                sOp_typ = "Multisurface finish pencil trace"
                            Case 40
                                sOp_typ = "Multisurface finish leftover stock"
                            Case 41
                                sOp_typ = "Multisurface finish steep"
                            Case 42
                                sOp_typ = "Multisurface finish shallow"
                            Case 43
                                sOp_typ = "Multisurface finish constant scallop"
                            Case 44
                                sOp_typ = "Multisurface rough plunge"
                            Case 45
                                sOp_typ = "Multisurface finish -axis flowline"
                            Case 46
                                sOp_typ = "Multisurface finish -axis"
                            Case 47
                                sOp_typ = "Merged in ASCII NCI"
                            Case 48
                                sOp_typ = "5-axis swarf"
                            Case 49
                                sOp_typ = "5-axis roll die"
                            Case 50
                                sOp_typ = "Unknown"
                            Case 99
                                sOp_typ = "Unknown"
                            Case 100
                                sOp_typ = "Thread mill"
                            Case 101
                                sOp_typ = "Edit common operation parameters"
                            Case 102
                                sOp_typ = "Facing"
                            Case 103
                                sOp_typ = "Associative trimmed"
                            Case 104
                                sOp_typ = "Solid drill control"
                            Case 105
                                sOp_typ = "Slot mill"
                            Case 106
                                sOp_typ = "Helix bore"
                            Case 107
                                sOp_typ = "Multi-surface rough restmill"
                            Case 108
                                sOp_typ = "Associative nesting container"
                            Case 109
                                sOp_typ = "Multi-surface finish blend"
                            Case 110
                                sOp_typ = "Multi-surface -axis, rough"
                            Case 111
                                sOp_typ = "Slice 5-axis"
                            Case 112
                                sOp_typ = "Port 5-axis"
                            Case 113
                                sOp_typ = "Circle mill 4-Axis or 5-Axis Output Format"
                            Case 114
                                sOp_typ = "Advanced drill"
                            Case 115
                                sOp_typ = "Chamfer drill"
                            Case 116
                                sOp_typ = "Unknown"
                            Case 129
                                sOp_typ = "Unknown"
                            Case 130
                                sOp_typ = "Tab cutoff"
                            Case 131
                                sOp_typ = "Multi-surface rough pocket, light"
                            Case 132
                                sOp_typ = "High-speed surface toolpaths"
                            Case 133
                                sOp_typ = "Nesting onionskin"
                            Case 134
                                sOp_typ = "2D hardmill machining/peel mill"
                            Case 135
                                sOp_typ = "Saw"
                            Case 136
                                sOp_typ = "FBM drill control"
                            Case 137
                                sOp_typ = "FBM mill pocket"
                            Case 138
                                sOp_typ = "FBM mill contour"
                            Case 139
                                sOp_typ = "Solid model"
                            Case 140
                                sOp_typ = "2D model chamfer"
                            Case 141
                                sOp_typ = "Unknown"
                            Case 149
                                sOp_typ = "Unknown"
                            Case 150
                                sOp_typ = "Probe cycle: probe motion"
                            Case 151
                                sOp_typ = "Probe cycle command block"
                            Case 152
                                sOp_typ = "Probe cycle header"
                            Case 153
                                sOp_typ = "Probe cycle trailer"
                            Case 154
                                sOp_typ = "SafetyZone linking or multiaxis linking"
                            Case 155
                                sOp_typ = "SafetyZone for multiaxis drill - only used for link_op"
                            Case 156
                                sOp_typ = "Unknown"
                            Case 300
                                sOp_typ = "Unknown"
                            Case 301
                                sOp_typ = "Router contour - obsolete"
                            Case 302
                                sOp_typ = "Router pocket - obsolete"
                            Case 303
                                sOp_typ = "Router circmill - obsolete"
                            Case 304
                                sOp_typ = "Router cutoff - obsolete"
                            Case 305
                                sOp_typ = "Router surface rough pocket - obsolete"
                            Case 306
                                sOp_typ = "Block drill"
                            Case 307
                                sOp_typ = "Unknown"
                            Case 415
                                sOp_typ = "Unknown"
                            Case 416
                                sOp_typ = "Engraving"
                            Case 417
                                sOp_typ = "Unknown"
                            Case 438
                                sOp_typ = "Unknown"
                            Case 439
                                sOp_typ = "Art"
                            Case 440
                                sOp_typ = "Advanced multiaxis X9 and older"
                            Case 441
                                sOp_typ = "Advanced multiaxis-Swarf"
                            Case 442
                                sOp_typ = "Advanced multiaxis-Morph"
                            Case 443
                                sOp_typ = "Advanced multiaxis-Parallel"
                            Case 444
                                sOp_typ = "Advanced multiaxis-Along curve"
                            Case 445
                                sOp_typ = "Advanced multiaxis-Triangular mesh"
                            Case 446
                                sOp_typ = "Advanced multiaxis-Roughing"
                            Case 447
                                sOp_typ = "Advanced multiaxis-Project"
                            Case 448
                                sOp_typ = "Convert to 5-axis"
                            Case 449
                                sOp_typ = "Port Expert"
                            Case 450
                                sOp_typ = "Blade Expert"
                            Case 451
                                sOp_typ = "Rotary advanced"
                            Case 452
                                sOp_typ = "Unknown"
                            Case 458
                                sOp_typ = "Unknown"
                            Case 459
                                sOp_typ = "Deburr"
                            Case 460
                                sOp_typ = "3+2 Automatic roughing"
                            Case 461
                                sOp_typ = "Unknown"
                        End Select
    
                        sTool_clc = Round(op.CalcCycleTime, 3)
                        Dim x As Long = Int(sTool_clc / 3600) 'hour
                        Dim y As Long = Int(((sTool_clc - x * 3600) / 60)) 'min
                        Dim z As Long = Round((sTool_clc - x * 3600 - y * 60), 2)
                        Dim sTime As String = x.ToString("00") & ":" & y.ToString("00") & ":" & z.ToString("00")
                        'MsgBox(sTool_clc)
                        sTool_min = op.GetMinimumZ.ToString
    
                        Main.Label1.Text = op.OperationTool.Number
                        Main.Label2.Text = sOp_typ
                        Main.Label3.Text = op.OperationTool.Diameter
                        Main.Label4.Text = op.OperationTool.LengthOffset
                        Main.Label5.Text = op.FeedRate
                        Main.Label6.Text = op.SpindleSpeed
                        Main.Label7.Text = op.ToolPlane.ViewName
                        Main.Label8.Text = op.ToolPlane.WorkOffsetNumber
                        Main.Label9.Text = op.PlungeRate
                        Main.Label10.Text = op.GetMinimumZ
                        Main.Label11.Text = op.GetMaximumZ
                        Main.Label12.Text = sTime
                        Main.Label13.Text = op.OperationTool.CornerRadius
                        Main.Label14.Text = sTool_typ
                        Main.Show()
                        Main.TopMost = True
    
                    Next
                    'Main.Hide()
                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                End Try
    
                Return True
            End Function
        End Class
    End Namespace

     

  3. 10 hours ago, huskermcdoogle said:

    Check your misc ints in your ops, as well as how your planes are setup. 

    Then check the following:

    
    shift_90_s is set to 1
    bias_null is 1 
    mtype is 0 
    spind_align is 3
    Machine base matrix is set for VMC
    

    Then read through the rest of the settings in the post under the "Debugging and Factory Set Program Switches" section to see if they make sense for what you want.

    Possibly post a sample file, so we can take a look and see.  Since it is a generic post, you can zip to go it all up if you post a sample, then we can help you by digging into your post if we have time, to help steer you in the right direction.  It's hard to help when we are blind.  

    What version are you running?

    Husker

    The post is ok.

    Thank you so much.

    too :mellow:

     

  4. 2 hours ago, huskermcdoogle said:

    I would start with the following, and see how it works.

     

    
    #Primary axis angle description (in machine base terms)
    #With nutating (mtype 3-5) the nutating axis must be the XY plane
    rotaxis1$ = vecx  #Zero
    rotdir1$  = vecy  #Direction
    
    #Secondary axis angle description (in machine base terms)
    #With nutating (mtype 3-5) the nutating axis and this plane normal
    #are aligned to calculate the secondary angle
    rotaxis2$ = vecz  #Zero
    rotdir2$  = -vecx  #Direction

    For the limits, set as below.

    
    #Set pri_limtyp and sec_limtyp on following conditions
    #0 = Less than 180 degrees
    #1 = Equal or greater than 180 degrees and less than 360 degrees
    #2 = Soft limit at 0-360 degrees with hard limits slightly beyond
         #Set limhi-limlo to hard limits, inthi-intlo to 360 degrees total
         #limhi-limlo are expected equal amount from inthi-intlo
    #3 = Greater than 360 degrees
    auto_set_lim : 1     #Set the type from the angle limit settings (ignore these)
    pri_limtyp$  : 0
    sec_limtyp$  : 0
    
    #Rotary axis travel limits, always in terms of normal angle output
    #Set the absolute angles for axis travel on primary
    pri_limlo$   : -999999
    pri_limhi$   : 999999
    #Set intermediate angle, in limits, for post to reposition machine
    pri_intlo$   : -99999
    pri_inthi$   : 99999 
    
    #Set the absolute angles for axis travel on secondary
    sec_limlo$   : -110
    sec_limhi$   : 45
    #Set intermediate angle, in limits, for post to reposition machine
    sec_intlo$   : -110
    sec_inthi$   : 45

     

    There will likely be a fair bit more work past this.

    thanks a lot .

    but post process fail,error msg

    "ERROR-THE TOOL CAN NOT BE POSITIONED WITHIN MACHINE ROTARY LIMITS"

     

  5. On 2017/8/13 at 9:12 PM, Mick George said:

    If you just want to add the current time and date you can do that in the post, you don't need a NET-Hook to do that as Roger mentioned above.

    I don't know where the problem is, and if you can provide a similar method or code, thank you very much.

    in vb.net source code

            Public Overrides Function Run(ByVal param As Integer) As MCamReturn
                Dim username As String
                Dim strComputerName As String


                username = Environment.GetEnvironmentVariable("USERNAME")
                strComputerName = Environment.GetEnvironmentVariable("COMPUTERNAME")

                'DialogManager.OK(username + vbCrLf + strComputerName, "Logname")

                PostingManager.PostProcessorArguments = Val(username)

                Return MCamReturn.NoErrors
            End Function

    in mpfan.pst source code

    sparams : ""                  # Will be the command parameter line passed to the DLL

    strDll : "C:\Program Files (x86)\mcamx5\chooks\Logname.dll"
    #-----------------------------------------------------------------------------
    # Below code added your post same location
    #-----------------------------------------------------------------------------       
    pheader$         #Call before start of file
         
          result = dll(strDll,sparams)
          *sparams,e$

    error info

    无标题.png

  6. On ‎2017‎年‎8‎月‎13‎日 at 9:10 PM, Mick George said:

    Where did you add your icons? What are the icons names and do they match the names in your FT?

    in resource-> function->ico

    bath_16.png

    bath_24.png

    in ft file define ico

    FUNCTION NET "Run"
        dnSPNG   "bath_16"
        dnLPNG   "bath_24"
        dnTIP    "TIP_STR"
    END_FUNCTION

    but in chooks folder no bath_16.png&bath_24.png files

  7. On 2017/8/8 at 3:30 AM, Roger Martin from CNC Software said:

    What you are asking for is possible .
    X5 was when the ability to get data “directly” back from an add-in (C-Hook or NET-Hook) that was run from within a PST became available.

    Is not the Date and Time data already available in the MP Post language?
    Here is from the std. MPFAN.PST from X7, showing different output styles ->

    sopen_prn, "DATE=DD-MM-YY - ", date$, " TIME=HH:MM - ", time$, sclose_prn, e$ #Date and time output Ex. 12-02-05 15:52
    #sopen_prn, "DATE - ", month$, "-", day$, "-", year$, sclose_prn, e$  #Date output as month,day,year - Ex. 02-12-05
    #sopen_prn, "DATE - ", *smonth, " ", day$, " ", *year2, sclose_prn, e$ #Date output as month,day,year - Ex. Feb. 12 2005
    #sopen_prn, "TIME - ", time$, sclose_prn, e$  #24 hour time output - Ex. 15:52
    #sopen_prn, "TIME - ", ptime sclose_prn, e$  #12 hour time output 3:52 PM


     

    i want to know how to use vb.net devlopment dll link post for sample,that how can do it ?

  8. 15 hours ago, Roger Martin from CNC Software said:

    What you are asking for is possible .
    X5 was when the ability to get data “directly” back from an add-in (C-Hook or NET-Hook) that was run from within a PST became available.

    Is not the Date and Time data already available in the MP Post language?
    Here is from the std. MPFAN.PST from X7, showing different output styles ->

    sopen_prn, "DATE=DD-MM-YY - ", date$, " TIME=HH:MM - ", time$, sclose_prn, e$ #Date and time output Ex. 12-02-05 15:52
    #sopen_prn, "DATE - ", month$, "-", day$, "-", year$, sclose_prn, e$  #Date output as month,day,year - Ex. 02-12-05
    #sopen_prn, "DATE - ", *smonth, " ", day$, " ", *year2, sclose_prn, e$ #Date output as month,day,year - Ex. Feb. 12 2005
    #sopen_prn, "TIME - ", time$, sclose_prn, e$  #24 hour time output - Ex. 15:52
    #sopen_prn, "TIME - ", ptime sclose_prn, e$  #12 hour time output 3:52 PM


     

    I know in pst has this parameter,but i want use vb.net to get this value,.

    i think know vb.net method  to do .

    thanks.

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