Send PART_NAME to a file: how to do that.

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

  • Send PART_NAME to a file: how to do that.

    How can I send the PART_NAME and SERIAL_NUMBER to a file?

    I am trying to come up with a comma delimited file for our SPC folks that includes certain feature specifics. However, I have been unable to get to the PART_NAME and all these other goodies specified in the program heading.

    Here's my code so far (all works fine, except where I define variable V15):

    Code:
                ASSIGN/V11 = LOC21.X.DEV
                ASSIGN/V12 = LOC21.Y.DEV
                ASSIGN/V13 = LOC21.D.DEV
                ASSIGN/V14 = LOC21.RN.DEV
                ASSIGN/V15 = SERIAL_NUMBER
                ASSIGN/V101 = TUTORELEMENT("CYL1-J-")
    FPTR       =FILE/OPEN,writetest.txt,WRITE
                FILE/WRITELINE,FPTR,V15
                FILE/WRITELINE,FPTR,V101.ID +","+V11+","+V12+","+V13+","+V14
                FILE/CLOSE,FPTR,KEEP
    Where it fails is at where I define variable V15. That call does NOT work. I want the serial number from the heading to be the first line in the file.

    Anybody an idea??


    Thanks, Jan.
    ***************************
    PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
    Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

  • #2
    Man Jan you have the best questions.

    I tried a few things in PCDMIS and am starting to think a .bas is the only answer. It seems like such a simple bit of info that would make sense to get within the part program but I have not found anything yet. Sorry if you are a bit teased when you see a reply of no help here but I just thought I'd tell you someone is trying.

    BTW TutorElement is very cool. How did you learn that one? I remember when you were setting up an array and had some questions that came up so I looked it up. I went from 3.2063 to 3.7 so I just learned about it (it came out in 3.5) thanks to you. It is very nice. Anyway wish I could help I hope just as much someone else can. I am learning new things from your posts/threads.

    Craig
    <internet bumper sticker goes here>

    Comment


    • #3
      Originally posted by craiger_ny
      BTW TutorElement is very cool. How did you learn that one?
      Yes, I like TutorElements obviously too and I use them everywhere now. Easy to manipulate.

      I just figured it out using the Demons Help files when I was working on this array issue (which by the way I solved with multiple arrays; lots of typing but good results). Unbelievable, but true.


      I was trying to get to PART_NAME through the report labels, because the standard report lists them. They use something called =PART_NAME in the label file. I tried all variations, did not work for me. The following is code that PC-DMIS seems to accept, except it loads a 0 into the variable:

      Code:
      ASSIGN/V15 = PART_NAME(0)
      If the label can get to this, I feel there must be a way I can push it into a variable.

      In the Data Types list, PART_NAME is listed as a Data Type. Not sure what to do with that info either.

      Back to the helpful help files.


      Jan.
      ***************************
      PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
      Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

      Comment


      • #4
        I just ran this it worked fine. I do not like the Write command with VBA it is just like WriteLine with VB in that it puts quotes "" around each line. I know the StreamWriter class in VB does not so perhaps VBAs does not as well. If you don't want quotes use the StreamWriter and see if that gives you what you want. I have no knowledge of 4.0 so I did this on 3.7.

        Have you tried:
        Code:
        ASSIGN/V15 = PART_NAME()
        Notice no 0? If not this works:

        Here is the .bas:
        Code:
        Sub main()
        Dim App As Object
        Set App = CreateObject("PCDLRN.Application")
        Dim Part As Object
        Set Part = App.ActivePartProgram
        Dim strProgID As String
        strProgID = Part.PartName
        Dim strSerNumber As String
        strSerNumber = Part.SerialNumber
        Dim strTheFile As String
        strTheFile = "C:\Test.txt"
        Open strTheFile For Output As #1
        Write #1, strProgID
        Write #1, strSerNumber
        Close #1
        End Sub
        Here are the PCDMIS commands:
        Code:
        CS1        =SCRIPT/FILENAME= C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\DESKTOP\SERNUMBER.BAS
                    FUNCTION/Main,SHOW=YES,,
                    STARTSCRIPT/
                    ENDSCRIPT/
        FPTR       =FILE/OPEN,C:\TEST.TXT,READ
        V1         =FILE/READLINE,FPTR,{PARTNAME}
        V1         =FILE/READLINE,FPTR,{SERNUMBER}
                    FILE/CLOSE,FPTR
                    COMMENT/REPT,"THIS IS THE PART NAME: " + PARTNAME
                    COMMENT/REPT,"THIS IS THE SERIAL NUMBER: " + SERNUMBER
        PARTNAME is your PCDMIS variable of the part name and SERNUMBER is your PCDMIS variable of the serial number.

        Craig
        <internet bumper sticker goes here>

        Comment


        • #5
          Originally posted by craiger_ny
          Have you tried:
          Code:
          ASSIGN/V15 = PART_NAME()
          Notice no 0? If not this works:
          No, does not work for me (may be a V4.0 bug). I even closed and restarted. Next I will try the .bas route.


          Thanks for your help!



          Jan.
          ***************************
          PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
          Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

          Comment


          • #6
            Oh I was just taking a stab at that one. Merely a guess, like I said I know nothing about 4.0. Keep in mind your variables will be closed in quotes with that code so if you don't want them you'll need to trim them or try StreamReader. I use StreamReader in VB and I like it.

            Craig

            EDIT: I see how my post looks now it looks like I said I ran
            Code:
            ASSIGN/V15 = PART_NAME()
            and it ran fine. I did not try that, it didn't work for Jan and is probably not valid it was just a guess I made. It is the .bas and PCDMIS code I was refering to that I ran fine. Sorry for any confusion.
            Last edited by craiger_ny; 08-24-2006, 02:07 PM.
            <internet bumper sticker goes here>

            Comment


            • #7
              Success!!!!!!

              Craiger, you're the man!!!!! Works like a charm!

              EDIT: Craiger's suggestion to do it through the script worked like a charm. The other does NOT work. I have called tech support to help me out on that one.


              Again, thanks, Jan.
              Last edited by Jan d.; 08-24-2006, 02:43 PM.
              ***************************
              PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
              Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

              Comment


              • #8
                A short option to get the 4 values of the Part-Header into VAR's
                is the following code:
                ASSIGN/PART = STR(GETTEXT(191, 1, {FILEHEDR}))
                ASSIGN/REVI = STR(GETTEXT(192, 1, {FILEHEDR}))
                ASSIGN/SERI = STR(GETTEXT(193, 1, {FILEHEDR}))
                ASSIGN/STAT = STR(GETTEXT(194, 1, {FILEHEDR}))

                Hope that helps you!

                Comment

                Related Topics

                Collapse

                Working...
                X