best way to get a complex curve (i.e., gear tooth involute) to g-code as precisely as possible?

Hello,
I run a script to create a bunch of points that define a fancy curve. I am bringing them into solidworks, drawing a spline to them, then
exporting a drawing to dwg or dxf and using mastercam to generate the gcode. Preferably, I dont want to keep doing the step of hand-drawing a spline to fit each point, because I want to use a lot of points to define the curve precisely.
I was thinking that if I could get the script to export to a text file format that allows a spline to be defined, I could bring THAT file format directly into mastercam and generate the gcode from it.
Is there such a text file format that defines splines? I was thinking of using DWG but it isnt a text file, so I would have trouble getting the points into it.
Is there a better way to do this?
Thanks, -Mike
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 12 Aug 2008 02:11:41 -0700 (PDT), mike

LISP?
--
-JN-

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes.
Skip solidworks, get the points in mastercam (try an ascii file for importing points). Then create a spline automaticly by picking 1st, 2nd and last point. Avoid nurbs splines, make parametric ones. Choose a good enough tolerance in your contour toolpath and make sure filtering nc code is on. If posible turn on high speed machining in the control. You can even filter unwanted points in the spline if you want in mastercam.
DanP
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

dxf is a text file with a very simple format. I would skip solidworks altogether. And the "lot of points" thing...rethink that one. More points doesn't always make a better curve.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 12 Aug 2008 02:11:41 -0700 (PDT), mike

