hexagon logo

Help with OLE Automation

Now that I have information in a way that imports and exports the information correctly, I have been tasked with creating an OLE to automatically import the data into the SPC software. I have one that sort of works (as in opens the program, logs in, opens the right collection plan, etc) and I can get put in static information, but I am unsure how to call the information out of PC DMIS to have it be placed in the spots we need in the SPC software being used.

Has anyone else done this? Can anyone explain to me how find the variable and the measurement output in PC DMIS? I am using version 4.2 if that helps any.

Thanks so much.
Parents
  • Still been working on this and have done a lot, but now I have a syntax error that I don't understand. According to the compiler, it is in the block after the end select. I am sure that I am missing something obvious, but I just don't see it right now.
    Sub PCDinfo
    'Gather Information from part program
    Set ObjApp = CreateObject ("PCDLRN.Application")
    Set ObjPart = ObjApp.ActivePartProgram
    Set ObjCmds = ObjPart.Commands
    
    
    State = 1
    
    For ix = 1 To ObjCmds.Count
    Set ObjCmd = ObjCmds(ix)
    
    For Each ObjCmd in ObjCmds
    If ObjCmd.IsComment Then
       If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then 
          If ObjCmd.ID = "C1" Then
            StrC1 = ObjCmd.CommentCommand.Input
          End If
        End If
      End If
    If ObjCmd.IsComment Then
        If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then 
          If ObjCmd.ID = "C2" Then
            StrC2 = ObjCmd.CommentCommand.Input
          End If
        End If
      End If
    
    If ObjCmd.IsDimension Then
    	Set ObjDimCmd = ObjCmd.DimensionCommand
    	
    	Select Case State
    	
    	Case 1 'Normal case
    		If (ObjDimCmd.OutputMOde <> DIMOUTPUT_NONE) Then
    		    DoOutPut = 1
    		Else 
    		    DoOutPut = 0
    		End If
    		
    		StrDimID = ObjDimCmd.ID
    
    		If (ObjDimCmd.Type = DIMENSION_TRUE_START_POSITION) Then
    		   State = 2
    		ElseIf (ObjDimCmd.Type = DIMENSION_START_LOCATION) Then
    		   State = 3
    		End If
    
    		If (DoOutPut = 1) and (State = 1) Then
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    
    	Case 2 'True Position
    		If (DoOutPut = 1) Then
    		StrDimID = ObjDimCmd.ID
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    
    	Case 3 'Location
    		If (DoOutPut = 1) Then
    		StrDimID = ObjDimCmd.ID
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    	End Select
    
    	If (ObjDimCmd.Type = DIMENSION_TRUE_END_POSITION) Then	
    	  State = 1
    	ElseIf (ObjDimCmd.Type = DIMENSION_END_LOCATION) Then
    	  State = 1
    	End If
    	
    
    	If (StrDimID = "CIRC2 DIA") Then 
    	MyReading1 = StrDimAct
    	End If
    	If (StrDimID = "ROUNDNESS CIRC2") Then 
    	MyReading2 = StrDimAct
    	End If
    	If (StrDimID = "CIRC3 DIA") Then 
    	MyReading3 = StrDimAct
    	End If
    	If (StrDimID = "CIRC6 DIA") Then 
    	MyReading4 = StrDimAct
    	End If
    	If (StrDimID = "ROUNDNESS CIRC6") Then 
    	MyReading5 = StrDimAct
    	End If
    	If (StrDimID = "CONC1") Then 
    	MyReading6 = StrDimAct
    	End If
    	If (StrDimID = "CONC2") Then 
    	MyReading7 = StrDimAct
    	If (StrDimID = "POINT 1Z") Then 
    	MyReading8 = StrDimAct
    	End If
    	If (StrDimID = "POINT 2Z") Then 
    	MyReading9 = StrDimAct
    	End If
    	If (StrDimID = "POINT 3Z") Then 
    	MyReading10 = StrDimAct
    	End If
    	If (StrDimID = "POINT 3Z") Then 
    	MyReading10 = StrDimAct
    	End If
    	If (StrDimID = "PLANE4 Z") Then 
    	MyReading12 = StrDimAct
    	End If
    	If (StrDimID = "PLANE5 Z") Then 
    	MyReading13 = StrDimAct
    	End If
    	If (StrDimID = "POINT5Z") Then 
    	MyReading14 = StrDimAct
    	End If
    	If (StrDimID = "POINT6Z") Then 
    	MyReading15 = StrDimAct
    	End If
    	If (StrDimID = "POINT7Z") Then 
    	MyReading16 = StrDimAct
    	End If
    	If (StrDimID = "POINT8Z") Then 
    	MyReading17 = StrDimAct
    	End If
    
    Next


    Thanks for the help.
