<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Ellipse to Gcode in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11948457#M30198</link>
    <description>&lt;P&gt;so i have an ellipse and im trying to convert it to a GCode for a cnc machine, im trying to update a auto method script but can figure out how the manufacturers outdated lisp code gets this information. So what it pretty much is, its getting the coordinates from the right side&amp;nbsp; going left and its suppose to draw it using my cnc machine. It outputs the code below. I know g90 and g03 meaning but i dont know where its getting all the x and y coorinates with the I and J. ( I and J are suppose to be middle coordinates of the circle/ellipse ) can anyone help me with getting the x and y this outputs?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;G90 G92 X6073.000 Y2108.000
G03 X6063.018 Y2167.512 I-182.392 J-0.000
G03 X6035.803 Y2215.763 I-145.303 J-50.155
G03 X5993.393 Y2249.271 I-100.831 J-84.026
G03 X5946.000 Y2260.400 I-47.393 J-95.347
G03 X5898.607 Y2249.271 I0.000 J-106.475
G03 X5856.197 Y2215.763 I58.421 J-117.534
G03 X5828.982 Y2167.512 I118.088 J-98.406
G03 X5819.000 Y2108.000 I172.410 J-59.512&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2023 08:23:29 GMT</pubDate>
    <dc:creator>rpajounia</dc:creator>
    <dc:date>2023-05-08T08:23:29Z</dc:date>
    <item>
      <title>Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11948457#M30198</link>
      <description>&lt;P&gt;so i have an ellipse and im trying to convert it to a GCode for a cnc machine, im trying to update a auto method script but can figure out how the manufacturers outdated lisp code gets this information. So what it pretty much is, its getting the coordinates from the right side&amp;nbsp; going left and its suppose to draw it using my cnc machine. It outputs the code below. I know g90 and g03 meaning but i dont know where its getting all the x and y coorinates with the I and J. ( I and J are suppose to be middle coordinates of the circle/ellipse ) can anyone help me with getting the x and y this outputs?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;G90 G92 X6073.000 Y2108.000
