cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Translate the entire conversation x

Setup Sheet Creation Tool GPOST

BF_14259101
4-Participant

Setup Sheet Creation Tool GPOST

This is handy.  I modified it today to use with G-Post (I have been using FORTRAN posts for 25+ years, and just made the switch this year).  This will build a setup sheet from your apt source file.  It should be easy enough to understand and tweak for your own needs.  I find it very handy for creating run books.

 

I compiled using FreeBasic but it's easy to convert to your language of choice.

 

You can create a .bat file and attach it to one of your Cimpro buttons:

echo off
cd %2
@C:\anc\camsys\SetupSheetHelper.exe %1

 

Main Program:

'*********************************************************************
'SetupSheetHelper Main Program
'Bryan Felsher                        01-03-10
'Modified 10-17-2025 BCF for AUSTIN NC G-POST
'*********************************************************************
Dim Shared As Integer i=0,n=0,iTLNUM,SEQNUM=0,iPRNUM
Dim Shared As Integer FILTYP = 0, FREAD = 0
Dim Shared As String sLNIN, sLNIN2, sNLINE,sTIME, sINFNM, sOFLNM,sLNOUT
Dim Shared As String sTOOL(150)
sLNIN=""
sNLINE=""
sLNIN2=""
 
Declare Sub FILOPN
Declare Sub SETTML
Declare Sub HEADER
Declare Sub TLLIST
Declare Sub NCOUT
 
Declare Function APTMAJ(LINEIN As String) As String
'*********************************************************************
 
Screen 10
 
'SETTML
 
FILOPN
 
If InStr(UCase(sINFNM),".APT") < 1 Then 
   Print _
   "ERROR: INVALID FILE TYPE. MUST BE .APT OR .APTSOURCE FILE TYPE."
   Beep:Sleep:End
EndIf
 
 
'BUILD TOOL LIST
iTLNUM = 0
Do While Not Eof(1)
   Line Input #1, sLNIN
   sLNIN=UCase(sLNIN)
   If APTMAJ(sLNIN) = "PPRI" Then
      Line Input #1, sLNIN2 'READ NEXT LINE
      If Instr(sLNIN2,"LOADTL") >0 Then
         iTLNUM += 1
         sTOOL(iTLNUM) = LTrim(sLNIN,"PPRINT")
         sTOOL(iTLNUM) = LTrim(sTOOL(iTLNUM),"/")
         sTOOL(iTLNUM) = Trim(sTOOL(iTLNUM))
      EndIf
   EndIf
Loop
 
Reset
FILOPN
HEADER
 
Do While Not Eof(1) 
   Line Input #1, sLNIN
   sLNIN=UCase(sLNIN)
   Select Case APTMAJ(sLNIN)
      Case "PART"
         iPRNUM = Val(LTrim(sLNIN,"PARTNO"))
         sLNOUT = "PROGRAM NUMBER: " & Str(iPRNUM)
         NCOUT
         Print #3, " "
      Case "FROM"
            TLLIST
            FREAD = 1
      Case "DISP", "PPRI"
         If APTMAJ(sLNIN) = "DISP" Then sLNOUT = LTrim(sLNIN,"DISPLY")
         If APTMAJ(sLNIN) = "PPRI" Then sLNOUT = LTrim(sLNIN,"PPRINT")
         sLNOUT = LTrim(sLNOUT, "/")            
'Remove CATIA comment lines
         If InStr(sLNOUT,"OPERATION NAME") Then sLNOUT = ""
         If SLNOUT = _
            "********************************************" _
            Then sLNOUT = ""  
'Remove tool description lines, handled later.               
         For i = 1 To iTLNUM Step 1
            If Instr(sLNOUT, sTOOL(i)) > 0 Then
               sLNOUT = ""                        
            End If
         Next               
'Check for sequence of operations notes            
         If FREAD = 1 Then  'Handle comments after FROM read
            If InStr(sLNOUT,"SEQ") Then
               SEQNUM+=1
               Print #3, sLNOUT
               sLNOUT = ""
               Print #3, STOOL(SEQNUM)
            End If
         End If
         NCOUT
   End Select
