hexagon logo

Creating Writelines for Points in a Program

I'm fairly new to CMM programming and PC-DMIS so go easy on me. I do not have much experience with writing code but after reading through this forum it appears that you can do a lot to automate some of the things I have to do within my programs. The program I'm working with now requires that I create a Writeline for each point taken within the program to write the Point name along with the Nominal XYZ IJK and Measured XYZ values to a text file. This is very tedious so I thought I ask about creating a script to do this for me.

The writeline currently looks like this where IP_1000 is the ID for the vector point. The script would have to create a writeline like this at the end of the program for each point.

FILE/WRITELINE,F1,"IP_1000"+" , "+IP_1000.X+" , "+IP_1000.Y+" , "+IP_1000.Z+" , "+IP_1000.TI+" , "+IP_1000.TJ+" , "+IP_1000.TK+" , "+IP_1000.TX+" , "+IP_1000.TY+" , "+IP_1000.TZ

Thanks in advance for any help you can offer.
Parents
  • Another option
    In the editor window


    ASSIGN/COUNT = 0
    
    DO/
    ASSIGN/COUNT = COUNT + 1
    
    ASSIGN/V1 = GETCOMMAND("602","TOP",COUNT)
    
    ASSIGN/VPNT_NAME = GETTEXT("ID",1,V1)
    [COLOR=#FF0000]ASSIGN/V2 = LEFT(VPNT_NAME,3)[/COLOR]
    
    [COLOR=#FF0000]IF/V2 == "IP_"[/COLOR]
    
    ASSIGN/MX = GETTEXT("MEASURED X",0,V1)
    ASSIGN/MY = GETTEXT("MEASURED Y",0,V1)
    ASSIGN/MZ = GETTEXT("MEASURED Z",0,V1)
    
    ASSIGN/TI = GETTEXT("THEORETICAL I",1,V1)
    ASSIGN/TJ = GETTEXT("THEORETICAL J",1,V1)
    ASSIGN/TK = GETTEXT("THEORETICAL K",1,V1)
    
    ASSIGN/TX = GETTEXT("THEORETICAL X",1,V1)
    ASSIGN/TY = GETTEXT("THEORETICAL Y",1,V1)
    ASSIGN/TZ = GETTEXT("THEORETICAL Z",1,V1)
    
    (Your file writeline would go here using the above variables)
    
    [COLOR=#ff0000]END_IF[/COLOR]
    
    UNTIL/COUNT>500
    
    


    I think this should work.

    This tests the 3 left characters in the string VPNT_NAME if they are equal to IP_

    If so, writeline, if not go to next vector point. (You need to enter a number that is greater than the number of vector points starting with IP_

    in the

    UNTIL/COUNT>

    line.)
Reply
  • Another option
    In the editor window


    ASSIGN/COUNT = 0
    
    DO/
    ASSIGN/COUNT = COUNT + 1
    
    ASSIGN/V1 = GETCOMMAND("602","TOP",COUNT)
    
    ASSIGN/VPNT_NAME = GETTEXT("ID",1,V1)
    [COLOR=#FF0000]ASSIGN/V2 = LEFT(VPNT_NAME,3)[/COLOR]
    
    [COLOR=#FF0000]IF/V2 == "IP_"[/COLOR]
    
    ASSIGN/MX = GETTEXT("MEASURED X",0,V1)
    ASSIGN/MY = GETTEXT("MEASURED Y",0,V1)
    ASSIGN/MZ = GETTEXT("MEASURED Z",0,V1)
    
    ASSIGN/TI = GETTEXT("THEORETICAL I",1,V1)
    ASSIGN/TJ = GETTEXT("THEORETICAL J",1,V1)
    ASSIGN/TK = GETTEXT("THEORETICAL K",1,V1)
    
    ASSIGN/TX = GETTEXT("THEORETICAL X",1,V1)
    ASSIGN/TY = GETTEXT("THEORETICAL Y",1,V1)
    ASSIGN/TZ = GETTEXT("THEORETICAL Z",1,V1)
    
    (Your file writeline would go here using the above variables)
    
    [COLOR=#ff0000]END_IF[/COLOR]
    
    UNTIL/COUNT>500
    
    


    I think this should work.

    This tests the 3 left characters in the string VPNT_NAME if they are equal to IP_

    If so, writeline, if not go to next vector point. (You need to enter a number that is greater than the number of vector points starting with IP_

    in the

    UNTIL/COUNT>

    line.)
Children
No Data