G03 X6063.018 Y2167.512 I-182.392 J-0.000
G03 X6035.803 Y2215.763 I-145.303 J-50.155
G03 X5993.393 Y2249.271 I-100.831 J-84.026
G03 X5946.000 Y2260.400 I-47.393 J-95.347
G03 X5898.607 Y2249.271 I0.000 J-106.475
G03 X5856.197 Y2215.763 I58.421 J-117.534
G03 X5828.982 Y2167.512 I118.088 J-98.406
G03 X5819.000 Y2108.000 I172.410 J-59.512&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 08:23:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11948457#M30198</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-08T08:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950502#M30199</link>
      <description>&lt;P&gt;It looks to me that its interpolating the ellipse into a smaller set of arcs. I don't know if this is the CNC software that has written this or a lisp, most CNC's (hell, all of the ones I'm familiar with) will always do some form of interpolation on ellipses/splines. Don't have the time to take a crack at it but I would assume you could get similar results by changing the ellipse into a series or arcs and pulling the info from each segment. As the ellipse is in cad now, I think the only thing you would get would be the vertices and center for the ellipse which wouldn't run an ellipse with G03, but an arc.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 02:23:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950502#M30199</guid>
      <dc:creator>annoisscary</dc:creator>
      <dc:date>2023-05-09T02:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950601#M30200</link>
      <description>&lt;P&gt;how can i get the arc points? when i do entget and output that it only gives me starting and ending point&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 04:18:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950601#M30200</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-09T04:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950881#M30201</link>
      <description>&lt;P&gt;Have you looked at the formula for a ellipse ? You can work out any XY point on the ellipse so depending on step size is how small a straight will exist between points.&amp;nbsp; How critical is the curvature ?&amp;nbsp;Google "ellipse formula autocad lisp". Pretty sure there is some code out there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 07:47:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11950881#M30201</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-05-09T07:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11951999#M30202</link>
      <description>&lt;P&gt;half ellipse is divided into 8 parts and each part is approximated by arc. you may draw each arc by 3 three points: start, end and middle point between start point and end point then get the center offset from start point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="komondormrex_0-1683645773360.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1212314i55DCBB291BC71B70/image-size/medium?v=v2&amp;amp;px=400" role="button" title="komondormrex_0-1683645773360.png" alt="komondormrex_0-1683645773360.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 15:24:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11951999#M30202</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-05-09T15:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952057#M30203</link>
      <description>&lt;P&gt;My problem is getting those arc end, start, and mid point. Would you be able to tell me where you got that from?&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 15:44:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952057#M30203</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-09T15:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952237#M30204</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12323643"&gt;@rpajounia&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My problem is getting those arc end, start, and mid point. ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;[Maybe this isn't relevant to you if you don't have Arc objects to &lt;EM&gt;select&lt;/EM&gt;, but....]&lt;/P&gt;
&lt;P&gt;Entity data is not stored that way for an Arc, but what are stored are the center, radius, and the angles from center to the two ends.&amp;nbsp; You could calculate the endpoints from those, using (polar), and the midpoint by splitting the angle difference in half [being careful about the possibility of the range crossing the 0° direction].&amp;nbsp; Or for the ends, you could use (vlax-curve-getStartPoint) and (vlax-curve-getEndPoint) functions, and a more complex calculation using (vlax-curve-...) functions could get you the midpoint.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 17:19:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952237#M30204</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-05-09T17:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952300#M30205</link>
      <description>&lt;P&gt;you may get 'em using this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq approximation_steps 8.0
      ellipse_object (vlax-ename-&amp;gt;vla-object (car (entsel)))
      ellipse_included_angle (- (vlax-curve-getendparam ellipse_object) (setq ellipse_start_param (vlax-curve-getstartparam ellipse_object)))
      ellipse_approximation_angle (/ ellipse_included_angle approximation_steps) 
)
(repeat (fix approximation_steps)
	(setq arc_start_point (vlax-curve-getpointatparam ellipse_object ellipse_start_param)
	      arc_middle_point (vlax-curve-getpointatparam ellipse_object (+ ellipse_start_param (* 0.5 ellipse_approximation_angle)))
	      arc_end_point (vlax-curve-getpointatparam ellipse_object (setq ellipse_start_param (+ ellipse_start_param ellipse_approximation_angle)))
	      arc_center_point (inters (setq aux_point_1 (polar arc_start_point (angle arc_start_point arc_middle_point) (+ (* 0.5 (distance arc_start_point arc_middle_point)))))   
				       (polar aux_point_1 (+ (* 0.5 pi) (angle arc_start_point arc_middle_point)) 5.0)
				       (setq aux_point_2 (polar arc_middle_point (angle arc_middle_point arc_end_point) (+ (* 0.5 (distance arc_middle_point arc_end_point)))))   
				       (polar aux_point_2 (+ (* 0.5 pi) (angle arc_middle_point arc_end_point)) 5.0)
				       nil
			       )
        )
  	(command "_point" "_non" arc_start_point)
  	(command "_point" "_non" arc_center_point)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 18:45:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952300#M30205</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-05-09T18:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952456#M30206</link>
      <description>&lt;P&gt;TY your amazing ill try this out in the next hour or so&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 18:54:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11952456#M30206</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-09T18:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11953112#M30207</link>
      <description>&lt;P&gt;Still thinking better to just work out XY points depending on step size will be closer to an ellipse than doing say 3 arcs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a ellipse then used divide into 360 parts ie 1 degree, about 2 seconds.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_0-1683681434544.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1212503i0F1A859B6EF6C44B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_0-1683681434544.png" alt="SeaHaven_0-1683681434544.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:ellipsepts ( / ss elst)
(command "divide" pause (getint "\nEnter number of increments "))
(setq ss (ssget '((0 . "POINT"))))
(setq elst '())
(repeat (setq x (sslength ss))
(setq elst (cons (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))) elst))
)
(setq elst (cons (cdr (assoc 10 (entget (ssname ss (- (sslength ss) 1))))) elst)) ; need last point again to close
(princ)
)
(c:ellipsepts)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did 1440, 2880 etc at last value on a 300 ellipse that is 0.23mm steps.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 01:31:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11953112#M30207</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-05-10T01:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11953896#M30208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;First, you can &lt;A href="http://www.theswamp.org/index.php?topic=44011.msg492817#msg492817" target="_blank" rel="noopener"&gt;convert the ellipse to a polyline&lt;/A&gt; which is the same approximation as an ellipse drawn with the &lt;A href="https://help.autodesk.com/view/ACDLT/2023/ENU/?guid=GUID-A1C64346-BBFC-4FE9-B346-BCD121BEFA0A" target="_blank" rel="noopener"&gt;PELLIPSE&lt;/A&gt; system variable set to 1 with the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;;; EllipseToPolyline
;; Returns a polyline (vla-object) which is an approximation of the ellipse (or elliptical arc)
;;
;; Argument : an ellipse (vla-object)
 
(defun EllipseToPolyline (el    /     cl    norm  cen   elv   pt0   pt1   pt2   pt3   pt4   ac0
                          ac4   a04   a02   a24   bsc0  bsc2  bsc3  bsc4  plst  blst  spt   spa
                          fspa  srat  ept   epa   fepa  erat  n
                         )
  (vl-load-com)
  (setq cl   (= (ang&amp;lt;2pi (vla-get-StartAngle el))
                (ang&amp;lt;2pi (vla-get-EndAngle el)))
        norm (vlax-get el 'Normal)
        cen  (trans (vlax-get el 'Center) 0 norm)
        elv  (caddr cen)
        cen  (3dTo2dPt cen)
        pt0  (mapcar '+ (trans (vlax-get el 'MajorAxis) 0 norm) cen)
        ac0  (angle cen pt0)
        pt4  (mapcar '+ cen (trans (vlax-get el 'MinorAxis) 0 norm))
        pt2  (3dTo2dPt (trans (vlax-curve-getPointAtparam el (/ pi 4.)) 0 norm))
        ac4  (angle cen pt4)
        a04  (angle pt0 pt4)
        a02  (angle pt0 pt2)
        a24  (angle pt2 pt4)
        bsc0 (/ (ang&amp;lt;2pi (- a02 ac4)) 2.)
        bsc2 (/ (ang&amp;lt;2pi (- a04 a02)) 2.)
        bsc3 (/ (ang&amp;lt;2pi (- a24 a04)) 2.)
        bsc4 (/ (ang&amp;lt;2pi (- (+ ac0 pi) a24)) 2.)
        pt1  (inters pt0
                     (polar pt0 (+ ac0 (/ pi 2.) bsc0) 1.)
                     pt2
                     (polar pt2 (+ a02 bsc2) 1.)
                     nil
             )
        pt3  (inters pt2
                     (polar pt2 (+ a04 bsc3) 1.)
                     pt4
                     (polar pt4 (+ a24 bsc4) 1.)
                     nil
             )
        plst (list pt4 pt3 pt2 pt1 pt0)
        blst (mapcar '(lambda (b) (tan (/ b 2.)))
                     (list bsc4 bsc3 bsc2 bsc0)
             )
  )
  (foreach b blst
    (setq blst (cons b blst))
  )
  (foreach b blst
    (setq blst (cons b blst))
  )
  (foreach p (cdr plst)
    (setq ang  (angle cen p)
          plst (cons
                 (polar cen (+ ang (* 2 (- ac4 ang))) (distance cen p))
                 plst
               )
    )
  )
  (foreach p (cdr plst)
    (setq ang  (angle cen p)
          plst (cons
                 (polar cen (+ ang (* 2 (- ac0 ang))) (distance cen p))
                 plst
               )
    )
  )
  (setq pl
         (vlax-invoke
           (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object)))
           'AddLightWeightPolyline
           (apply 'append
                  (setq plst
                         (reverse (if cl
                                    (cdr plst)
                                    plst
                                  )
                         )
                  )
           )
         )
  )
  (vlax-put pl 'Normal norm)
  (vla-put-Elevation pl elv)
  (mapcar '(lambda (i v) (vla-SetBulge pl i v))
          '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)
          blst
  )
  (if cl
    (vla-put-Closed pl :vlax-true)
    (progn
      (setq spt  (vlax-curve-getClosestPointTo pl (vlax-get el 'Startpoint))
            spa  (vlax-curve-getParamAtPoint pl spt)
            fspa (fix spa)
            ept  (vlax-curve-getClosestPointTo pl (vlax-get el 'Endpoint))
            epa  (vlax-curve-getParamAtPoint pl ept)
            fepa (fix epa)
            n    0
      )
      (cond
        ((equal spt (trans pt0 norm 0) 1e-9)
         (if (= epa fepa)
           (setq plst (sublist plst 0 (1+ fepa))
                 blst (sublist blst 0 (1+ fepa))
           )
           (setq erat (/ (- (vlax-curve-getDistAtParam pl epa)
                            (vlax-curve-getDistAtParam pl fepa)
                         )
                         (- (vlax-curve-getDistAtParam pl (rem (1+ fepa) 17))
                            (vlax-curve-getDistAtParam pl fepa)
                         )
                      )
                 plst (append (sublist plst 0 (1+ fepa))
                              (list (3dTo2dPt (trans ept 0 norm)))
                      )
                 blst (append (sublist blst 0 (1+ fepa))
                              (list (k*bulge (nth fepa blst) erat))
                      )
           )
         )
        )
        ((equal ept (trans pt0 norm 0) 1e-9)
         (if (= spa fspa)
           (setq plst (sublist plst fspa nil)
                 blst (sublist blst fspa nil)
           )
           (setq srat (/ (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
                            (vlax-curve-getDistAtParam pl spa)
                         )
                         (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
                            (vlax-curve-getDistAtParam pl fspa)
                         )
                      )
                 plst (cons (3dTo2dPt (trans spt 0 norm))
                            (sublist plst (1+ fspa) nil)
                      )
                 blst (cons (k*bulge (nth fspa blst) srat)
                            (sublist blst (1+ fspa) nil)
                      )
           )
         )
        )
        (T
         (setq srat (/ (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
                          (vlax-curve-getDistAtParam pl spa)
                       )
                       (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
                          (vlax-curve-getDistAtParam pl fspa)
                       )
                    )
               erat (/ (- (vlax-curve-getDistAtParam pl epa)
                          (vlax-curve-getDistAtParam pl fepa)
                       )
                       (- (vlax-curve-getDistAtParam pl (rem (1+ fepa) 17))
                          (vlax-curve-getDistAtParam pl fepa)
                       )
                    )
         )
         (if (&amp;lt; epa spa)
           (setq plst (append
                        (if (= spa fspa)
                          (sublist plst fspa nil)
                          (cons (3dTo2dPt (trans spt 0 norm))
                                (sublist plst (1+ fspa) nil)
                          )
                        )
                        (cdr (sublist plst 0 (1+ fepa)))
                        (if (/= epa fepa)
                          (list (3dTo2dPt (trans ept 0 norm)))
                        )
                      )
                 blst (append
                        (if (= spa fspa)
                          (sublist blst fspa nil)
                          (cons
                            (k*bulge (nth fspa blst) srat)
                            (sublist blst (1+ fspa) nil)
                          )
                        )
                        (sublist blst 0 fepa)
                        (if (= epa fepa)
                          (list (nth fepa blst))
                          (list (k*bulge (nth fepa blst) erat))
                        )
                      )
           )
           (setq plst (append
                        (if (= spa fspa)
                          (sublist plst fspa (1+ (- fepa fspa)))
                          (cons (3dTo2dPt (trans spt 0 norm))
                                (sublist plst (1+ fspa) (- fepa fspa))
                          )
                        )
                        (list (3dTo2dPt (trans ept 0 norm)))
                      )
                 blst (append
                        (if (= spa fspa)
                          (sublist blst fspa (- fepa fspa))
                          (cons
                            (k*bulge (nth fspa blst) srat)
                            (sublist blst (1+ fspa) (- fepa fspa))
                          )
                        )
                        (if (= epa fepa)
                          (list (nth fepa blst))
                          (list (k*bulge (nth fepa blst) erat))
                        )
                      )
           )
         )
        )
      )
      (vlax-put pl 'Coordinates (apply 'append plst))
      (foreach b blst
        (vla-SetBulge pl n b)
        (setq n (1+ n))
      )
    )
  )
  pl
)
 
;; Ang&amp;lt;2pi
;; Returns the angle expression betweem 0 and 2*pi
(defun ang&amp;lt;2pi (ang)
  (if (and (&amp;lt;= 0 ang) (&amp;lt; ang (* 2 pi)))
    ang
    (ang&amp;lt;2pi (rem (+ ang (* 2 pi)) (* 2 pi)))
  )
)
 
;; 3dTo2dPt
;; Returns the 2d point (x y) of a 3d point (x y z)
(defun 3dTo2dPt (pt) (list (car pt) (cadr pt)))
 
;; Tan
;; Returns the angle tangent
(defun tan (a) (/ (sin a) (cos a)))
 
;; SUBLIST 
;; Returns a sub list
;;
;; Arguments
;; lst : a list
;; start : start index (first item = 0)
;; leng : the sub list length (number of items) or nil
(defun sublist (lst start leng / n r)
  (if (or (not leng) (&amp;lt; (- (length lst) start) leng))
    (setq leng (- (length lst) start))
  )
  (setq n (+ start leng))
  (while (&amp;lt; start n)
    (setq r (cons (nth (setq n (1- n)) lst) r))
  )
)
 
;; K*BULGE
;; Returns the proportinal bulge to the reference bulge
;; Arguments :
;; b : the bulge
;; k : the proportion ratio (between angles or arcs length)
(defun k*bulge (b k / a)
  (setq a (atan b))
  (/ (sin (* k a)) (cos (* k a)))
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, as far as I know, the I and J GCode parameters are the coordinates of the center of the arc &lt;STRONG&gt;relative to its start point&lt;/STRONG&gt;. That said, the following code generates a list of strings corresponding to the lines of a GCode file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun gc:massoc (key alst)
  (if (setq alst (member (assoc key alst) alst))
    (cons (cdar alst) (gc:massoc key (cdr alst)))
  )
)

(defun pline2gcode (pline / elst points bulges lines)

  (defun getCenter (p1 p2 b / a r)
    (setq a (* 2 (atan b))
	  r (/ (distance p1 p2) (* 2. (sin a)))
    )
    (polar p1 (+ (angle p1 p2) (/ pi 2.) (- a)) r)
  )

  (if (= (type pline) 'vla-object)
    (setq pline (vlax-vla-object-&amp;gt;ename pline))
  )
  (setq	elst   (entget pline)
	points (gc:massoc 10 elst)
	bulges (gc:massoc 42 elst)
  )
  (if (= (logand 1 (cdr (assoc 70 elst))) 1)
    (setq points (append points (list (car points))))
  )
  (cons
    (strcat "G90 G92 X"
	    (rtos (caar points))
	    " Y"
	    (rtos (cadar points))
    )
    (mapcar '(lambda (p1 p2 b / c)
	       (if (zerop b)
		 (strcat "G1 X" (rtos (car p2)) " Y" (rtos (cadr p2)))
		 (progn
		   (setq c (mapcar '- (getCenter p1 p2 b) p1))
		   (strcat
		     (if (minusp b)
		       "G02 X"
		       "G03 X"
		     )
		     (rtos (car p2))
		     " Y"
		     (rtos (cadr p2))
		     (strcat
		       " I"
		       (rtos (car c))
		       " J"
		       (rtos (cadr c))
		     )
		   )
		 )
	       )
	     )
	    points
	    (cdr points)
	    bulges
    )
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 16:49:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11953896#M30208</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-10T16:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11954079#M30209</link>
      <description>&lt;P&gt;With the upper code and the ellipse in the drawing you provided,&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(pline2gcode (ellipseToPolyline(car (entsel))))&lt;/LI-CODE&gt;
&lt;P&gt;returns the following list:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;("G90 G92 X6073.0000 Y2108.0000"
  "G03 X6063.0178 Y2167.5121 I-182.3921 J0.0000"
  "G03 X6035.8026 Y2215.7631 I-145.3028 J-50.1553"
  "G03 X5993.3926 Y2249.2711 I-100.8308 J-84.0257"
  "G03 X5946.0000 Y2260.4000 I-47.3926 J-95.3466"
  "G03 X5898.6074 Y2249.2711 I0.0000 J-106.4755"
  "G03 X5856.1974 Y2215.7631 I58.4209 J-117.5337"
  "G03 X5828.9822 Y2167.5121 I118.0876 J-98.4063"
  "G03 X5819.0000 Y2108.0000 I172.4099 J-59.5121"
 )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 May 2023 11:13:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11954079#M30209</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-10T11:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11954192#M30210</link>
      <description>&lt;P&gt;getting out cnc-s&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;;************************************************************************************************************************************

(defun get_direction (point_1 point_2 point_3 / segment_1_2_angle segment_2_3_angle normalized_segment_2_3_angle direction)
	(setq segment_1_2_angle (angle point_1 point_2)
		  segment_2_3_angle (angle point_2 point_3)
  		  normalized_segment_2_3_angle (if (&amp;lt; (- segment_2_3_angle segment_1_2_angle) 0)
  								(+ (- segment_2_3_angle segment_1_2_angle) (* 2 pi))
								(- segment_2_3_angle segment_1_2_angle)
						)
)
  	(cond
  		(
  			(and (&amp;gt; normalized_segment_2_3_angle 0)
  				 (&amp;lt;  normalized_segment_2_3_angle pi)
  			)
				(setq direction +1)
  		)
  		(
  			(and (&amp;gt; normalized_segment_2_3_angle pi)
  				 (&amp;lt; normalized_segment_2_3_angle (* 2 pi))
  			)
				(setq direction -1)
  		)
		(
			t
		)
  	)
	direction
)

;************************************************************************************************************************************

(setq approximation_steps 8
      ellipse_object (vlax-ename-&amp;gt;vla-object (car (entsel)))
      ellipse_included_angle (- (vlax-curve-getendparam ellipse_object) (setq ellipse_start_param (vlax-curve-getstartparam ellipse_object)))
      ellipse_start_point (vlax-curve-getstartpoint ellipse_object)
      ellipse_approximation_angle (/ ellipse_included_angle (float approximation_steps))
      ellipse_direction nil
      cnc_arc '((1 . "G03") (-1 . "G02"))
)
(princ (strcat "G90 G92 X" (rtos (car ellipse_start_point) 2 3) " Y" (rtos (cadr ellipse_start_point) 2 3) "\n"))
(repeat approximation_steps
	(setq arc_start_point (vlax-curve-getpointatparam ellipse_object ellipse_start_param)
	      arc_middle_point (vlax-curve-getpointatparam ellipse_object (+ ellipse_start_param (* 0.5 ellipse_approximation_angle)))
	      arc_end_point (vlax-curve-getpointatparam ellipse_object (setq ellipse_start_param (+ ellipse_start_param ellipse_approximation_angle)))
	)
	(if (null ellipse_direction)
		(setq ellipse_direction (get_direction arc_start_point arc_middle_point arc_end_point))
	)
	(setq ellipse_direction (if (null ellipse_direction) (get_direction arc_start_point arc_middle_point arc_end_point) ellipse_direction)
	      arc_center_point (inters (setq aux_point_1 (polar arc_start_point (angle arc_start_point arc_middle_point) (+ (* 0.5 (distance arc_start_point arc_middle_point)))))
				       			   (polar aux_point_1 (+ (* 0.5 pi) (angle arc_start_point arc_middle_point)) 5.0)
				         		   (setq aux_point_2 (polar arc_middle_point (angle arc_middle_point arc_end_point) (+ (* 0.5 (distance arc_middle_point arc_end_point)))))
				       			   (polar aux_point_2 (+ (* 0.5 pi) (angle arc_middle_point arc_end_point)) 5.0)
				       			   nil
			       		   )
    )
	(princ (strcat (cdr (assoc ellipse_direction cnc_arc)) " X" (rtos (car arc_end_point) 2 3)
							       " Y" (rtos (cadr arc_end_point) 2 3)
							       " I" (rtos (- (car arc_center_point) (car arc_start_point)) 2 3)
							       " J" (rtos (- (cadr arc_center_point) (cadr arc_start_point)) 2 3)
							       "\n"
		   )
	)
	(if (minusp ellipse_direction) 
  		(vla-addarc (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
		    	    (vlax-3d-point arc_center_point)
	  	    	    (distance arc_center_point arc_start_point)
		  	    (angle arc_center_point arc_end_point)
			    (angle arc_center_point arc_start_point)
	  	)
	  	(vla-addarc (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
		    	    (vlax-3d-point arc_center_point)
	  	    	    (distance arc_center_point arc_start_point)
	    		    (angle arc_center_point arc_start_point)
		  	    (angle arc_center_point arc_end_point)
	  	)
  	)
;;;  	(command "_point" "_non" arc_start_point)
;;;	(command "_point" "_non" arc_end_point)
;;;  	(command "_point" "_non" arc_center_point)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;G90 G92 X6073.000 Y2108.000
G03 X6063.333 Y2166.321 I-179.194 J0.258
G03 X6035.803 Y2215.763 I-149.008 J-50.584
G03 X5994.601 Y2248.799 I-99.087 J-81.367
G03 X5946.000 Y2260.400 I-48.911 J-97.304
G03 X5897.399 Y2248.799 I0.310 J-108.905
G03 X5856.197 Y2215.763 I57.885 J-114.403
G03 X5828.667 Y2166.321 I121.478 J-100.026
G03 X5819.000 Y2108.000 I169.526 J-58.062&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 May 2023 12:23:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11954192#M30210</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-05-10T12:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11955495#M30211</link>
      <description>&lt;P&gt;Here's the used method in images to approximate an ellipse with successive tangent arcs.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_gile_0-1683799412728.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1213138iD8601AFA958D005F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_gile_0-1683799412728.png" alt="_gile_0-1683799412728.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: corrected a mistake in the construction process.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 10:03:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11955495#M30211</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-11T10:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11958559#M30212</link>
      <description>&lt;P&gt;Version 2, I dont do any GCODE but method should still be practical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:ellipsepts ( / ss elst)
(command "divide" pause (getint "\nEnter number of increments "))
(setvar 'pdmode 34)
(setvar 'pdsize 3)
(prompt "\nSelect all the points ")
(setq ss (ssget '((0 . "POINT"))))
(setq elst '())
(repeat (setq x (sslength ss))
(setq elst (cons (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))) elst))
)
(setq elst (cons (cdr (assoc 10 (entget (ssname ss (- (sslength ss) 1))))) elst))
(setq fo (open "D:\\acadtemp\\mygcodeattempt.txt" "W"))
(write-line (strcat "G00 X" (rtos (CAR (LAST ELST)) 2 4) " Y" (rtos (CADR (LAST ELST)) 2 4)) FO)
(foreach pt elst
(write-line (strcat "G01 X" (rtos (CAR pt) 2 4) " Y" (rtos (CADR pt) 2 4)) fo)
)
(close fo)
(command "erase" ss "")
(princ)
)
(c:ellipsepts)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;G00 X-42456541.494 Y75347964.3315&lt;BR /&gt;G01 X-42456541.494 Y75347964.3315&lt;BR /&gt;G01 X-42456537.9035 Y75347975.4743&lt;BR /&gt;G01 X-42456535.2374 Y75347980.6952&lt;BR /&gt;G01 X-42456532.0544 Y75347985.6184&lt;BR /&gt;G01 X-42456528.4184 Y75347990.2176&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 01:34:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11958559#M30212</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-05-12T01:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11958946#M30213</link>
      <description>&lt;P&gt;this is amazing just what i needed thanks alot guys for your help on this&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 06:57:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11958946#M30213</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-12T06:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11962155#M30214</link>
      <description>&lt;P&gt;im getting this error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select object: ; error: bad argument type: VLA-OBJECT &amp;lt;Entity name: 19fad8486b0&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 00:34:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11962155#M30214</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-14T00:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11962320#M30215</link>
      <description>&lt;P&gt;Oops!... My mistake. You can try like this:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(pline2gcode (ellipseToPolyline (vlax-ename-&amp;gt;vla-object (car (entsel)))))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway the code I posted upper was an old one which converts an ellipse into a polyline. In your case, there's no need to convert into a polyline to get the arcs&amp;nbsp; apprimating an ellipse. The following code directly computes the arcs.&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;;; EllipseToArcs
;; Returns a list of the data (startPoint endPoint center)
;; defining the arcs which approximate the ellipse.
;;
;; Argument
;; el : ellipse ename
(defun EllipseToArcs (el     /	    norm   cen	  pt0	 pt1	pt2
		      pt3    pt4    ac0	   ac4	  a02	 a24	bsc1
		      bsc2   bsc3   bsc4   plst	  clst	 arcs	dist
		      startPt	    endPt  trimStart	 trimEnd
		     )
  (setq	norm	(getpropertyvalue el "Normal")
	cen	(trans (getpropertyvalue el "Center") 0 norm)
	majAxis	(trans (getpropertyvalue el "MajorAxis") 0 norm)
	minAxis	(trans (getpropertyvalue el "MinorAxis") 0 norm)
	pt0	(mapcar '+ cen majAxis)
	pt4	(mapcar '+ cen minAxis)
	pt2	(trans (vlax-curve-getPointAtparam el (/ pi 4.)) 0 norm)
	ac0	(angle cen pt0)
	ac4	(angle cen pt4)
	a04	(angle pt0 pt4)
	a02	(angle pt0 pt2)
	a24	(angle pt2 pt4)
	bsc1	(/ (- a02 ac4) 2.)
	bsc2	(/ (- a04 a02) 2.)
	bsc3	(/ (- a24 a04) 2.)
	bsc4	(/ (- (+ ac0 pi) a24) 2.)
	plst	(list
		  pt0
		  (setq	pt1 (inters pt0
				    (polar pt0 (+ ac4 bsc1) 1.)
				    pt2
				    (polar pt2 (+ a02 bsc2) 1.)
				    nil
			    )
		  )
		  pt2
		  (setq	pt3 (inters pt2
				    (polar pt2 (+ a04 bsc3) 1.)
				    pt4
				    (polar pt4 (+ a24 bsc4) 1.)
				    nil
			    )
		  )
		  pt4
		)
	clst	(list
		  (inters pt0
			  (polar pt0 ac0 1.)
			  pt1
			  (polar pt1 (+ (/ pi 2.) a02) 1.)
			  nil
		  )
		  (inters pt1
			  (polar pt1 (+ (/ pi 2.) a02) 1.)
			  pt2
			  (polar pt2 (+ (/ pi 2.) a04) 1.)
			  nil
		  )
		  (inters pt2
			  (polar pt2 (+ (/ pi 2.) a04) 1.)
			  pt3
			  (polar pt3 (+ (/ pi 2.) a24) 1.)
			  nil
		  )
		  (inters pt3
			  (polar pt3 (+ (/ pi 2.) a24) 1.)
			  pt4
			  (polar pt4 ac4 1.)
			  nil
		  )
		)
	arcs	(mapcar 'list plst (cdr plst) clst)
	arcs	(append
		  arcs
		  (mapcar
		    '(lambda (a)
		       (mapcar
			 '(lambda (p)
			    (gc:MirrorPoint p cen majAxis)
			  )
			 (list (cadr a) (car a) (caddr a))
		       )
		     )
		    (reverse arcs)
		  )
		)
	arcs	(append
		  arcs
		  (mapcar
		    '(lambda (a)
		       (mapcar
			 '(lambda (p)
			    (gc:MirrorPoint p cen minAxis)
			  )
			 (list (cadr a) (car a) (caddr a))
		       )
		     )
		    (reverse arcs)
		  )
		)
  )
  (if (vlax-curve-IsClosed el)
    arcs
    (progn
      (setq dist    (distance '(0. 0. 0.) majAxis)
	    startPt (trans (vlax-curve-getStartPoint el) 0 norm)
	    endPt   (trans (vlax-curve-getEndPoint el) 0 norm)
	    pt1	    (polar cen (+ ac0 (getpropertyvalue el "StartAngle")) dist)
	    pt2	    (polar cen (+ ac0 (getpropertyvalue el "EndAngle")) dist)
	    arcs    (append arcs arcs)
      )
      (defun trimStart (lst / int)
	(cond
	  ((null lst) nil)
	  ((null (setq int (inters cen pt1 (caar lst) (cadar lst))))
	   (trimStart (cdr lst))
	  )
	  ((equal int (caar lst) 1e-10)
	   (trimEnd lst)
	  )
	  ((equal int (cadar lst) 1e-10)
	   (trimEnd (cdr lst))
	  )
	  (T
	   (cons (list
		   (polar (caddar lst)
			  (angle (caddar lst) startPt)
			  (distance (caddar lst) (caar lst))
		   )
		   (cadar lst)
		   (caddar lst)
		 )
		 (trimEnd (cdr lst))
	   )
	  )
	)
      )
      (defun trimEnd (lst / int)
	(cond
	  ((null lst) nil)
	  ((null (setq int (inters cen pt2 (caar lst) (cadar lst))))
	   (cons (car lst) (trimEnd (cdr lst)))
	  )
	  ((equal int (caar lst) 1e-10)
	   nil
	  )
	  ((equal int (cadar lst) 1e-10)
	   (list (car lst))
	  )
	  (T
	   (list (list
		   (caar lst)
		   (polar (caddar lst)
			  (angle (caddar lst) endPt)
			  (distance (caddar lst) (caar lst))
		   )
		   (caddar lst)
		 )
	   )
	  )
	)
      )
      (trimStart arcs)
    )
  )
)

;; gc:MirrorVector
;; Returns the vector after a mirror about a plane which norm is the normal.
;;
;; Arguments
;; vector : Vector to mirror
;; normal : Normal of the plane
(defun gc:MirrorVector (vector normal)
  (setq vector (trans vector 0 normal))
  (trans (list (car vector) (cadr vector) (- (caddr vector))) normal 0)
)

;; gc:MirrorPoint
;; Returns the point after a mirror about the plane defined by origin and normal.
;;
;; Arguments
;; point : Point to mirror
;; origin : Point on plane
;; normal : Normal of the plane
(defun gc:MirrorPoint (point origin normal)
  (mapcar '+
	  origin
	  (gc:MirrorVector (mapcar '- point origin) normal)
  )
)

;; EllipseToGCode
;; Returns a list of strings (GCode lines) for an ellipse (or elliptical arc)
;;
;; Argument
;; ellipse: ellipse ename
(defun EllipseToGCode (ellipse / arcs)
  (setq arcs (EllipseToArcs ellipse))
  (cons
    (strcat "G90 G92 X"
	    (rtos (caaar arcs))
	    " Y"
	    (rtos (cadaar arcs))
    )
    (mapcar '(lambda (arc / p1 p2 c)
	       (setq p1	(car arc)
		     p2	(cadr arc)
		     c	(mapcar '- (caddr arc) p1)
	       )
	       (strcat
		 "G03 X"
		 (rtos (car p2))
		 " Y"
		 (rtos (cadr p2))
		 " I"
		 (rtos (car c))
		 " J"
		 (rtos (cadr c))
	       )
	     )
	    arcs
    )
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;This one works with enames, so you can call it with:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(EllipseToGcode (car (entsel)))&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 14 May 2023 05:08:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11962320#M30215</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-14T05:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Ellipse to Gcode</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11963952#M30216</link>
      <description>&lt;P&gt;ok so this is almost perfect. the only issue is the G02 and G03, when its going clock wise it should be G02 and counter clockwise is G03, how would i be able to calculate which way its going? Can you let me add a variable stating which point im starting from?&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 08:48:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ellipse-to-gcode/m-p/11963952#M30216</guid>
      <dc:creator>rpajounia</dc:creator>
      <dc:date>2023-05-15T08:48:57Z</dc:date>
    </item>
  </channel>
</rss>