Loop
Print #3, "************** END OF PROGRAM **************"
 
Reset 
Beep
 
Function APTMAJ(LINEIN As String) As String
Dim As String MAJOR
MAJOR = Left(LINEIN,4)
Return MAJOR 
End Function
 
Sub FILOPN
ChDir ExePath
sINFNM = Command(1)
sOFLNM = Left(sINFNM,(InStrRev(sINFNM, ".")-1)) & "_SetupSheet.txt"
Dim choice As String
 
If Len(sINFNM)=0 Then
   Print "Missing parameter : No Input file!"
Input "Select file for input? [Y,N] ";choice
choice=LCase(choice)
If choice = Chr(121) Then 
Input "Enter Filename for Input: ";sINFNM
sOFLNM = Left(sINFNM,(InStrRev(sINFNM, ".")-1))_
            & "_RunTime.log"
Else 
End
End If
 
If Open (sINFNM For Input As #1) <> 0 Then 
  Print "Error: can't open Input File!"
  Sleep:End
Else
If Open (sOFLNM For Output As #3) <> 0 Then
  Print "Error: can't open Output File!"
  Close #1
  Close #3
  End
end If
End If 
Else
If Open (sINFNM For Input As #1) <> 0 Then 
  Print "Error: can't open Input File!"
  End
Else
If Open (sOFLNM For Output As #3) <> 0 Then
  Print "Error: can't open Output File!"
  Close #1
  Close #3
  End
end If
End If
End If
Return
 
End Sub
 
Sub SETTML
Dim As String TimeLimit = "12-22-2010"
Print "Today's date is: ";Date;_
   ". You have until ";TimeLimit;" to try this software."
Print
Print "Press any key to continue."
Sleep:GetKey
If Date > TimeLimit Then
Print "Time limit ";TimeLimit;" has expired."
Sleep:End
EndIf
Cls
End Sub
 
Sub HEADER
Print #3, "******************************************"
Print #3, "True Precision CNC Programming Services"
Print #3, "Ph: 310-750-6761"
   Print #3, "Email: trueprecisioncnc@outlook.com"
Print #3, "Website: www.trueprecisioncnc.com"
Print #3, "******************************************"
Print #3, " "
Print #3, "Setup Sheet Comments extracted from : "
   Print #3, sINFNM
Print #3, " "
Return 
End Sub
 
Sub TLLIST
   Print #3, ""
Print #3, "*****************TOOL LIST******************"
For i = 1 To iTLNUM Step 1
Print #3, sTOOL(i)
Next
   Print #3, "********************************************"
   Print #3, ""
   Print #3, "***********SEQUENCE OF OPERATIONS***********"
   Print #3, ""
i=0
   Return 
End Sub
 
Sub NCOUT
   If sLNOUT <> "" Then
      Print #3, Trim(sLNOUT)
      sLNOUT = ""
      sLNIN = ""
      sLNIN2 = ""
   EndIf
   Return
End Sub

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

In the past, people have asked how to output a list of tools being used by a particular program, and include that list in the program itself. I do this myself, so that when someone in the future (often me) needs to run the program again, all the information they need is in one place.

To do this I needed to do some extensive FIL programming, detailed in one of the posts about it, here:

 

https://community.ptc.com/t5/Manufacturing-CAM/Getting-tools-to-Post-Out-to-my-programs/m-p/40539 

 

An alternative to making setup sheets, I guess.

View solution in original post

2 REPLIES 2

In the past, people have asked how to output a list of tools being used by a particular program, and include that list in the program itself. I do this myself, so that when someone in the future (often me) needs to run the program again, all the information they need is in one place.

To do this I needed to do some extensive FIL programming, detailed in one of the posts about it, here:

 

https://community.ptc.com/t5/Manufacturing-CAM/Getting-tools-to-Post-Out-to-my-programs/m-p/40539 

 

An alternative to making setup sheets, I guess.

Hi @BF_14259101,

 

I wanted to see if you got the help you needed.

 

If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.

 

Of course, if you have more to share on your issue, please pursue the conversation.

 

Thanks,


Catalina
PTC Community Moderator
PTC
Announcements

Top Tags