CAD CAM EDM DRO - Yahoo Group Archive

Re: [CAD_CAM_EDM_DRO] HPGL and DANCAD question.

Posted by Jeff Demand
on 2000-04-03 17:11:15 UTC
At 07:26 PM 04/03/2000 +1200, you wrote:
>This has probably been asked before but: HPGL on DanPlot problem?
>
I have been using Dancam with HPGL files and had problems simaler to yours.
What I do is to create the tool path as a HPGL file, import it into Dancad
and offset it to the desired z depth. Then I run it thru a Qbasic program
which adds a return to z=0 at the end of any line which is not connected to
another line. In effect replacing the PU commands which got lost some where
along trip. Maybe not the most elegant solution but it seems to work. Here
is the code, I'm sure there are problems with it,so use it at your own risk!!!


Jeff

CLS
PRINT " Z-ADD1.BAS July 3, 1999 "
PRINT
PRINT " This program accepts as input a Dancad.asc toolpath file"
PRINT "which doesn't have proper z axis handling for a tool path."
PRINT "Any line ending without a connection to the next line will"
PRINT "have a return to z=0, a line to above the next point, and a"
PRINT " a descent to the start point of thr next line. An example "
PRINT "would be an inported hpgl file which has been ofset to a new "
PRINT "z depth."
PRINT : PRINT
INPUT "Enter path + filename ( DOS 8.3 file name format ) "; file$
OPEN file$ FOR INPUT AS #1
filelen = LEN(file$)
PRINT filelen
outfile$ = LEFT$(file$, filelen - 4)
outfile$ = outfile$ + ".asz"
OPEN outfile$ FOR OUTPUT AS #2
PRINT outfile$
INPUT #1, a$ 'get file header
PRINT #2, a$ ' and write header to output file
INPUT #1, xa1, ya1, za1, xa2, ya2, za2, aa1, aa2, aa3, aa4
PRINT #2, xa1, ya1, za1, xa2, ya2, za2, aa1, aa2, aa3, aa4
'get first line and write to output
c = 0 'activity counter
PRINT : PRINT "Working... ";
DO
c = c + 1
INPUT #1, xb1, yb1, zb1, xb2, yb2, zb2, ab1, ab2, ab3, ab4
'get next line
IF xa2 <> xb1 OR ya2 <> yb1 OR za2 <> zb1 THEN GOSUB ZADD
'test for continuity of tool path
PRINT #2, xb1, yb1, zb1, xb2, yb2, zb2, ab1, ab2, ab3, ab4
'good path, write line
IF c = 50 THEN PRINT "* "; : c = 0 ' print activity, reset c
xa1 = xb1: ya1 = yb1: za1 = zb1: xa2 = xb2: ya2 = yb2: za2 = zb2
aa1 = ab1: aa2 = ab2: aa3 = ab3: aa4 = ab4 'line 1 = line 2
LOOP UNTIL (EOF(1))
CLOSE #1: CLOSE #2
END
ZADD: 'subroutine to add connecting lines
PRINT #2, xa2, ya2, za2, xa2, ya2, 0, aa1, aa2, aa3, aa4
PRINT #2, xa2, ya2, 0, xb1, yb1, 0, aa1, aa2, aa3, aa4
PRINT #2, xb1, yb1, 0, xb1, yb1, zb1, aa1, aa2, aa3, aa4
RETURN
CLOSE

Discussion Thread

Dan Mauch 2000-04-03 06:19:06 UTC Re: [CAD_CAM_EDM_DRO] HPGL and DANCAD question. Jeff Demand 2000-04-03 17:11:15 UTC Re: [CAD_CAM_EDM_DRO] HPGL and DANCAD question.