Reply
  • Still been working on this and have done a lot, but now I have a syntax error that I don't understand. According to the compiler, it is in the block after the end select. I am sure that I am missing something obvious, but I just don't see it right now.
    Sub PCDinfo
    'Gather Information from part program
    Set ObjApp = CreateObject ("PCDLRN.Application")
    Set ObjPart = ObjApp.ActivePartProgram
    Set ObjCmds = ObjPart.Commands
    
    
    State = 1
    
    For ix = 1 To ObjCmds.Count
    Set ObjCmd = ObjCmds(ix)
    
    For Each ObjCmd in ObjCmds
    If ObjCmd.IsComment Then
       If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then 
          If ObjCmd.ID = "C1" Then
            StrC1 = ObjCmd.CommentCommand.Input
          End If
        End If
      End If
    If ObjCmd.IsComment Then
        If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then 
          If ObjCmd.ID = "C2" Then
            StrC2 = ObjCmd.CommentCommand.Input
          End If
        End If
      End If
    
    If ObjCmd.IsDimension Then
    	Set ObjDimCmd = ObjCmd.DimensionCommand
    	
    	Select Case State
    	
    	Case 1 'Normal case
    		If (ObjDimCmd.OutputMOde <> DIMOUTPUT_NONE) Then
    		    DoOutPut = 1
    		Else 
    		    DoOutPut = 0
    		End If
    		
    		StrDimID = ObjDimCmd.ID
    
    		If (ObjDimCmd.Type = DIMENSION_TRUE_START_POSITION) Then
    		   State = 2
    		ElseIf (ObjDimCmd.Type = DIMENSION_START_LOCATION) Then
    		   State = 3
    		End If
    
    		If (DoOutPut = 1) and (State = 1) Then
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    
    	Case 2 'True Position
    		If (DoOutPut = 1) Then
    		StrDimID = ObjDimCmd.ID
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    
    	Case 3 'Location
    		If (DoOutPut = 1) Then
    		StrDimID = ObjDimCmd.ID
    		StrDimType = ObjDimCmd.TypeDescription
    		StrDimValueType = ObjDimCmd.AxisLetter
    		End If
    		StrDimNom = ObjDimCmd.Nominal
    		StrDimDev = ObjDimCmd.Deviation
    		StrDimAct = StrDimNom + StrDimDev
    		
    		
    	End Select
    
    	If (ObjDimCmd.Type = DIMENSION_TRUE_END_POSITION) Then	
    	  State = 1
    	ElseIf (ObjDimCmd.Type = DIMENSION_END_LOCATION) Then
    	  State = 1
    	End If
    	
    
    	If (StrDimID = "CIRC2 DIA") Then 
    	MyReading1 = StrDimAct
    	End If
    	If (StrDimID = "ROUNDNESS CIRC2") Then 
    	MyReading2 = StrDimAct
    	End If
    	If (StrDimID = "CIRC3 DIA") Then 
    	MyReading3 = StrDimAct
    	End If
    	If (StrDimID = "CIRC6 DIA") Then 
    	MyReading4 = StrDimAct
    	End If
    	If (StrDimID = "ROUNDNESS CIRC6") Then 
    	MyReading5 = StrDimAct
    	End If
    	If (StrDimID = "CONC1") Then 
    	MyReading6 = StrDimAct
    	End If
    	If (StrDimID = "CONC2") Then 
    	MyReading7 = StrDimAct
    	If (StrDimID = "POINT 1Z") Then 
    	MyReading8 = StrDimAct
    	End If
    	If (StrDimID = "POINT 2Z") Then 
    	MyReading9 = StrDimAct
    	End If
    	If (StrDimID = "POINT 3Z") Then 
    	MyReading10 = StrDimAct
    	End If
    	If (StrDimID = "POINT 3Z") Then 
    	MyReading10 = StrDimAct
    	End If
    	If (StrDimID = "PLANE4 Z") Then 
    	MyReading12 = StrDimAct
    	End If
    	If (StrDimID = "PLANE5 Z") Then 
    	MyReading13 = StrDimAct
    	End If
    	If (StrDimID = "POINT5Z") Then 
    	MyReading14 = StrDimAct
    	End If
    	If (StrDimID = "POINT6Z") Then 
    	MyReading15 = StrDimAct
    	End If
    	If (StrDimID = "POINT7Z") Then 
    	MyReading16 = StrDimAct
    	End If
    	If (StrDimID = "POINT8Z") Then 
    	MyReading17 = StrDimAct
    	End If
    
    Next


    Thanks for the help.
Children
No Data