hexagon logo

Data from script to dc dmis

Hello,

My target is to create unique number for every single report, number should be in a format 00000. Script should read this number from .txt file, then increase by 1 and add text "Report no.: ". Final result should be: like "Report no.: 0015". I have script:

[Sub Main

Dim App As Object
Set App = CreateObject ("PCDLRN.Application")
Dim Text As String
Dim Part As Object
Set Part = App.ActivePartProgram
Dim RepNo As String
Dim No As Integer
Dim V100 As Object
Set V100 = part.getvariablevalue ("V100")

Open "X:\CMM_Data\Proven programs\SCRIPT\REPORTNO.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, No
Loop
Close #1

No=No+1

If No>9999Then
Set Text = "Report no.: "
End If
If No>999 Then
Set Text = "Report no.: 0"
End If
If No>99 Then
Set Text = "Report no.: 00"
End If
If No>9 Then
Set Text = "Report no.: 000"
End If
If No<=9 Then
Set Text = "Report no.: 0000"
End If
'MsgBox Text
'MsgBox No

RepNo = Text & No

MsgBox RepNo

PART.SetVariableValue "V100", RepNo

Part.RefreshPart


End Sub]

This script giving report number which I want but I can't transfer RepNo (report number) to pc dmis, pc dmis showing massage "Runtime error on line: 43 - type mismatch". line 43: "PART.SetVariableValue "V100", RepNo" I did try the way of tries and mistakes but no result achieved. Can please any one tel me what is the problem with this script?


Code in Pc dmis:
[ASSIGN/100="REPORT NO.: 0001"
CS3 =SCRIPT/FILENAME= C:\USERS\DMILIUS\DESKTOP\DELETE\TEST.BAS
FUNCTION/Main,SHOW=NO,,
STARTSCRIPT/
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
V100]

Regards
Parents
  • Maybe something like this (untested).

    Pseudocode:

    [COLOR=#0000ff]Set DcmdID = Cmd.DimensionCommand
    DimType = right (DcmdID.ID, 1)
    if DimType = """ then
      DimType = left(right (DcmdID.ID, 2),1)
    
    [/COLOR]

    Grab the last character in the ID.
    If that character is a " then
    grab the second last character in the ID

    If-then clause depending on what character is in DimType.
  • if I do understand well, this " mean nothing. If yes then, dimension ID always will be something. From other hand dimension ID can be easy controlled and I can ensure that I will add right letter.
    This suggestion can be used if some programs RGB have as first letter right to left, some programs have RGB as second but problem that script, in some cases, giving wrong interpretation of RGB.
Reply
  • if I do understand well, this " mean nothing. If yes then, dimension ID always will be something. From other hand dimension ID can be easy controlled and I can ensure that I will add right letter.
    This suggestion can be used if some programs RGB have as first letter right to left, some programs have RGB as second but problem that script, in some cases, giving wrong interpretation of RGB.
Children
No Data