==========I would look into the many VBA and other add-ins for Solidworks. In most cases these will work with a comma delimited ascii file (.csv), which Excel and many other spread sheet programs can generate.
I have used the following lisp program to import airfoil curves into Autocad and Intellicad. Use tin and not ascpoint to invoke after loading.
I don't know if this will work with Solidworks, but it is someplace to start. Also some of the surveying programs may be adaptable as these plot contour/boundry lines from coordinate points.
============; hacked by G. McDuffee 3 Dec 02 and renamed TIN for Table Input ; ASCPOINT.LSP is a utility for use with AutoCAD Release 10 or 11, ; which reads coordinate data from ASCII files in CDF or SDF format, ; and generates AutoCAD geometry using the incoming coordinate data. ; ; The ASCPOINT command will read coordinate data from an ASCII file, ; and generate either a continuous string of LINES, a POLYLINE, a ; 3DPOLYline, multiple copies of a selected group of objects, or ; AutoCAD POINT entities. ; ; Format: ; ; Command: ASCPOINT ; File to read: MYFILE.TXT <- ASCII input file ; Comma/Space delimited <Comma>: Comma <- data format ; Generate Copies/Lines/Nodes/3Dpoly/<Pline>: Nodes <- entity to create ; Reading coordinate data... ; ; If you selected "Copies", then ASCPOINT will prompt you to select the ; objects that are to be copied. The basepoint for all copies is the ; current UCS origin (0,0,0). One copy of the selected objects will be ; created for each incoming coordinate, and placed at each coordinate. ; ; A comma-delimited (CDF) ascii file contains one coordinate per line, ; with each component seperated by a comma, like this: ; ; 2.333,4.23,8.0 ; -4.33,0.0,6.3 ; 0.322,5.32,0.0 ; etc.... ; ; There should be no spaces or blank lines in a CDF coordinate data file. ; ; A space-delimited (SDF) ascii file contains one coordinate per line, ; with each component seperated by one or more spaces, like this: ; ; 2.333 4.23 8.0 ; -4.33 0.0 6.3 ; 0.322 5.32 0.0 ; ... ; ; Coordinate data can be 2D or 3D. ; ; Note that all numeric values must have at least one digit to the left ; and the right of the decimal point (values less than one must have a ; leading 0), and a leading minus sign indicates negative values. This ; applys to both CDF and SDF formats. ; ; ASCPOINT can generate a continuous chain of LINE entities from your ; coordinate data, where each pair of adjacent lines share a coordinate ; from the file. ; ; ASCPOINT can also generate a polyline or 3DPOLYline from the coordinate ; data, where each point in the file becomes a vertice of the polyline. ; If the input file contains 3D coordinates, and you specify a polyline, ; then the Z component is ignored and the default of 0.0 is used. ; ; ASCPOINT will also COPY a selected group of objects, creating one copy ; for each incoming coordinate, and using the coordinate as the absolute ; copy displacement from the CURRENT UCS origin (0,0,0). ; ; Finally, ASCPOINT will generate AutoCAD POINT entities from the data in ; the file. Specify the point size and type prior to invoking ASCPOINT. ; ; Good luck, ; ; Tony Tanzillo
(defun C:TIN ( / f bm hi format input read-point line plist ss) (cond ( (eq "" (setq f (getstring "\nFile to read: ")))) ( (not (setq f (open f "r"))) (princ "\nCan't open file for input.")) (t (initget "Space Comma") (setq format (cond ((getkword "\nComma/Space delimited <Comma>: ")) (t "Comma"))) (initget "Copies Lines Nodes 3dpoly Pline") (setq input (cdr (assoc (cond ( (getkword "\nGenerate Copies/Lines/Nodes/3Dpoly/<Pline>: ")) (t "Pline")) '(("Lines" . ".line") ("Copies" . ".copy") ("Nodes" . ".point") ("3Dpoly" . ".3dpoly") ("Pline" . ".pline"))))) (setq read-point (cond ( (eq format "Comma") cdf) (t sdf))) (setvar "cmdecho" 0) (command ".undo" "g") (setq bm (getvar "blipmode")) (setq hi (getvar "highlight")) (setvar "blipmode" 0) (princ "\nReading coordinate data...") (while (setq line (read-line f)) (cond ( (setq line (strtrim line)) (setq line (read-point line)) (setq plist (append plist (cond ( (eq input ".pline") (list (noz line))) (t (list line)))))))) (close f) (cond ( (eq input ".point") (setvar "highlight" 0) (command ".point" "0,0,0" ".copy" (setq ss (entlast)) "" "m" "0,0,0") (apply 'command plist) (command) (entdel ss)) ( (eq input ".copy") (princ "\nSelect objects to copy,") (while (not (setq ss (ssget))) (princ "\nNo objects selected,") (princ " select objects to copy,")) (setvar "highlight" 0) (command ".copy" ss "" "m" "0,0,0") (apply 'command plist) (command)) (t (command input) (apply 'command plist) (command))) (command ".undo" "e") (setvar "highlight" hi) (setvar "blipmode" bm))) (princ) )
(defun cdf (l) (command ".setvar" "lastpoint" l) (getvar "lastpoint") )
(defun sdf (l) (read (strcat "(" l ")")) )
(defun noz (p) (list (car p) (cadr p)) )
(defun strtrim (s) (while (eq " " (substr s 1 1)) (setq s (substr s 2))) (while (eq " " (substr s (strlen s))) (setq s (substr s 1 (1- (strlen s))))) (cond ( (eq s "") nil) (t s)) )
(princ "\nC:TIN loaded. Start command with TIN. ") (princ) =================== sample data file - sikor.txt ========SIKORSKY GS-1 AIRFOIL 1.000000 .000000 .988425 .002855 .969530 .007536 .948838 .012690 .926749 .018208 .903830 .023868 .880356 .029503 .856330 .035089 .831788 .040631 .806876 .046110 .781854 .051487 .757004 .056687 .732460 .061651 .708198 .066359 .684067 .070817 .659870 .075060 .635511 .079121 .611024 .083009 .586585 .086710 .562438 .090179 .538736 .093364 .515517 .096235 .492730 .098781 .470275 .100998 .448086 .102891 .426156 .104454 .404529 .105683 .383282 .106574 .362494 .107116 .342195 .107305 .322372 .107138 .302983 .106614 .283967 .105730 .265303 .104484 .247057 .102878 .229358 .100933 .212366 .098684 .196230 .096183 .181048 .093477 .166796 .090590 .153358 .087523 .140585 .084267 .128380 .080831 .116754 .077256 .105781 .073603 .095546 .069947 .086103 .066353 .077461 .062875 .069588 .059541 .062428 .056356 .055905 .053304 .049941 .050370 .044465 .047536 .039424 .044776 .034771 .042071 .030470 .039407 .026486 .036777 .022793 .034173 .019397 .031579 .016312 .028972 .013546 .026331 .011096 .023638 .008939 .020887 .007043 .018077 .005383 .015209 .003938 .012284 .002690 .009301 .001625 .006259 .000732 .003159 .000348 .001593 .000000 .000000 .000784 -.002976 .001726 -.005799 .002839 -.008497 .004128 -.011065 .005602 -.013504 .007273 -.015813 .009155 -.017993 .011266 -.020039 .013631 -.021950 .016258 -.023728 .019139 -.025386 .022258 -.026938 .025594 -.028398 .029125 -.029779 .032866 -.031081 .036834 -.032307 .041053 -.033459 .045547 -.034544 .050346 -.035570 .055482 -.036550 .060995 -.037481 .066934 -.038354 .073352 -.039163 .080311 -.039899 .087885 -.040548 .096158 -.041094 .105221 -.041516 .115164 -.041796 .126071 -.041918 .138011 -.041876 .151033 -.041680 .165193 -.041348 .180558 -.040849 .197172 -.040139 .215076 -.039167 .234292 -.037910 .254785 -.036371 .276437 -.034577 .299054 -.032585 .322395 -.030466 .346211 -.028278 .370280 -.026071 .394446 -.023892 .418630 -.021779 .442813 -.019748 .466982 -.017804 .491128 -.015955 .515241 -.014206 .539315 -.012562 .563342 -.011028 .587313 -.009606 .611220 -.008302 .635056 -.007118 .658832 -.006055 .682579 -.005113 .706349 -.004293 .730204 -.003579 .754165 -.002929 .778178 -.002297 .802113 -.001640 .825776 -.000941 .848970 -.000262 .871543 .000334 .893390 .000792 .914451 .001075 .934663 .001166 .953919 .001063 .972113 .000782 .989204 .000353 1.000000 .000000 ======================== If you are doing gear teeth try gear.lsp ========(defun grinfo () (setq c (getpoint "\nCenter of Gear: ")) (setq pc (getpoint "\nPitch Circle: ")) (setq teeth (getint "\nNumber of teeth: ")) (while (< teeth 14) (setq teeth (getint "\nMust be at least 14 teeth: "))) (while (> teeth 50) (setq teeth (getint "\nMust be no more than 50 teeth: "))) (while (< teeth 14) (setq teeth (getint "\nMust be at least 14 teeth: "))) (while (> teeth 50) (setq teeth (getint "\nMust be no more than 50 teeth: "))) ) (defun calgear () (setq d (* 2 (distance c pc))) (setq pc (polar c 0 (/ d 2))) (setq ang3 2.79248) (setq ang5 (/ 360.000000 teeth)) (setq wang -0.785385) (setq wang2 0.785385) (setq dp (/ teeth d)) (setq ht (/ 0.32 dp)) (setq adm (/ 1.0 dp)) (setq y (* (/ 2.257 dp) 1.0642)) ) (defun drawgear () (command "PLINE" (setq p (polar pc 0 adm)) "a" "ce" c "l" ht "l" (setq p (polar (getvar "lastpoint") ang3 y)) "a" "ce" c "l" ht "" ) (SETQ TOP (GETVAR "LASTPOINT")) (command "MIRROR" "L" "" (setq p (polar pc 0 adm)) c "n" ) (command "ARRAY" "w" (POLAR TOP 4.712389 (* Y 1.5)) (polar TOP 0 Y) "" "c" c ang5 "-360" "Y" ) ) (defun C:GEAR () (grinfo) (setq stdots (getvar "blipmode")) (setq stech (getvar "cmdecho")) (setvar "blipmode" 0) (setvar "cmdecho" 0) (calgear) (drawgear) (setvar "blipmode" stdots) (setvar "cmdecho" stech) ) xt-flag "se ===================input <gear> after loading to run
Good luck, and let the group know how you make out and what you find as this is a common challenge.
Unka' George [George McDuffee] ------------------------------------------- He that will not apply new remedies, must expect new evils: for Time is the greatest innovator: and if Time, of course, alter things to the worse, and wisdom and counsel shall not alter them to the better, what shall be the end?
Francis Bacon (1561-1626), English philosopher, essayist, statesman. Essays, "Of Innovations" (1597-1625).
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.