Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

approx splines into arcs and save in old DXF format 1

Status
Not open for further replies.

skave

Mechanical
Feb 11, 2003
4
Hi guys,

I have to convert DWG with only splines in DXF with only arcs (not lines)
someone help me, is possible to do so?
And How?
 
Replies continue below

Recommended for you

To my knowledge , no you can't do this ...
The spline is a difficult element to deal with ... 3D or 2D.

The only way to break or explode the spline is to DXBOUT but that yields lines. Not "arcs".

Sorry ... [neutral]
 
skave,
are you talking about an inovlute spline?
If so using the arc command you can keep
entering data points, and have the arc draw
1 2 3 then 3 4 5 then 5 6 7 etc till you
reach the od data point. You would need a bunch of
data points.
 
Thank you,
rKeyTek and diamondjim,

but my problem is more general problem. I have files with hundred of splines, i need a software or method that automatically approx. spline into multiple arcs (probably a CAM software i think)and where i can set approximation and save the result in dxf with only arc entities.
 
skave,
I do have a lisp program that draws
involute gears: you can delete the part
after it mirrors the profile and you will
have the basic profile, trim and array it.
It uses the pline command and I believe
it draws arc segments. Another thought
would be to capture the coordinates of one
tooth in your drawing and block it.

If you are using the full program, you still
will need to trim the unused portion of the
profile below the root diameter or id for an
internal geared spline. You can draw an internal
by reversing the addedum and dedendum and enter
the tooth space instead of the tooth thickness.

