PC-DMIS crashes after script run

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PC-DMIS crashes after script run

    I made a script with dialog box where operafor fill your name and select and choose machine number and type of part. Everything is passed to variables for report header. My problem is that pcdmis ramdom crashes with program execution. Sometimes it is working with no problems and somethimes script causes pcdmis crash many times. And another strange thing is that sometimes dialog box opened but all listboxes are empty. Please do you have some suggestions, what is the cause of these crashes? Here is the script:

    Sub Main

    Dim App As Object
    Set App = CreateObject ("PCDLRN.Application")
    Dim Part As Object
    Set Part = App.ActivePartProgram
    Dim Cmds As Object
    Set Cmds = Part.Commands
    Dim Cmd As Object

    Dim strLine As String
    Dim strDefaultText As String

    Open "D:\operator.txt" For Input As #1
    Line Input #1, strLine
    strLine = mid(strLine,2,len(strLine)-3)
    strDefaultText = strLine
    Close #1

    Dim LaserList$(11)
    LaserList(0) = "Laser 1"
    LaserList(1) = "Laser 2"
    LaserList(2) = "Laser 3"
    LaserList(3) = "Laser 4"
    LaserList(4) = "Laser 5"
    LaserList(5) = "Laser 6"
    LaserList(6) = "Laser 7"
    LaserList(7) = "Laser 8"
    LaserList(8) = "Laser 9"
    LaserList(9) = "Laser 10"
    LaserList(10) = "Laser 11"
    LaserList(11) = "Laser 12"

    Dim SeatType$(2)
    SeatType(0) = "LH"
    SeatType(1) = "RH"
    SeatType(2) = "CC"

    Dim Shift$(1)
    Shift(0) = "Ranní"
    Shift(1) = "Noční"

    Begin Dialog DIALOG_1 31,32,135,135,"CMPV"
    Listbox 15,12,30,30, SeatType$(),.seat
    GroupBox 7,3,45,40,"Typ",.GroupBox1
    Listbox 15,60,30,23, Shift$(),.sft
    GroupBox 7,50,45,33,"Směna",.GroupBox2
    Listbox 70,12,48,66, LaserList$(),.laser
    GroupBox 65,3,60,80,"Laser",.GroupBox3
    Text 16,86,30,12, "Jméno:"
    TextBox 16,96,60,12, .name1
    OKButton 18,112,40,14
    CancelButton 80,112,40,14
    End Dialog

    Dim Dialg As DIALOG_1
    Dialg.name1 = strDefaultText

    Dim ShiftTime
    ShiftTime = Hour(Time)
    If ShiftTime >= 6 And ShiftTime < 18 Then
    Dialg.sft = 0
    Else
    Dialg.sft = 1
    End If

    Dim buttonval As Integer
    buttonval = Dialog(Dialg)

    Dim Opr
    Opr = Dialg.name1
    Open "D:\operator.txt" For Output As #1
    Write #1, Opr
    Close #1

    Dim SeatTpe As String
    Dim LaserNum As String
    Dim ShiftName As String

    If buttonval = 0 Then
    MsgBox "Cancel"
    Else
    Select Case Dialg.seat
    Case 0
    SeatTpe = "LH"
    Case 1
    SeatTpe = "RH"
    Case 2
    SeatTpe = "CC"
    End Select
    Select Case Dialg.laser
    Case 0
    LaserNum = "Laser 1"
    Case 1
    LaserNum = "Laser 2"
    Case 2
    LaserNum = "Laser 3"
    Case 3
    LaserNum = "Laser 4"
    Case 4
    LaserNum = "Laser 5"
    Case 5
    LaserNum = "Laser 6"
    Case 6
    LaserNum = "Laser 7"
    Case 7
    LaserNum = "Laser 8"
    Case 8
    LaserNum = "Laser 9"
    Case 9
    LaserNum = "Laser 10"
    Case 10
    LaserNum = "Laser 11"
    Case 11
    LaserNum = "Laser 12"
    End Select

    Select Case Dialg.sft
    Case 0
    ShiftName = "R"
    Case 1
    ShiftName = "N"
    End Select


    Dim bln

    For Each Cmd In Cmds
    If Cmd.Type = ASSIGNMENT Then
    If Cmd.GetText(DEST_EXPR,0) = "SEAT" Then
    bln = Cmd.PutText("""" + SeatTpe + """", SRC_EXPR, 0)
    Cmd.ReDraw
    End If
    If Cmd.GetText(DEST_EXPR,0) = "LASER" Then
    bln = Cmd.PutText("""" + LaserNum + """", SRC_EXPR, 0)
    Cmd.ReDraw
    End If
    If Cmd.GetText(DEST_EXPR,0) = "NAME" Then
    bln = Cmd.PutText("""" + Opr + """", SRC_EXPR, 0)
    Cmd.ReDraw
    End If
    If Cmd.GetText(DEST_EXPR,0) = "SHIFT" Then
    bln = Cmd.PutText("""" + ShiftName + """", SRC_EXPR, 0)
    Cmd.ReDraw
    End If
    End If
    Next Cmd
    End If
    End Sub

  • #2
    Why do you modify the ASSIGN commands? Why not use GetVariableValue and SetVariableValue instead in the script?

    Which version of PC-DMIS?

    How long is PC-DMIS run between restarts? Do you restart only after crashes? My recommendation to customers is to restart PC-DMIS at least each shift start, to minimize problems with resource leaks. The later versions are better, some older versions worse. It also depends on what the program is doing...
    AndersI
    SW support - Hexagon Metrology Nordic AB

    Comment


    • Robert Hulman
      Robert Hulman commented
      Editing a comment
      We restart Pc dmis each shift at least and we use version 2017 R1

  • #3
    The Get/SetVariableValue only changes the value of the variable, not the actual command in the program. Maybe OP wants it changed so they have traceability or something?
    PC-DMIS CAD++ 2o23.1 SP1

    Comment


    • AndersI
      AndersI commented
      Editing a comment
      He's writing things to a file too, so I don't see the big need for changing the program. Also, if he's changing the program, it is imperative that the ASSIGN statements come *after* the script call, or the changes will not be seen in the current run. Also, I'm allergic to selfmodifying programs...

    • vpt.se
      vpt.se commented
      Editing a comment
      Missed that one, but yes - one of them feels redundant unless "operator.txt" is read by something else.

    • Robert Hulman
      Robert Hulman commented
      Editing a comment
      Yes i write operators name to txt to hold operators name during shift, because without that i would have to type the name each run

  • #4
    I'll say it again, but I'd use Forms for this type of thing.

    So much easier.
    Applications Engineer
    Hexagon UK

    Comment


    • vpt.se
      vpt.se commented
      Editing a comment
      I thought the same as you, AndersI but then quickly realised that by doing so - I was the only one that could understand the sources/edit them...

      So now I try to my coding in PC-DMIS basic, VBA or C# instead.

    • AndersI
      AndersI commented
      Editing a comment
      Job security...

    • vpt.se
      vpt.se commented
      Editing a comment
      Lol! Well, at least I had that going for me...

  • #5
    Did this ever get figured out?

    My PC-DMIS crashes any time I run a script and I would love to fix it.
    PC-DMIS 2018 R2 Build #504 SP8
    Hexagon Absolute Arm 85

    Comment


    • Henniger123
      Henniger123 commented
      Editing a comment
      does the script run in Excel or another platform ?

      for example pcDMis-Basic just crashs if you try to call an not dimed/not set Object etc.
      ah and pcDMIS dont like Array-Lists .. if you try to read a list-item that was not be writen than it maybe crashes.

      the fact that it crashes every Time says to me that your script has a typo or you try to call a non dimed/not set object.


      take a litte time and put a lot of msgboxes, so you can see at what point it crashes.
      or better debug it for every line in Excel.

  • #6
    1. what is your script doing?
    2. what pcdmis version?

    Comment


    • #7
      1. Literally any script I run hangs up PC-DMIS and it's left Not Responding until I force close it. I've downloaded and copied a few from these forums trying to get an Excel report. Then I went into some basic coding links from here and even a quick script with a simple test message box. The only time it didn't' freeze was when I had a completely empty script with no text whatsoever inside it.

      2. CAD++ 2018 R2 - Build 504 SP8
      PC-DMIS 2018 R2 Build #504 SP8
      Hexagon Absolute Arm 85

      Comment


      • SABarber
        SABarber commented
        Editing a comment
        try running pcdmis as administrstor to see if it helps.

    • #8
      SABarber I've done that with absolutely no difference. I have it set to automatically open as Administrator, and even tried without it
      PC-DMIS 2018 R2 Build #504 SP8
      Hexagon Absolute Arm 85

      Comment


      • SABarber
        SABarber commented
        Editing a comment
        Post a sample script you are running.

    • #10
      Hi bjgalbreath , as I said in my other post (https://www.pcdmisforum.com/forum/pc...409#post488409) this sounds like a bug that got fixed for 2018 R2 and was also pushed back to 2017 R2 SP11 and 2018 R1 SP 3. However, I think you said that you are already running 2018 R2 SP8, are you able to update to a later service pack or version? I'm seeing up to SP14 available for 2018 R2.
      Neil Challinor
      PC-DMIS Product Owner

      T: +44 870 446 2667 (Hexagon UK office)
      E: [email protected]

      Comment


      • #11
        I know my company's license is up. They bought this well over 3 years ago and it sat until they finally hired an operator (me) for it this month. I'm not sure what I can update to, but the latest that shows up in the update center is out of the license.

        EDIT: Viewing the licenses, they all read 1/31/2020 under the feature version, and SP8 is the latest version released before that date. SP9 was released 2/06/2020 so I don't think I can update even to that.
        Last edited by bjgalbreath; 03-31-2021, 10:05 AM.
        PC-DMIS 2018 R2 Build #504 SP8
        Hexagon Absolute Arm 85

        Comment


        • SABarber
          SABarber commented
          Editing a comment
          I know this does not help but I ran my 2018 R2 SP7 with a simple script and had no issues. I wonder if there is a IT registry setting blocking things from working.

          Sub Main

          Dim App As Object
          Set App = CreateObject("PCDLRN.Application")
          Dim Part As Object
          Set Part = App.ActivePartProgram
          Dim Cmds As Object
          Set Cmds = Part.Commands
          Dim Cmd As Object
          Dim SCmd As Object
          Dim FCmd As Object
          Dim HitCount As Integer
          Dim Point As PointData
          Dim PointT As PointData
          Dim PointV As PointData
          Dim I As Integer
          Dim TValue As Double

          msgbox "this works"

          End Sub

      • #12
        Originally posted by SABarber
        I wonder if there is a IT registry setting blocking things from working.
        How would I go about checking that?

        PC-DMIS 2018 R2 Build #504 SP8
        Hexagon Absolute Arm 85

        Comment


        • SABarber
          SABarber commented
          Editing a comment
          That is beyond my knowledge. Maybe an IT person would know?

          Another script to test to take some things

          Sub Main
          msgbox "this works"
          End Sub

          if this works it is the pcdmis application connection that is an issue. If it doesn't something is stopping the script from running.
          Last edited by SABarber; 03-31-2021, 11:19 AM.

      • #13
        bjgalbreath Are you submitting those crash reports? Can you send (PM) me your license information so I can track them down to see if they tell us anything? Alternatively, send me the e-mail you write into the crash submission but that is case sensitive.

        Comment


        • #14
          Don Ruggieri there are no crash reports to send. The program hangs up for as long as I let it (I let it sit nearly 2 hours yesterday) until I try to X it out at the top corner, then the "PC DMIS application is not responding" box comes up. But it doesn't give me the option to send Hexagon a crash report.
          Last edited by bjgalbreath; 03-31-2021, 10:47 AM.
          PC-DMIS 2018 R2 Build #504 SP8
          Hexagon Absolute Arm 85

          Comment


          • #15

            Code:
            Sub main()
            msgbox("Does this work?")
            End sub
            I tried this the other day from another thread I couldn't find the link for until just a few minutes ago.

            SABarber I even just tried yours without the parentheses and different capitalization. It all hangs up just the same.



            EDIT: IT WORKS!

            Thanks to the following post, I went into Settings Editor and changed the UnicodeScripts value from 1 to 0 and the scripts are working now.

            https://www.pcdmisforum.com/forum/pc...7618#post57618
            Last edited by bjgalbreath; 03-31-2021, 12:53 PM.
            PC-DMIS 2018 R2 Build #504 SP8
            Hexagon Absolute Arm 85

            Comment


            • SABarber
              SABarber commented
              Editing a comment
              seems you cannot run scripts. I'm assuming you are trying from within pcdmis using the View/Basic Script Editor to edit and run the script?
              I have not seen this issue.

          Related Topics

          Collapse

          Working...
          X