hexagon logo

Expression information pulling with VB Script

Hello all,

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


Sub[SIZE=2][COLOR=#000000] Main[/COLOR]
[/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]'PCDMIS COMMANDS assignment
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App, Part, Cmds, Cmd [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object

[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App = CreateObject("PCDLRN.Application")[/COLOR]

[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Part = App.ActivePartProgram[/COLOR]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmds = Part.Commands[/COLOR]
[/SIZE]


Start of my script. From there I go into this.


For[SIZE=2][COLOR=#000000] [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmd [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmds[/COLOR]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmd.[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] = ASSIGNMENT [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Cmd.GetText(DEST_EXPR, 0) = "CMMPROGRAM" [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]blr= Cmd.GetText( SRC_EXPR, 0)
bll= Len(blr)
Prognam=Mid(blr,2,bll-2) 
Cmd.ReDraw
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
End If
[/COLOR][/SIZE][/COLOR][/SIZE]


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.

$$ 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.