Need Help! Assigning post variable to Vbscript variable


Results 1 to 7 of 7

Thread: Assigning post variable to Vbscript variable

  1. #1
    vfsi
    Guest

    Default Assigning post variable to Vbscript variable

    How do I assign the post variable "output_tool_list" to a text variable inside a Vbscript? I would like to build an array to lookup tool labels by their tool numbers. But first I need the tool list imported into my Vbscript. So I am stalled at the starting line.

    Any help would be appreciated. Thank you

    Similar Threads:


  2. #2
    vfsi
    Guest

    Default Re: Assigning post variable to Vbscript variable

    Thought I would try and refresh this post in hopes of getting a response.

    I have written many macros but I am stumped as to solve my next macro project. I want to read in the tool list that is produced at the header of the program "n,output_tool_list", into an array. Assigning each tool label to the tool number.
    I call tools by label but BobCad cannot call the next tool label only the next tool number. So prefetch doesn't work. If I can print the "output_tool_list in the script I can then build the array so I can finally write a macro to prefetch by label.

    The beginning of my post looks like this:

    1. Start of file programmed zero
    n,comment_start,prog_name
    n,comment_start,output_date," ",output_time
    n,comment_start,machine_make,machine_model
    n,comment_start,"TOOL LIST"
    n,"()"
    n,"( BLANK DIMENSIONS X",stock_length," Y",stock_width," Z",stock_height
    n,"( PART POSITION X",zero_position_x," Y",zero_position_y
    n,"()"
    n,output_tool_list
    program_block_2

    G_CODE HEADER:

    N1 ;STAT_1_16_09_28.MPF
    N2 ;WED. 09/28/2016 11:39AM
    N3 ; SIEMENS 810D
    N4 ; TOOL LIST
    N6 ; T58 CENTERDRILL.250 , DIAMETER = .25 , LENGTH =2.75)
    N7 ; T37 DRILL.156 , DIAMETER = .1563 , LENGTH =3.125)
    N8 ; T23 DRILL.204 , DIAMETER = .204 , LENGTH =3.75)
    N9 ; T33 DRILL.149 , DIAMETER = .1495 , LENGTH =3.)
    N5 G17 G70 G90 G94


    TOOL CALL:

    N7 T="CENTERDRILL.250" M06


    Do you have any ideas?



  3. #3
    Member
    Join Date
    Oct 2008
    Location
    United States
    Posts
    65
    Downloads
    0
    Uploads
    0

    Default Re: Assigning post variable to Vbscript variable

    You will need to start a program block down in the 2001, 2002, 2003, etc range of your post processor, similar to:

    2001. program_block_1, Find Tool Numbers

    nextToolNum = MILL_GetNextToolNumber()
    nextToolOffset = MILL_GetNextToolOffsetNumber()
    outputNextToolData = "Next Tool Number is " & nextToolNum & ", next offset is " & nextToolOffset

    CALL MILL_SetReturnString(outputNextToolData)


    I'm not aware of a scripting function for reading the output_tool_list, look through the Mill Scripting Function reference manual located in your "C:\BobCAD-CAM Data\...\Posts\Documentation" folder. Hope this helps.

    Steve

    Steve
    V28/29 4x Pro, Haas VF-3SSYT, Haas SL-30


  4. #4
    vfsi
    Guest

    Default Re: Assigning post variable to Vbscript variable

    Thanks Steve;
    But that would only get me the tool number. I need the tool label.

    I was hoping there would be a form of "MILL_ProcessPostLine" that would run the output_tool_list in a macro so I could capture the output.



  5. #5
    No posers SBC Cycle's Avatar
    Join Date
    Apr 2008
    Location
    United States
    Posts
    1577
    Downloads
    2
    Uploads
    0

    Default Re: Assigning post variable to Vbscript variable

    Kind of a brutish way to do it but you can read the file as it is posting or after the posting is done and try to parse out the labels:

    Function:
    string MILL_GetOutputLineToNcFile()
    Description:
    Returns a single line of the posted code to a string variable. This is used in program block 2102, and block 540 must be set to Y. This allows the user to modify the code after it has been processed through the posting engine.

    Function:
    void MILL_SetOutputLineToNcFile(string var)
    540. Check each output line with scripting? y

    2102. Read each line on output (if line 540 is set to Y).

    and

    2101. Read entire file after post.

    Might be some use there. I'll try to find an example of usage.



  6. #6
    vfsi
    Guest

    Default Re: Assigning post variable to Vbscript variable

    Thanks for the inspiration. Wouldn't be the first brute force programming solution that I have used. I will hack on that for a while and see what comes of it. Without trying your suggestion, I either live without tool precall or hand edit my programs.

    I just thought of, but haven't tried yet, if the tool crib file would be available for reading via the macro language? Again the long way to the booze hall, but......



  7. #7
    No posers SBC Cycle's Avatar
    Join Date
    Apr 2008
    Location
    United States
    Posts
    1577
    Downloads
    2
    Uploads
    0

    Default Re: Assigning post variable to Vbscript variable

    We all need a little inspiration! It's tough when you're on your own and no one is that interested.

    I'm chewing it over as well. I always wanted a slick way of reading output_tool_list but it loops through it's own little macro before dumping out the list.

    I did find a post that uses Block 2102. I don't know how or if it will allow you to read in each line of output_tool_list but I'm thinking it might. This was a sample post from 2008 or so that came from a former BobCAD staffer.

    Attached Files Attached Files


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Assigning post variable to Vbscript variable

Assigning post variable to Vbscript variable