Change Tracefield...

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

  • Change Tracefield...

    Hello!

    Trying to change a tracefield value using VBA, it is behaving weirdly. I can change the internal value, but it still has the old string written with quote marks entered in the edit-window and that does not change. Upon execution of the tracefield it then resets to the old string. Anyone encountered this? The change works if there is a text without quotation marks. I tried the value-function and setexpression, neither works on the quote-text.

  • #2
    Post the code you are using?
    PC-DMIS CAD++ 2o22.1 SP2

    Comment


    • #3
      hello,

      thats works for me in v2021.2 sp4
      with or without quotation

      Code:
      Sub Main()
      Dim DmisApp As Object
      Dim DmisPart As Object
      Dim DmisCommands As Object
      Dim DmisCommand As Object
      
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set DmisCommands = DmisPart.Commands
      
      For Each DmisCommand In DmisCommands
      If DmisCommand.Type = TRACEFIELD Then
      retVal = DmisCommand.PutText("should work", TRACE_VALUE, 0)
      Exit For
      End If
      Next DmisCommand
      
      DmisPart.RefreshPart
      End Sub

      if you want to set quotation within pcDMIS use something like this
      Code:
      Sub Main()
      Dim DmisApp As Object
      Dim DmisPart As Object
      Dim DmisCommands As Object
      Dim DmisCommand As Object
      
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set DmisCommands = DmisPart.Commands
      
      For Each DmisCommand In DmisCommands
      If DmisCommand.Type = TRACEFIELD Then
      retVal = DmisCommand.PutText("should work", TRACE_VALUE, 0)
      retVal = DmisCommand.SetExpression("""should work""", TRACE_VALUE, 0)
      Exit For
      End If
      Next DmisCommand
      
      DmisPart.RefreshPart
      End Sub

      Comment

      Related Topics

      Collapse

      Working...
      X