hexagon logo

Basic Script for Execution

Hello all,

Before I spend a bunch of time digging into this I figured I would reach out to the community fist.  Somebody may already have created the kind of script.  My company has decided to get away from Datapage since it is no longer supported.  All reports end up put into an excel file, so that is my end goal.  I want a script that will execute all dimensions (all dimensions in a single execution).  I will simply place that at the end of our thousands of existing programs with the excel form report.  This would give me the ability to not have to install excel on 12 machines utilizing the excel form report within DMIS.  (already have a manipulated script that maps everything out to an excel file)  I just want to be able to execute the script and excel form report code together, so there is always full complete report uploaded.  I want the operators to be able to correct any errors as needed while running and then always include a complete report so we are not combining multiple reports together or appending the single report.  To put simply I just want the ability to create every dimension in the same execution (dimensions only).

Regards,

Matt Eaders

Parents
  • I appreciate all the help!  I will have to take my previous script that loops through all the dimensions in the edit window and remove most of the meat to just execute said dimensions.  Essentially executing all dimensions at once without having to rely on much input from the operator other that review and press the button lol.  Again appreciate the help! Figured I'd reach out and see what other ideas may exist that I am not aware of.

  • I have a a script that I found on this forum(it was incomplete and I had to update a lot of things) some time ago that generates excel files all using basic scripting. Would you like me to share it to get a better idea of what you want to do?

  • William, Thanks for your help.  I already have a similiar one that creates the perfect excel file.  Same thing as you did, I found it on here, completed it, and modified it to everything I need it to be.  My company is wanting to move away from Datapage and was looking into Q-DAS, so the script gives us option #1 to get away from Datapage.  I am only trying to create another script to avoid the cost of having to install excel on 12 computers.  Utilizing the excel form report that doesn't actually need excel on the computer.  I just hate the way excel form report gathers the data from the edit window per execution.  I had already set this all up back in 2020 when it first came out, but after testing how it would work, we lost the ability to run blocks throughout the program and update our report.  I could execute a mini routine to avoid this as well, but I don't want to put that on the operators.  Automation is king!!  When I get through the current wave of jobs I have I will get back on the script.

  • We probably found the same script! That thing was a mess...

    I have actually just 2 days ago created a script that executes a block of code using basic script. Would that be of any use for you? It contains dropdown list dialog boxes to use as a start and end command. It can certainly be modified to run "x block" and then recalculate the dimensions.

Reply Children
  • It must have been the same one lol the whole things pretty much needed mapped out.  Yes! that may be useful as that was one avenue of the script I was exploring.  I would appreciate it very much if you could!

  • This is something I threw together just for practice for another user on the forum. It currently is set to only collect features, but can easily be changed to contain DimensionCommands If you need help with this you can always send me a DM.

    Edit: I added the functionality to execute the dimension commands again after executing the selected code block to help update dimensions. Included a check method to ignore "DATDEF" as they are considered DimensionCommands

    Sub Main()
        Dim DmisApp As Object
        Set DmisApp = CreateObject("PCDLRN.Application")
        Dim DmisParts As Object
        Set DmisParts = DmisApp.PartPrograms
        Dim DmisPart As Object
        Set DmisPart = DmisApp.ActivePartProgram
        Dim DmisCmds As Object
        Set DmisCmds = DmisPart.Commands
        Dim DmisCmd As Object
        Dim EditWin As Object
        Set EditWin = DmisPart.EditWindow
        Dim StartCmd As Object
        Dim EndCmd As Object
        Dim FeatureList$(99999)
    
    Fcntr = 0    
    For Each DmisCmd In DmisCmds
            If DmisCmd.IsMeasuredFeature Then
    	' Measured (learned) feature
                FeatureList(Fcntr) = DmisCmd
                Fcntr = Fcntr + 1
            End If        
            If DmisCmd.IsDCCFeature Then
    	' Autofeature (flagged As DCC feature)
                 FeatureList(Fcntr) = DmisCmd
                 Fcntr = Fcntr + 1
            End If
    Next DmisCmd 'Get the Next Feature
    
    'Dialog Box Parameters: X, Y (position), DX, DY (size), Title, VariableName.
    Begin Dialog DIALOG_1 31,48, 155, 80, "Select Features For Execution Block"
      Text 10,8,50,12, "Start Command"
      Text 80,8,50,12, "End Command"
      DropListBox 10,20,60,80, FeatureList$(), .ListBox1
      DropListBox 80,20,60,80, FeatureList$(), .ListBox2
      PushButton 10,40,50,12, "Execute Block", .PointsBtn
      PushButton 80,40,50,12, "Cancel", .CancelBtn
    End Dialog
    
    Dim Dlg1 As DIALOG_1
    button = Dialog(Dlg1)
     'button 1 = Execute 
     'button 2 = Cancel
    
    If button = 1 Then
    
      Set StartCmd = DmisCmds.Item(FeatureList(Dlg1.Listbox1))
      Set EndCmd = DmisCmds.Item(FeatureList(Dlg1.Listbox2))
    
      EditWin.Visible = True
      EditWin.selectCommands StartCmd, EndCmd
      DmisPart.SetExecutionBlock StartCmd, EndCmd
      DmisPart.Execute
    End If
    
    If button = 2 Then 'Cancel Execution
      GoTo 2
    End If
    
    'Execute dimension commands after block
    Fcntr = 0
    For Each DmisCmd In DmisCmds
            'Tells script To ignore Any datum definitions As they are considered Dimension commands
            If DmisCmd.IsDimension And Not DmisCmd.Type = DATDEF_COMMAND Then
                FeatureList(Fcntr) = DmisCmd
                Fcntr = Fcntr + 1
            End If
    Next DmisCmd
    Set StartCmd = DmisCmds.Item(FeatureList(0))
    Set EndCmd = DmisCmds.Item(FeatureList(Fcntr - 1))
    EditWin.Visible = True
    EditWin.selectCommands StartCmd, EndCmd
    DmisPart.SetExecutionBlock StartCmd, EndCmd
    DmisPart.Execute
    
    2:
        Set DmisCmd = Nothing
        Set DmisCmds = Nothing
        Set DmisPart = Nothing
        Set DmisParts = Nothing
        Set DmisApp = Nothing
        Set EditWin = Nothing
    
    End Sub