Basic BASIC question :)

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

  • Basic BASIC question :)

    Hey guys
    So Im trying to make some basic scripts into icons on the PC-DMIS menue bar.
    I found a thread about this before but i cant find it anymore.

    Basically what i wanna do is save commands that i put into everyprogram, like comments etc.
    The thing i forgot is what code to remove in the basic notepad document, i only want the comment / if commands. I dont want the load tip, machine, recall startup alignment etc, so what do I remove to only get the comment/if command when i import this script?

    See example code below.

    Code:
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    
    Sub Part1
    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set DmisCommands = DmisPart.Commands
    CommandCount = DmisCommands.Count
    Set DmisCommand = DmisCommands.Item(CommandCount)
    DmisCommands.InsertionPointAfter DmisCommand
    Set DmisCommand = DmisCommands.Add(START_ALIGN, TRUE)
    DmisCommand.Marked = TRUE
    ' Set ID = START
    retval = DmisCommand.PutText ("START", ID, 0)
    ' Set Referens-ID Item 1 =
    retval = DmisCommand.PutText ("", REF_ID, 1)
    ' Set Uppriktningar = JA
    retval = DmisCommand.SetToggleString (2, ALIGN_LIST, 0)
    
    Set DmisCommand = DmisCommands.Add(END_ALIGN, TRUE)
    DmisCommand.Marked = TRUE
    
    Set DmisCommand = DmisCommands.Add(GET_PROBE_DATA, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Filnamn = D2L20 F1
    retval = DmisCommand.PutText ("D2L20 F1", FILE_NAME, 0)
    
    Set DmisCommand = DmisCommands.Add(SET_COMMENT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set ID = C1
    retval = DmisCommand.PutText ("C1", ID, 0)
    ' Set Kommentarstyp = JANEJ
    retval = DmisCommand.SetToggleString (5, COMMENT_TYPE, 0)
    ' Set Kommentar Item 1 = Vill du se kontrollinstruktion?
    retval = DmisCommand.PutText ("Vill du se kontrollinstruktion?", COMMENT_FIELD, 1)
    ' Set Rapport = NEJ
    retval = DmisCommand.SetToggleString (1, OUTPUT_TYPE, 0)
    ' Set Helskärm = NEJ
    retval = DmisCommand.SetToggleString (1, DISPLAY_TYPE, 0)
    ' Set Fortsätt automatiskt = NEJ
    retval = DmisCommand.PutText ("NEJ", TIME_ARG, 0)
    ' Set Tidsfördröjning = 0
    retval = DmisCommand.PutText ("0", T_VALUE, 0)
    
    Set DmisCommand = DmisCommands.Add(IF_BLOCK_COMMAND, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Läge = 3
    retval = DmisCommand.PutText ("3", MODE_TYPE, 0)
    ' Set Källuttryck = 0
    retval = DmisCommand.PutText ("0", SRC_EXPR, 0)
    
    Set DmisCommand = DmisCommands.Add(END_IF_COMMAND, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Läge = 3
    retval = DmisCommand.PutText ("3", MODE_TYPE, 0)
    
    End Sub
    
    Sub Main
    
    Part1
    
    DmisPart.RefreshPart
    End Sub
    So clarification of how i got the code:
    > Made new pcdmis routine
    > comment yes/no
    >if comment input == yes
    >insert external object
    >exported routine as BAS
    Last edited by pcdmisstudent; 06-08-2020, 05:42 AM.

  • #2
    Remove everything from this line -


    Set DmisCommand = DmisCommands.Add(START_ALIGN, TRUE)

    up to and including this line -


    retval = DmisCommand.PutText ("D2L20 F1", FILE_NAME, 0)

    Comment


  • #3
    Swedish?
    PC-DMIS CAD++ 2o19 R1 SP11

    Comment

Related Topics

Collapse

Working...
X