Passing Features to VB Script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing Features to VB Script

    Does anyone know how I can pass a feature / dimension / measurement from PC-DMIS to a VB Script and access it's measured value / tolerances / deviation / etc in the script? I have been able to pass numeric and string parameters, but not geometric objects.

  • #2
    try this

    Instead of passing features into a script, I use the script to find the feature and extract the data I need. Here is one example (assuming certain declarations are in place for the script). . .

    For Each cmd In cmds
    If cmd.IsFeature And cmd.ID = "PLN1" Then
    MX = cmd.GetText(MEAS_X, 0)
    MY = cmd.GetText(MEAS_Y, 0)
    mz = cmd.GetText(MEAS_Z, 0)
    MI = cmd.GetText(MEAS_I, 0)
    MJ = cmd.GetText(MEAS_J, 0)
    MK = cmd.GetText(MEAS_K, 0)
    End If
    Next cmd


    • #3

      I think that will get me by, but in general, I wish there were a better
      way to pass a feature to a vbscript. It seems pretty inefficient to have
      to loop through everything to find the one thing you already have a
      handle on in the PC-DMIS code.

      A little detective work convinced me that I can pass a feature as a
      parameter to a vbscript, but it gets there as a 'Dispatch' object type,
      and I do not know how to access it's properties. Not being a VB guru,
      I'm not sure what to do with a 'Dispatch'. I'm probably digging a little
      deeper than I should at this point, but like I say, passing a feature
      to a script seems like it would be a handy thing to be able to do.

      If you have any experience with a 'Dispatch' or run across a better way
      to pass features, please let me know.

      Thanks Again,



      • #4
        What exactly is your goal? If you are passing strings can you not use an assignment in PCDMIS to capture the feature data and pass that as a string? What are you passing to? Another app? An app you wrote? I pass info back and forth between PCDMIS and apps that I wrote in VB. I find that writting data to a text file and reading it in to be very flexable. When you hard code an app declare an array. Then all you have to do is read in from a text file to that array. I do it like this because I can modify how much info I pass without having to modify the declarations in my app. I'd like to know what you are doing exactly because I believe I stand to learn something here. What is your code for passing strings back and forth and what are you doing with it? I'm interested.
        <internet bumper sticker goes here>


        Related Topics