Expression information pulling with VB Script

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

  • Expression information pulling with VB Script

    Hello all,

    Some little things I was curious about. Can't really figure our the syntax of.

    Code:
    Sub Main
    'PCDMIS COMMANDS assignment
    Dim App, Part, Cmds, Cmd AsObject
    
    Set App = CreateObject("PCDLRN.Application")
    
    Set Part = App.ActivePartProgram
    Set Cmds = Part.Commands
    
    Start of my script. From there I go into this.

    Code:
    ForEach Cmd In Cmds
    If Cmd.Type = ASSIGNMENT Then
    If Cmd.GetText(DEST_EXPR, 0) = "CMMPROGRAM" Then
    blr= Cmd.GetText( SRC_EXPR, 0)
    bll= Len(blr)
    Prognam=Mid(blr,2,bll-2) 
    Cmd.ReDraw
    EndIf
    End If
    


    I use the above function to pull in Variables I have hardcoded in the program and use to display in a form later on in the script. It currently works great.

    However if I change the format of the variable it starts to get screwy.

    Currently I have the Variables laid out as.

    Code:
    $$ NO,====================================================
         ,PART INFORMATION:
         ,CMMPROGRAM=Part # & what is being checked
         ,PRINTNUM=Print #
         ,PRINTREV=Print Rev.
         ,PARTNAM=Part Name
         ,PARTNUM=Is Part # used in-house, may be the same as Print #
         ,====================================================
                ASSIGN/CMMPROGRAM="A Nut Op 1"
                ASSIGN/PRINTNUM="534543"
                ASSIGN/PRINTREV="A"
                ASSIGN/PRINTREV1=PRINTNUM+", Rev. "+PRINTREV
                ASSIGN/PARTNAM="54w643653"
                ASSIGN/PARTNUM="4356363ty3y"
    If i change the variables to inlcude a Variable or alter the layout in anyway, the string doesn't compute properly.

    I found a vb function for "GetRightSideOfExpression" in the help section. How would i go about implementing it?

    Does someone have a better method of pulling in a Variable value?

    Version 4.3.
    Last edited by Rploughe; 06-20-2014, 03:06 PM. Reason: forgot some VB lines

  • #2
    Tried GetExpression?
    PC-DMIS CAD++ 2o19 R1 SP11

    Comment


    • #3
      Do you want to rename the program?
      I'm form China.

      Comment


      • #4
        I just implemented it this way.

        Code:
        Variables
        Set Prognam1 = PCDPartProgram.GetVariableValue ("CMMPROGRAM")
        Set Printnam1 = PCDPartProgram.GetVariableValue ("PRINTREV1") 
        Set Partnam1 = PCDPartProgram.GetVariableValue ("PARTNAM")
        Set Partnum1 = PCDPartProgram.GetVariableValue ("PARTNUM")
        Set Operat = PCDPartProgram.GetVariableValue ("OPERATOR")
        Set Job = PCDPartProgram.GetVariableValue ("JOB")
        Set Samp = PCDPartProgram.GetVariableValue ("SAMP")
        
        
        Prognam = Prognam1.StringValue
        Printnam = Printnam1.StringValue
        Partnam = Partnam1.StringValue
        Partnum = Partnum1.StringValue
        Opera = Operat.StringValue
        Jo = Job.StringValue
        Sam = Samp.StringValue
        
        I did try GetExpression vpt.se, it just kept giving me a blank text box. I have used getvariablevalue before and didn't think about it in the application. At first it perplexed me as it always showed blank during a test execution and then I remembered it only populates during an actual execution.

        So problem solved. Thank you.

        Comment

        Related Topics

        Collapse

        Working...
        X