Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$$ Write Data Points to Scratch Area
DO/S40:,N,1,NUMPTS
PTXYZ=&POINT(CUR_PTS(N))
WRITE/1,USING,DATA_FORMAT,N,PTXYZ
S40:
BCK010:
CHOOSE/’Select Points Reading Order’,$
’Default Order’, $
’Reverse Order’, resp
IFTHEN/ resp == 1
JUMP/ BCK010:
ELSEIF/ resp == 2
JUMP/ TERM1:
ELSEIF/ resp == 5 $$ Default Order
$$ Write Data Points to Scratch Area in Default Order
DO/S40:,N,1,NUMPTS
PTXYZ=&POINT(CUR_PTS(N))
WRITE/1,USING,DATA_FORMAT,N,PTXYZ
S40:
ELSEIF/ resp == 6 $$ Reverse Order
$$ Write Data Points to Scratch Area in Default Order
DO/S60:,N,NUMPTS,1,-1
PTXYZ=&POINT(CUR_PTS(N))
WRITE/1,USING,DATA_FORMAT,N,PTXYZ
S60:
ENDIF
$$
$$ Program Name: Pts_Along_Any_Curve_to_txt-file
$$
$$ Program to extract points from any type of curve
$$ and write the X,Y,Z coordinates to a txt file.
$$ Part file must be open and set as the Displayed part.
$$ Data file, saved in the 'C:\Temp',folder
$$ is formatted as a 'comma delimted' text file which will
$$ make it easier to convert to an Excel Spreadsheet.
$$
$$
$$ John R. Baker, P.E.
$$ Siemens PLM Software Inc.
$$ Digital Factory
$$ 10824 Hope Street
$$ Cypress, CA 90630
$$ 714-952-6032
$$ "john.r.baker@siemens.com"
$$
$$ Written: August 21, 2011
$$ Updated: February 14, 2015 Changed default data folder location to C:\Temp
$$
$$ Declare Parameters
STRING/PT_F1(60),PT_F2(60),HEADER(3,50),DATA_FORMAT(132)
STRING/PRT_NAM(30),CURVE_TYPE(9,10)
ENTITY/PT_CURVE,CUR_PTS(1000)
NUMBER/NUMPTS,PTXYZ(3),PRTNAM_LEN,PRTDIR_LEN,CUR_CLR,CUR_WDTH
$$ Define Data File Headers
HEADER(1)='Part File Name: '
HEADER(2)='X,Y,Z Coordinates of Points on '
HEADER(3)='PT # X Y Z'
DATA_FORMAT='#@@@,#@@@@@.@@@,#@@@@@.@@@,#@@@@@.@@@'
$$ Set Defaults
NUMPTS=50
CURVE_TYPE(1)='N/A'
CURVE_TYPE(2)='N/A'
CURVE_TYPE(3)='Line'
CURVE_TYPE(4)='N/A'
CURVE_TYPE(5)='Circle'
CURVE_TYPE(6)='Conic'
CURVE_TYPE(7)='N/A'
CURVE_TYPE(8)='N/A'
CURVE_TYPE(9)='Spline'
CUR_PTS(1)=POINT/0,0,0
&FULLDT=1
$$ Extract Part Name
PRT_NAM=&PNAME
PRTNAM_LEN=LENF(PRT_NAM)
PRT_NAM=SUBSTR(PRT_NAM,1,PRTNAM_LEN-4)
DRAW/OFF
MASK/3,5,6,9
$$ Initialize Scratch Area
CREATE/TXT,1
$$
CREATE/TXT,2
$$ Write Header Data to Scratch Area
WRITE/1,'Points Data in forward Direction'
WRITE/1,' '
WRITE/1,HEADER(1)+PRT_NAM+'.prt'
WRITE/1,' '
WRITE/1,TIME+' - '+DATE
WRITE/1,' '
$$
WRITE/2,'Points Data in reverse Direction'
WRITE/2,' '
WRITE/2,HEADER(1)+PRT_NAM+'.prt'
WRITE/2,' '
WRITE/2,TIME+' - '+DATE
WRITE/2,' '
$$ Define name of Data File
S00:
TEXT/'Enter Name for forward DataFile',PT_F1,RESP
JUMP/S00:,TERM1:,,,RESP
S01:
TEXT/'Enter Name for reverse DataFile',PT_F2,RESP
JUMP/S01:,TERM1:,,,RESP
S10:
DELETE/CUR_PTS
$$ Select Curve
S15:
DRAW/ON
IDENT/'Select Curve',PT_CURVE,RESP
JUMP/S00:,TERM1:,,RESP
CUR_CLR=&COLOR(PT_CURVE)
CUR_WDTH=&DENS(PT_CURVE)
&COLOR(PT_CURVE)=186
&DENS(PT_CURVE)=2
CHOOSE/'Have You Selected the Correct Curve?','Yes','No',RESP
JUMP/S15:,TERM1:,,,S20:,,RESP
&COLOR(PT_CURVE)=CUR_CLR
&DENS(PT_CURVE)=CUR_WDTH
JUMP/S15:
$$ Set Number of Points
S20:
&COLOR(PT_CURVE)=CUR_CLR
&DENS(PT_CURVE)=CUR_WDTH
DRAW/OFF
PARAM/'Enter Number of...','Points',INT,NUMPTS,RESP
JUMP/S10:,S00:,,,RESP
S30:
WRITE/1,HEADER(2)+CURVE_TYPE(&TYPE(PT_CURVE))
WRITE/1,' '
WRITE/1,HEADER(3)
WRITE/1,' '
$$
WRITE/2,HEADER(2)+CURVE_TYPE(&TYPE(PT_CURVE))
WRITE/2,' '
WRITE/2,HEADER(3)
WRITE/2,' '
$$ Define Points on Curves
CPSET/EARCL,PT_CURVE,NUMPTS,CUR_PTS
$$ Write Data Points to Scratch Area
DO/S40:,N,1,NUMPTS
PTXYZ=&POINT(CUR_PTS(N))
WRITE/1,USING,DATA_FORMAT,N,PTXYZ
S40:
$$
$$ Write Data Points to Scratch Area
DO/S60:,N,NUMPTS,1,-1
PTXYZ=&POINT(CUR_PTS(N))
WRITE/2,USING,DATA_FORMAT,N,PTXYZ
S60:
$$
$$ Write Additional Header to Scratch Area
WRITE/1,' '
WRITE/1,'********************************************'
WRITE/1,' '
$$
WRITE/2,' '
WRITE/2,'********************************************'
WRITE/2,' '
$$ Select additional curves
S50:
CHOOSE/'Select Another Curve:','Yes','Finish Program',RESP
JUMP/S50:,TERM1:,,,S10:,,RESP
WRITE/1,' '
WRITE/1,'End of File'
$$ Save Scratch File Contents to the Point Data File
FILE/TXT,1,'C:\Temp\'+PT_F1+'.dat',IFERR,ERR1:
FTERM/TXT,1
$$
FILE/TXT,2,'C:\Temp\'+PT_F2+'.dat',IFERR,ERR1:
FTERM/TXT,2
DELETE/CUR_PTS
MESSG/'Data File Created and Saved:','C:\Temp\'+PT_F1+'.dat'
$$
MESSG/'Data File Created and Saved:','C:\Temp\'+PT_F2+'.dat'
JUMP/TERM1:
ERR1:
MESSG/'Data file Saving Error!','Program Terminating!'
$$ Exiting Program
TERM1:
MASK/ALL
DRAW/ON
HALT
$$
$$ Disclaimer:
$$
$$ This code is provided for illustrative purposes only.
$$ The example has not been thoroughly tested under all
$$ conditions. We therefore, cannot guarantee or imply
$$ reliability, serviceability, or function of the program.
$$ The code contained herein is provided to you "AS IS"
$$ without any warranties of any kind. The implied warranties
$$ of fitness for a particular purpose is expressly disclaimed.
$$