file write with variables

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

  • file write with variables

    I am currently using 3.5mr2 with sp600

    I am doing a scan of a compound fillet. I need to report the Y&Z location. I have written a loop, but it gives me an error of "file does not exist or is in use by another process" when it tries to open the file. I have included the code below.

    RECALL/ALIGNMENT,EXTERNAL,ft546a,FT456A_AF_AECC:ft546a
    ASSIGN/COUNT = 1
    DO/
    IF/COUNT==1
    ASSIGN/ROT = -4.44444
    END_IF/
    ELSE_IF/COUNT==2
    ASSIGN/ROT = -2.22222
    END_ELSEIF/
    ELSE_IF/COUNT==3
    ASSIGN/ROT = 0
    END_ELSEIF/
    ELSE_IF/COUNT==4
    ASSIGN/ROT = 2.22222
    END_ELSEIF/
    ELSE_IF/COUNT==5
    ASSIGN/ROT = 4.44444
    END_ELSEIF/
    ELSE_IF/COUNT==6
    ASSIGN/ROT = 6.66667
    END_ELSEIF/
    ALIGN5 =ALIGNMENT/START,RECALL:FT456A_AF_AECC:ft546a, LIST= YES
    ALIGNMENT/ROTATE_OFFSET,ROT,ABOUT,XPLUS
    ALIGNMENT/TRANS_OFFSET,ZAXIS,1000
    ALIGNMENT/TRANS_OFFSET,ZAXIS,-367.3
    ALIGNMENT/ROTATE_OFFSET,-48.261,ABOUT,ZPLUS
    ALIGNMENT/END
    F6 =FEAT/SCAN,LINEAROPEN,SHOWHITS=NO,SHOWALLPARAMS=NO
    MEAS/SCAN
    BASICSCAN/LINE,SHOWHITS=NO,SHOWALLPARAMS=NO
    ENDSCAN
    ENDMEAS/
    IF/COUNT==1
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V1IS_CV_LE.TXT"
    END_IF/
    ELSE_IF/COUNT==2
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V2IS_CV_LE.TXT"
    END_ELSEIF/
    ELSE_IF/NAME_IT==3
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V3IS_CV_LE.TXT"
    END_ELSEIF/
    ELSE_IF/COUNT==4
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V4IS_CV_LE.TXT"
    END_ELSEIF/
    ELSE_IF/COUNT==5
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V5IS_CV_LE.TXT"
    END_ELSEIF/
    ELSE_IF/COUNT==6
    ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V6IS_CV_LE.TXT"
    END_ELSEIF/
    ASSIGN/HITS = F6.NUMHITS
    ASSIGN/I = 1
    ASSIGN/J = 1
    FPTR =FILE/OPEN,NAME_IT,WRITE
    FILE/WRITELINE,FPTR,pline
    DO/
    ASSIGN/ALLVALS = F6.HIT[J].Y + "," +F6.HIT[J].Z
    FILE/WRITELINE,FPTR,ALLVALS
    ASSIGN/I = I+1
    ASSIGN/J = J+1
    UNTIL/I > HITS
    FILE/WRITELINE,FPTR,e
    FILE/CLOSE,FPTR
    RECALL/ALIGNMENT,EXTERNAL,ft546a,FT456A_AF_AECC:ft546a
    MOVE/INCREMENT,25.4,0,0
    MOVE/INCREMENT,0,-25.4,0
    ASSIGN/COUNT = COUNT+1
    UNTIL/COUNT>6

    Is there something that I am missing? Any help is greatly appreciated.

    Thanks in advance
    Teresa

  • #2
    Which line are you getting the error on? what are the values of your counters when it happens.

    Is the path good?

    If it is, try a shorter path that uses no spaces and no folder names longer than 8 characters.

    What is the lower case "e" for?

    The format that you are using sometimes writes literal text instead of the variable values, expecially if you create the variable after you create the write statement.

    The loop looks ok.
    Links to my utilities for PCDMIS

    Comment


    • #3
      Shorter Paths

      I have to agree with CMMGUY. To test out your logic, and debug your problem at the same time, use a file path reference like -

      ASSIGN/NAME_IT = "Test1.TXT"

      instead of -

      ASSIGN/NAME_IT = "C:\DATA\PCDMIS\PROG IS PROCESS\FT546A\AF FILLET\V1IS_CV_LE.TXT"

      and change the numerical index in the simple file name for each case. I suspect the spaces are the problem, and this will verify that suspicion (or not).

      Once we see if that works, we can move on from there to a more complex path. . .

      Comment


      • #4
        made man ??

        Hey, I just realized that I mvoed up in the world. I am no longer a junior member, but now a full fledged member. I guess its kind of like being a made man?

        Comment


        • #5
          Thanks for the help. What I found was:

          The path should have been "prog in process" not "prog is process"
          I needed a space after OPEN, NAME_IT

          Now it works great.

          The "e" is to end the script. We are using this data to take the points into autocad. It creates a pline.

          I am trying to program it so there is little that we have to do after the program creates the script file. With this, all we have to do is open autocad and run the script and it's there.

          Thanks
          Teresa

          Comment


          • #6
            Yeah, just watch out for the 'ceremony', ya know, when they do the 'snip-snip'.
            sigpic
            Originally posted by AndersI
            I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

            Comment


            • #7
              372 posts??

              Geezz Matt, 372 posts!!! You must be the "godfather". I would have you're the don, but that would only confuse people. You can't be Matt and Don

              Comment


              • #8
                Why not? I think he has split personalities.....
                RFS Means Really Fussy Stuff

                When all you have is a hammer - everything looks like a nail....
                sigpic

                Comment


                • #9
                  Yea, my personality 'split' a long time ago, when I started working in QC!

                  ('split' as in 'took off' or 'left', ie "Let's split before the cops get here!")
                  sigpic
                  Originally posted by AndersI
                  I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

                  Comment


                  • #10
                    LOL!! Thats too funny Matt!!!
                    sigpic

                    Comment

                    Related Topics

                    Collapse

                    Working...
                    X