hexagon logo

VB Script, Using PutText to enter an expression

I want to write a script that can modify the THEO and TARG values of a feature to be an expression, such as "1+0" or "2*VX+4". So far I can change the values to other values but if I give it an expression it always seems to evaluate it first and insert the result rather than the expression itself.

Not sure if what I want to do is possible but after scouring the forum for any examples I am sure that if it is possible someone on here will know how to do it.
Parents
  • This seems to be working... it's pulling the correct values. Going to add a "+0" soon and report back with results.
       Private Sub PullTheos()
            Dim PCDApp As PCDLRN.Application
            Dim PCDPart As PCDLRN.PartProgram
            Dim PCDCommands As Object
            Dim cmd As PCDLRN.Command
            Dim editWin As PCDLRN.EditWindow
    
            PCDApp = CreateObject("PCDLRN.Application")
            PCDPart = PCDApp.ActivePartProgram
            PCDCommands = PCDPart.Commands
            editWin = PCDPart.EditWindow
    
            Dim algnID As String = ""
    
            For Each cmd In PCDCommands
                If cmd.IsAlignment And cmd.ID <> "" Then
                    algnID = cmd.ID
                End If
    
                If cmd.IsDCCFeature Or cmd.IsMeasuredFeature Then
                    If cmd.Marked Then
    
                        Dim oTHEO As PCDLRN.PointData = cmd.FeatureCommand.GetHit(1, PCDLRN.FHITDATA_TYPES.FHITDATA_CENTROID, PCDLRN.FDATA_DATASET.FDATA_THEO, PCDLRN.FDATA_COORDSYS.FDATA_PART, algnID, PCDLRN.ENUM_PLANE_TYPE.PLANE_TOP)
    
                        MsgBox("Feature Name: " & cmd.ID & vbCr & "Alignment Name: " & algnID & vbCr & oTHEO.X.ToString & " " & oTHEO.Y.ToString & " " & oTHEO.Z.ToString)
    
                    End If
                End If
            Next cmd
    
    
            PCDApp = Nothing
            PCDPart = Nothing
            PCDCommands = Nothing
    
        End Sub
    


    Using 2015.1 SP10 on Windows 10 x64.
Reply
  • This seems to be working... it's pulling the correct values. Going to add a "+0" soon and report back with results.
       Private Sub PullTheos()
            Dim PCDApp As PCDLRN.Application
            Dim PCDPart As PCDLRN.PartProgram
            Dim PCDCommands As Object
            Dim cmd As PCDLRN.Command
            Dim editWin As PCDLRN.EditWindow
    
            PCDApp = CreateObject("PCDLRN.Application")
            PCDPart = PCDApp.ActivePartProgram
            PCDCommands = PCDPart.Commands
            editWin = PCDPart.EditWindow
    
            Dim algnID As String = ""
    
            For Each cmd In PCDCommands
                If cmd.IsAlignment And cmd.ID <> "" Then
                    algnID = cmd.ID
                End If
    
                If cmd.IsDCCFeature Or cmd.IsMeasuredFeature Then
                    If cmd.Marked Then
    
                        Dim oTHEO As PCDLRN.PointData = cmd.FeatureCommand.GetHit(1, PCDLRN.FHITDATA_TYPES.FHITDATA_CENTROID, PCDLRN.FDATA_DATASET.FDATA_THEO, PCDLRN.FDATA_COORDSYS.FDATA_PART, algnID, PCDLRN.ENUM_PLANE_TYPE.PLANE_TOP)
    
                        MsgBox("Feature Name: " & cmd.ID & vbCr & "Alignment Name: " & algnID & vbCr & oTHEO.X.ToString & " " & oTHEO.Y.ToString & " " & oTHEO.Z.ToString)
    
                    End If
                End If
            Next cmd
    
    
            PCDApp = Nothing
            PCDPart = Nothing
            PCDCommands = Nothing
    
        End Sub
    


    Using 2015.1 SP10 on Windows 10 x64.
Children
No Data