;GEAR1.LSP - This program generates involute curve profile.
;10-14-90 Jim Geisey (Diamond Jim)
;USER INPUTS ARE:
; Number of Teeth Diametral Pitch
; Pressure Angle Arc Tooth Thickness (TT x DP)
; Addendum Dedendum
; Fillet Radius Just dummy numbers at this time
(defun c:gear ()
(setq numt (getint &quot;Number of Teeth:<24> &quot;))
(if (= numt nil)
(setq numt 24))
(setq diap (getreal &quot;Diametral Pitch:<1.00> &quot;))
(if (= diap nil)
(setq diap 1.000))
(setq prsa (getreal &quot;Pressure Angle:<20.0> &quot;))
(if (= prsa nil)
(setq prsa 20.0))
(setq adum (getreal &quot;Addendum:<1.0000> &quot;))
(if (= adum nil)
(setq adum 1.0000))
(setq ddum (getreal &quot;Dedendum:<1.1571> &quot;))
(if (= ddum nil)
(setq ddum 1.1571))
(setq tt (getreal &quot;Arc Tooth Thickness :<1.5708> &quot;))
(if (= tt nil)
(setq tt 1.5708))
(setq filr (getreal &quot;Fillet Radius:<0.235> &quot;))
(if (= filr nil)
(setq filr 0.235))
(setvar &quot;orthomode&quot; 0)
(setvar &quot;coords&quot; 1)
;START CALCULATIONS
;
(setq pnts 39) ;determines involute curve accuracy
(setq prsa (/ (* prsa pi) 180.0)) ;pressure angle to radians
(setq pitr (/ numt (* diap 2.0))) ;calc pitch radius
(setq irad (- pitr ddum)) ;calc inside radius
(setq orad (+ pitr adum)) ;calc outer radius
(setq basr (* pitr (cos prsa))) ;calc base radius of gear
(setq z (- (expt orad 2.0) (expt basr 2.0))) ;three lines of
(setq x (sqrt z)) ;code to make
(setq paodd (atan (/ x basr))) ;an arccosine
(setq incr (/ paodd pnts))
(setq p 0.0)
(setq tt (* diap (/ tt numt)))
(GRAPHSCR)
(setq p2 '(0 0)) ;Center of Gear
(setq x2 (CADR p2))
(setq y2 (CAR p2))
(setq y5 (+ y2 basr))
(setq y6 (+ y2 irad))
(setq p6 (list x2 y6))
(setq p5 (list x2 y5))
(setq pz1 (polar p2 1.95 (* basr 0.9)))
(setq pz2 (polar p2 1.35 (* orad 1.5)))
(COMMAND &quot;CIRCLE&quot; P2 pitr) ;place pitch circle
(COMMAND &quot;CIRCLE&quot; P2 basr) ;place base circle
(COMMAND &quot;CIRCLE&quot; P2 irad) ;place inside circle
(COMMAND &quot;ZOOM&quot; &quot;w&quot; pz1 pz2) ;Window for drawing curve
(setq s (ssadd))
(setq le (entlast))
;
;begin a loop for placement of coordinate pairs
;the command pline will be used to generate a polyline whose
;vertices will be computed by a standard involute curve formula
;
(setq test 0)
(COMMAND &quot;PLINE&quot; p5)
(setq p (+ incr p))
(while (> pnts 0)
(setq e1 (sin p))
(setq e2 (cos p))
(setq e (/ e1 e2))
(setq j (- e p))
(setq x1 (* (/ (sin j) (cos p)) basr))
(setq y1 (* (/ (cos j) (cos p)) basr))
(setq x3 (+ x2 x1))
(setq y3 (+ y2 y1))
(setq p3 (list x3 y3))
(COMMAND p3)
(setq p (+ incr p))
(setq pnts (- pnts 1))
(if (/= test 1)
(PROGN
(setq hyp (sqrt (+ (expt x1 2) (expt y1 2))))
(if (> hyp irad)
(progn
(setq pint p3)
(setq test 1)))))
)
(COMMAND &quot;&quot;)
(initget &quot;Y y N n&quot;)
(setq ans Y)
(if (/= ans &quot;N&quot;)
(PROGN
(setq pz3 (polar p2 (* pi 1.25) (* orad 1.6)))
(setq pz4 (polar p2 (* pi 0.25) (* orad 1.6)))
; (COMMAND &quot;ZOOM&quot; &quot;W&quot; pz3 pz4)
(setq ang13 (/ (sin prsa) (cos prsa)))
(setq ang11 (- ang13 prsa))
(setq x11 (* (sin ang11) pitr))
(setq y11 (* (cos ang11) pitr))
(setq p11 (list x11 y11))
(setq ang (angle p2 p11))
(setq angi (- ang tt))
(setq p12 (polar p2 angi (/ ORAD 0.8)))
(setq beta (angle p2 p3))
(setq ang2 (- (* angi 2.0) beta))
(setq p15 (polar p2 ang2 orad))
(setq adj1 (- ang2 j))
(setq adj2 (+ adj1 (/ (* pi 2.0) numt)))
(setq adj3 (+ adj2 0.3))
(setq p22 (polar p2 adj3 basr))
(setq p17 (polar p2 adj2 irad))
(setq p18 (polar p2 adj2 basr))
(setq angr (* (+ ang11 tt) (/ 180.0 pi)))
(setq p21 (polar p2 ang2 (/ orad 0.8)))
(setq angm (+ angi (/ pi numt)))
(setq p19 (polar p2 angm irad))
(setq p20 (polar p2 angm (+ irad filr)))
(COMMAND &quot;ARC&quot; p15 &quot;c&quot; p2 p3)
; (COMMAND &quot;ARC&quot; p19 &quot;E&quot; P5 &quot;R&quot; filr)
; (COMMAND &quot;ARC&quot; p6 &quot;c&quot; p2 p17)
; (COMMAND &quot;LINE&quot; p2 p12 &quot;&quot;)
; (COMMAND &quot;LINE&quot; p2 p20 &quot;&quot;)
(COMMAND &quot;MIRROR&quot; &quot;W&quot; p22 p21 &quot;&quot; p2 p12 &quot;&quot;)
; (COMMAND &quot;MIRROR&quot; &quot;W&quot; P18 P21 &quot;&quot; P2 P12 &quot;&quot;)
(COMMAND &quot;ROTATE&quot; &quot;w&quot; pz3 pz4 &quot;&quot; p2 angr)
(while (setq le (entnext le))
(ssadd le s)
)
(COMMAND &quot;ARRAY&quot; s &quot;&quot; &quot;p&quot; p2 numt &quot;&quot; &quot;&quot;)
) )
(Prompt &quot;\nDone! &quot;)
(princ)
)


 
Thank you Diamondjim,

I am novice in autocad and lisp programming, but this is a chance for increase my competence, if nothing can convert spline into arcs, your help is the best!
 
I have a spline to polyline vlx (vlisp) routine that I found once. If you give me your email address, I can send it to you and you can have a look at it.

 
Thank you borgunit,

You can send me the routine at:

tetraktys.design@tiscali.it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor