Author Topic: ellipse to arc  (Read 6669 times)

0 Members and 1 Guest are viewing this topic.

jack91066

  • Guest
ellipse to arc
« on: March 17, 2017, 05:37:21 PM »
Hi everyone,

Please anyone help me try to convert ellipse to arc, i attach my cad file. in my cad file ellipse major and minor radius is not equal,
i use lee-mac lisp tyr to convert my cad file but not success.
if anybody have idea ,please share with me how to convert ellipse to arc 

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ellipse to arc
« Reply #1 on: March 17, 2017, 06:10:21 PM »
Hi

Not sure it's what you're looking for, but here's a quite old but not so bad one (I quickly translated the prompts to English).

Code - Auto/Visual Lisp: [Select]
  1. ;;; ARCEDIT (gile) 25/11/2005
  2. ;;; Convertit un cercle ou une ellipse en arc ou modifie le départ et la fin
  3. ;;; d'un arc d'après les angles spécifiés, l'option "Fermer" permet la conversion d'un
  4. ;;; arc de cercle en cercle ou d'un arc elliptique en ellipse fermée.
  5.  
  6. (defun c:arcedit (/ ucszdir getang ang->param set1 ent lst ang1 ang2 opt
  7.                   echo)
  8.  
  9.   ;; ucszdir Retourne la direction d'extrusion du SCU courant (vecteur)
  10.   (defun ucszdir ()
  11.     (trans '(0 0 1) 1 0 T)
  12.   )
  13.  
  14.   ;; Saisie des angles de départ et de fin de l'arc (option "Fermer")
  15.   (defun getang ()
  16.     (if (or (= (cdr (assoc 0 lst)) "CIRCLE")
  17.             (and (= (cdr (assoc 0 lst)) "ELLIPSE")
  18.                  (= (cdr (assoc 41 lst)) 0.0)
  19.                  (= (cdr (assoc 42 lst)) (* 2 pi))
  20.             )
  21.         )
  22.       (progn (setq opt "") (initget 1))
  23.       (progn (setq opt " ou [Close] <f>:") (initget "Close"))
  24.     )
  25.     (if (numberp (setq ang1
  26.                         (getangle (trans (cdr (assoc 10 lst)) ent 1)
  27.                                   (strcat "\nSpecify the arc start angle"
  28.                                           opt
  29.                                           ": "
  30.                                   )
  31.                         )
  32.                  )
  33.         )
  34.       (progn
  35.         (initget 1)
  36.         (setq ang2
  37.                (getangle (trans (cdr (assoc 10 lst)) ent 1)
  38.                          "\nSpecify the arc end angle: "
  39.                )
  40.         )
  41.         (foreach ang '(ang1 ang2)
  42.           (set ang
  43.                (+ (eval ang)
  44.                   (angle '(0 0) (trans (getvar "UCSXDIR") 0 (ucszdir)))
  45.                   (getvar "ANGBASE")
  46.                )
  47.           )
  48.         )
  49.       )
  50.     )
  51.   )
  52.  
  53.   ;; Convertit l'angle saisi en "paramètre" de l'ellipse (code dxf 41 et 42)
  54.   (defun ang->param (ang)
  55.     (setq
  56.       ang (- ang
  57.              (angle '(0 0) (trans (cdr (assoc 11 lst)) 0 (ucszdir)))
  58.           )
  59.     )
  60.     (atan (sin ang) (* (cos ang) (cdr (assoc 40 lst))))
  61.   )
  62.  
  63.   ;; Fonction principale
  64.   (if (and (= 1 (getvar "PICKFIRST"))
  65.            (setq set1 (ssget "_i" '((0 . "ARC,CIRCLE,ELLIPSE"))))
  66.            (eq 1 (sslength set1))
  67.       )
  68.     (progn
  69.       (setq ent (ssname set1 0)
  70.             lst (entget ent)
  71.       )
  72.       (sssetfirst nil nil)
  73.     )
  74.     (progn
  75.       (sssetfirst nil nil)
  76.       (while
  77.         (not
  78.           (and
  79.             (setq ent
  80.                    (car (entsel
  81.                           "\nSelect an arc, a circle or an ellipse: "
  82.                         )
  83.                    )
  84.             )
  85.             (setq lst (entget ent))
  86.             (member (cdr (assoc 0 lst)) '("ARC" "CIRCLE" "ELLIPSE"))
  87.           )
  88.         )
  89.       )
  90.     )
  91.   )
  92.   (if (equal (ucszdir) (cdr (assoc 210 lst)) 1e-9)
  93.     (progn
  94.       (getang)
  95.       (cond
  96.         ((= (cdr (assoc 0 lst)) "ARC")
  97.          (if (numberp ang1)
  98.            (setq lst (subst (cons 50 ang1)
  99.                             (assoc 50 lst)
  100.                             (subst (cons 51 ang2) (assoc 51 lst) lst)
  101.                      )
  102.            )
  103.            (setq
  104.              lst (cons '(0 . "CIRCLE")
  105.                        (vl-remove-if
  106.                          '(lambda (x)
  107.                             (member (car x) '(-1 0 330 5 100 50 51))
  108.                           )
  109.                          lst
  110.                        )
  111.                  )
  112.            )
  113.          )
  114.         )
  115.         ((= (cdr (assoc 0 lst)) "CIRCLE")
  116.          (setq lst
  117.                 (cons
  118.                   '(0 . "ARC")
  119.                   (cons
  120.                     (cons 50 ang1)
  121.                     (cons
  122.                       (cons 51 ang2)
  123.                       (vl-remove-if
  124.                         '(lambda (x) (member (car x) '(-1 0 330 5 100)))
  125.                         lst
  126.                       )
  127.                     )
  128.                   )
  129.                 )
  130.          )
  131.         )
  132.         ((= (cdr (assoc 0 lst)) "ELLIPSE")
  133.          (if (numberp ang1)
  134.            (foreach ang '(ang1 ang2)
  135.              (set ang (ang->param (eval ang)))
  136.            )
  137.            (setq ang1 0.0
  138.                  ang2 (* 2 pi)
  139.            )
  140.          )
  141.          (setq lst (subst (cons 41 ang1)
  142.                           (assoc 41 lst)
  143.                           (subst (cons 42 ang2) (assoc 42 lst) lst)
  144.                    )
  145.          )
  146.         )
  147.       )
  148.       (setq echo (getvar "CMDECHO"))
  149.       (setvar "CMDECHO" 0)
  150.       (command "_undo" "_begin")
  151.       (entmake lst)
  152.       (entdel ent)
  153.       (command "_undo" "_end")
  154.       (setvar "CMDECHO" echo)
  155.     )
  156.     (princ
  157.       "\nError: the current UCS and the object OCS are not parallel."
  158.     )
  159.   )
  160.   (princ)
  161. )
Speaking English as a French Frog

jack91066

  • Guest
Re: ellipse to arc
« Reply #2 on: March 17, 2017, 06:20:36 PM »
(defun c:e2a (/ acaddoc acadms acadobj center endangle obj radius ss ssn startangle)
  (vl-load-com)
  (if
    (setq ss (ssget '((0 . "ellipse"))))
    (progn     
      (setq acadobj (vlax-get-acad-object))
      (setq acaddoc (vla-get-activeDocument acadobj))
      (setq acadms (vla-get-modelspace acaddoc))
      (setq ssn (ssname ss 0))
      (setq obj (vlax-ename->vla-object ssn))
      (if
   obj ;(equal (vla-get-RadiusRatio obj) 1 0.0001)
   (progn
     (setq radius (vla-get-MajorRadius obj))
     (setq StartAngle (vla-get-StartAngle OBJ))
     (setq EndAngle (vla-get-EndAngle obj))
     (setq Center (vlax-get obj 'center))
     (entdel ssn)
     (vla-addarc acadms (vlax-3d-point Center) radius StartAngle EndAngle)
     ) ; progn
   (alert "> Ellipse objects failed to be converted")
   )   ; if
      )     ; progn
    )       ; if
  (princ)
  )       ; defun

jack91066

  • Guest
Re: ellipse to arc
« Reply #3 on: March 17, 2017, 06:23:03 PM »
i use this code but is not working because my major and minor radius in not equal have any another code if major and minor radius not equal it working.

jack91066

  • Guest
Re: ellipse to arc
« Reply #4 on: March 17, 2017, 06:24:39 PM »
check my attach cad file

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ellipse to arc
« Reply #5 on: March 17, 2017, 06:27:58 PM »
This one converts ellipse or elliptical arc into a polyline with circular arc segments.
Try EL2PL command.

Code - Auto/Visual Lisp: [Select]
  1. ;; EllipseToPolyline
  2. ;; Returns a polyline (vla-object) which is an approximation of the ellipse (or elliptical arc)
  3. ;;
  4. ;; Argument : an ellipse (vla-object)
  5.  
  6. (defun EllipseToPolyline (el    /     cl    norm  cen   elv   pt0   pt1   pt2   pt3   pt4   ac0
  7.                           ac4   a04   a02   a24   bsc0  bsc2  bsc3  bsc4  plst  blst  spt   spa
  8.                           fspa  srat  ept   epa   fepa  erat  n
  9.                          )
  10.   (setq cl   (= (ang<2pi (vla-get-StartAngle el))
  11.                 (ang<2pi (vla-get-EndAngle el)))
  12.         norm (vlax-get el 'Normal)
  13.         cen  (trans (vlax-get el 'Center) 0 norm)
  14.         elv  (caddr cen)
  15.         cen  (3dTo2dPt cen)
  16.         pt0  (mapcar '+ (trans (vlax-get el 'MajorAxis) 0 norm) cen)
  17.         ac0  (angle cen pt0)
  18.         pt4  (mapcar '+ cen (trans (vlax-get el 'MinorAxis) 0 norm))
  19.         pt2  (3dTo2dPt (trans (vlax-curve-getPointAtparam el (/ pi 4.)) 0 norm))
  20.         ac4  (angle cen pt4)
  21.         a04  (angle pt0 pt4)
  22.         a02  (angle pt0 pt2)
  23.         a24  (angle pt2 pt4)
  24.         bsc0 (/ (ang<2pi (- a02 ac4)) 2.)
  25.         bsc2 (/ (ang<2pi (- a04 a02)) 2.)
  26.         bsc3 (/ (ang<2pi (- a24 a04)) 2.)
  27.         bsc4 (/ (ang<2pi (- (+ ac0 pi) a24)) 2.)
  28.         pt1  (inters pt0
  29.                      (polar pt0 (+ ac0 (/ pi 2.) bsc0) 1.)
  30.                      pt2
  31.                      (polar pt2 (+ a02 bsc2) 1.)
  32.                      nil
  33.              )
  34.         pt3  (inters pt2
  35.                      (polar pt2 (+ a04 bsc3) 1.)
  36.                      pt4
  37.                      (polar pt4 (+ a24 bsc4) 1.)
  38.                      nil
  39.              )
  40.         plst (list pt4 pt3 pt2 pt1 pt0)
  41.         blst (mapcar '(lambda (b) (tan (/ b 2.)))
  42.                      (list bsc4 bsc3 bsc2 bsc0)
  43.              )
  44.   )
  45.   (foreach b blst
  46.     (setq blst (cons b blst))
  47.   )
  48.   (foreach b blst
  49.     (setq blst (cons b blst))
  50.   )
  51.   (foreach p (cdr plst)
  52.     (setq ang  (angle cen p)
  53.           plst (cons
  54.                  (polar cen (+ ang (* 2 (- ac4 ang))) (distance cen p))
  55.                  plst
  56.                )
  57.     )
  58.   )
  59.   (foreach p (cdr plst)
  60.     (setq ang  (angle cen p)
  61.           plst (cons
  62.                  (polar cen (+ ang (* 2 (- ac0 ang))) (distance cen p))
  63.                  plst
  64.                )
  65.     )
  66.   )
  67.   (setq pl
  68.          (vlax-invoke
  69.            'AddLightWeightPolyline
  70.            (apply 'append
  71.                   (setq plst
  72.                          (reverse (if cl
  73.                                     (cdr plst)
  74.                                     plst
  75.                                   )
  76.                          )
  77.                   )
  78.            )
  79.          )
  80.   )
  81.   (vlax-put pl 'Normal norm)
  82.   (vla-put-Elevation pl elv)
  83.   (mapcar '(lambda (i v) (vla-SetBulge pl i v))
  84.           '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)
  85.           blst
  86.   )
  87.   (if cl
  88.     (vla-put-Closed pl :vlax-true)
  89.     (progn
  90.       (setq spt  (vlax-curve-getClosestPointTo pl (vlax-get el 'Startpoint))
  91.             spa  (vlax-curve-getParamAtPoint pl spt)
  92.             fspa (fix spa)
  93.             ept  (vlax-curve-getClosestPointTo pl (vlax-get el 'Endpoint))
  94.             epa  (vlax-curve-getParamAtPoint pl ept)
  95.             fepa (fix epa)
  96.             n    0
  97.       )
  98.       (cond
  99.         ((equal spt (trans pt0 norm 0) 1e-9)
  100.          (if (= epa fepa)
  101.            (setq plst (sublist plst 0 (1+ fepa))
  102.                  blst (sublist blst 0 (1+ fepa))
  103.            )
  104.            (setq erat (/ (- (vlax-curve-getDistAtParam pl epa)
  105.                             (vlax-curve-getDistAtParam pl fepa)
  106.                          )
  107.                          (- (vlax-curve-getDistAtParam pl (rem (1+ fepa) 17))
  108.                             (vlax-curve-getDistAtParam pl fepa)
  109.                          )
  110.                       )
  111.                  plst (append (sublist plst 0 (1+ fepa))
  112.                               (list (3dTo2dPt (trans ept 0 norm)))
  113.                       )
  114.                  blst (append (sublist blst 0 (1+ fepa))
  115.                               (list (k*bulge (nth fepa blst) erat))
  116.                       )
  117.            )
  118.          )
  119.         )
  120.         ((equal ept (trans pt0 norm 0) 1e-9)
  121.          (if (= spa fspa)
  122.            (setq plst (sublist plst fspa nil)
  123.                  blst (sublist blst fspa nil)
  124.            )
  125.            (setq srat (/ (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
  126.                             (vlax-curve-getDistAtParam pl spa)
  127.                          )
  128.                          (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
  129.                             (vlax-curve-getDistAtParam pl fspa)
  130.                          )
  131.                       )
  132.                  plst (cons (3dTo2dPt (trans spt 0 norm))
  133.                             (sublist plst (1+ fspa) nil)
  134.                       )
  135.                  blst (cons (k*bulge (nth fspa blst) srat)
  136.                             (sublist blst (1+ fspa) nil)
  137.                       )
  138.            )
  139.          )
  140.         )
  141.         (T
  142.          (setq srat (/ (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
  143.                           (vlax-curve-getDistAtParam pl spa)
  144.                        )
  145.                        (- (vlax-curve-getDistAtParam pl (rem (1+ fspa) 17))
  146.                           (vlax-curve-getDistAtParam pl fspa)
  147.                        )
  148.                     )
  149.                erat (/ (- (vlax-curve-getDistAtParam pl epa)
  150.                           (vlax-curve-getDistAtParam pl fepa)
  151.                        )
  152.                        (- (vlax-curve-getDistAtParam pl (rem (1+ fepa) 17))
  153.                           (vlax-curve-getDistAtParam pl fepa)
  154.                        )
  155.                     )
  156.          )
  157.          (if (< epa spa)
  158.            (setq plst (append
  159.                         (if (= spa fspa)
  160.                           (sublist plst fspa nil)
  161.                           (cons (3dTo2dPt (trans spt 0 norm))
  162.                                 (sublist plst (1+ fspa) nil)
  163.                           )
  164.                         )
  165.                         (cdr (sublist plst 0 (1+ fepa)))
  166.                         (if (/= epa fepa)
  167.                           (list (3dTo2dPt (trans ept 0 norm)))
  168.                         )
  169.                       )
  170.                  blst (append
  171.                         (if (= spa fspa)
  172.                           (sublist blst fspa nil)
  173.                           (cons
  174.                             (k*bulge (nth fspa blst) srat)
  175.                             (sublist blst (1+ fspa) nil)
  176.                           )
  177.                         )
  178.                         (sublist blst 0 fepa)
  179.                         (if (= epa fepa)
  180.                           (list (nth fepa blst))
  181.                           (list (k*bulge (nth fepa blst) erat))
  182.                         )
  183.                       )
  184.            )
  185.            (setq plst (append
  186.                         (if (= spa fspa)
  187.                           (sublist plst fspa (1+ (- fepa fspa)))
  188.                           (cons (3dTo2dPt (trans spt 0 norm))
  189.                                 (sublist plst (1+ fspa) (- fepa fspa))
  190.                           )
  191.                         )
  192.                         (list (3dTo2dPt (trans ept 0 norm)))
  193.                       )
  194.                  blst (append
  195.                         (if (= spa fspa)
  196.                           (sublist blst fspa (- fepa fspa))
  197.                           (cons
  198.                             (k*bulge (nth fspa blst) srat)
  199.                             (sublist blst (1+ fspa) (- fepa fspa))
  200.                           )
  201.                         )
  202.                         (if (= epa fepa)
  203.                           (list (nth fepa blst))
  204.                           (list (k*bulge (nth fepa blst) erat))
  205.                         )
  206.                       )
  207.            )
  208.          )
  209.         )
  210.       )
  211.       (vlax-put pl 'Coordinates (apply 'append plst))
  212.       (foreach b blst
  213.         (vla-SetBulge pl n b)
  214.         (setq n (1+ n))
  215.       )
  216.     )
  217.   )
  218.   pl
  219. )
  220.  
  221. ;; Ang<2pi
  222. ;; Returns the angle expression betweem 0 and 2*pi
  223. (defun ang<2pi (ang)
  224.   (if (and (<= 0 ang) (< ang (* 2 pi)))
  225.     ang
  226.     (ang<2pi (rem (+ ang (* 2 pi)) (* 2 pi)))
  227.   )
  228. )
  229.  
  230. ;; 3dTo2dPt
  231. ;; Returns the 2d point (x y) of a 3d point (x y z)
  232. (defun 3dTo2dPt (pt) (list (car pt) (cadr pt)))
  233.  
  234. ;; Tan
  235. ;; Returns the angle tangent
  236. (defun tan (a) (/ (sin a) (cos a)))
  237.  
  238. ;; SUBLIST
  239. ;; Returns a sub list
  240. ;;
  241. ;; Arguments
  242. ;; lst : a list
  243. ;; start : start index (first item = 0)
  244. ;; leng : the sub list length (number of items) or nil
  245. (defun sublist (lst start leng / n r)
  246.   (if (or (not leng) (< (- (length lst) start) leng))
  247.     (setq leng (- (length lst) start))
  248.   )
  249.   (setq n (+ start leng))
  250.   (while (< start n)
  251.     (setq r (cons (nth (setq n (1- n)) lst) r))
  252.   )
  253. )
  254.  
  255. ;; K*BULGE
  256. ;; Returns the proportinal bulge to the référence bulge
  257. ;; Arguments :
  258. ;; b : the bulge
  259. ;; k : the proportion ratio (between angles or arcs length)
  260. (defun k*bulge (b k / a)
  261.   (setq a (atan b))
  262.   (/ (sin (* k a)) (cos (* k a)))
  263. )
  264.  
  265. ;; EL2PL
  266. ;; Converts ellipses and elliptcal arcs into polylines
  267.  
  268. (defun c:el2pl (/ *error* fra acdoc ss)
  269.   (defun *error* (msg)
  270.     (if (and (/= msg "Fonction annulée")
  271.              (/= msg "Function cancelled")
  272.         )
  273.       (princ (strcat (if (= "FRA" (getvar 'locale))
  274.                        "\nErreur: "
  275.                        "\Error: "
  276.                      )
  277.                      msg
  278.              )
  279.       )
  280.     )
  281.     (vla-endUndoMark acdoc)
  282.     (princ)
  283.   )
  284.   (if (ssget '((0 . "ELLIPSE")))
  285.     (progn
  286.       (vla-StartUndoMark acdoc)
  287.       (vlax-for e (setq ss (vla-get-ActiveSelectionSet acdoc))
  288.         (EllipseToPolyline e)
  289.         (vla-delete e)
  290.       )
  291.       (vla-delete ss)
  292.       (vla-EndUndoMark acdoc)
  293.     )
  294.   )
  295.   (princ)
  296. )
  297.  
  298. ;; PELL
  299. ;; Draws an ellipse or an elliptical arc approximation (polyline) on the fly
  300. (defun c:pell (/ *error* ec pe old ent)
  301.   (defun *error* (msg)
  302.     (if (and msg
  303.              (/= msg "Fonction annulée")
  304.              (/= msg "Function cancelled")
  305.         )
  306.       (princ (strcat (if (= "FRA" (getvar 'locale))
  307.                        "\nErreur: "
  308.                        "\Error: "
  309.                      )
  310.                      msg
  311.              )
  312.       )
  313.     )
  314.     (setvar 'cmdecho ec)
  315.     (setvar 'pellipse pe)
  316.     (princ)
  317.   )
  318.   (setq ec  (getvar 'cmdecho)
  319.         pe  (getvar 'pellipse)
  320.         old (entlast)
  321.   )
  322.   (setvar 'cmdecho 1)
  323.   (setvar 'pellipse 0)
  324.   (command "_.ellipse")
  325.   (while (/= 0 (getvar 'cmdactive))
  326.     (command pause)
  327.   )
  328.   (if (not (eq old (setq ent (entlast))))
  329.     (progn
  330.       (EllipseToPolyline (vlax-ename->vla-object ent))
  331.       (entdel ent)
  332.     )
  333.   )
  334.   (*error* nil)
  335. )
Speaking English as a French Frog

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ellipse to arc
« Reply #6 on: March 17, 2017, 06:41:18 PM »
Warning, elliptical arc start point and end point might be slightly different after the conversion.
Keep in mind you can only approximate an ellispe with circular arcs.
The ellipse approximation in the upper code is the same as the on done by AutoCAD when PELLIPSE sysvar is set to 1.
« Last Edit: March 17, 2017, 06:47:14 PM by gile »
Speaking English as a French Frog

jack91066

  • Guest
Re: ellipse to arc
« Reply #7 on: March 17, 2017, 07:04:52 PM »
sir ,
i need only arc object if because my cnc machine in take only arc boject.
i try to send some photo.

jack91066

  • Guest
Re: ellipse to arc
« Reply #8 on: March 17, 2017, 07:06:34 PM »
i send another photo compare both photo

jack91066

  • Guest
Re: ellipse to arc
« Reply #9 on: March 17, 2017, 07:16:09 PM »
;;-------------------=={ Ellipse to Arc }==-------------------;;
;;                                                            ;;
;;  Converts circular Ellipses & Elliptical Arcs (i.e. for    ;;
;;  which the Ellipse Axis Ratio = 1.0) to Circles & Arcs,    ;;
;;  whilst retaining all original properties. Works with      ;;
;;  Ellipses & Elliptical Arcs constructed in any UCS.        ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:e2a ( / a b c e i m p q r s u v z )   
    (if (setq s (ssget "_:L" '((0 . "ELLIPSE") (40 . 1.0))))
        (repeat (setq i (sslength s))
            (setq e (entget (ssname s (setq i (1- i))))
                  z (cdr (assoc 210 e))
                  c (trans (cdr (assoc 10 e)) 0 z)
                  p (trans (cdr (assoc 11 e)) 0 z)
                  a (distance '(0.0 0.0) p)
                  b (* a (cdr (assoc 40 e)))
                  r (angle '(0.0 0.0) p)
                  u (cdr (assoc 41 e))
                  v (cdr (assoc 42 e))
                  m (list (list (cos r) (- (sin r))) (list (sin r) (cos r)))
                  p (mapcar '+ c (mxv m (list (* a (cos u)) (* b (sin u)))))
                  q (mapcar '+ c (mxv m (list (* a (cos v)) (* b (sin v)))))
            )
            (if
                (if (equal p q 1e-8)
                    (entmake
                        (cons '(0 . "CIRCLE")
                            (append (LM:defaultprops e)
                                (list
                                    (cons  010 c)
                                    (cons  040 a)
                                    (assoc 210 e)
                                )
                            )
                        )
                    )
                    (entmake
                        (cons '(0 . "ARC")
                            (append (LM:defaultprops e)
                                (list
                                    (cons  010 c)
                                    (cons  040 a)
                                    (cons  050 (angle c p))
                                    (cons  051 (angle c q))
                                    (assoc 210 e)
                                )
                            )
                        )
                    )
                )
                (entdel (cdr (assoc -1 e)))
            )
        )
    )
    (princ)
)

;; Default Properties  -  Lee Mac
;; Returns a list of DXF properties for the supplied DXF data,
;; substituting default values for absent DXF groups

(defun LM:defaultprops ( elist )
    (mapcar
        (function
            (lambda ( pair )
                (cond ((assoc (car pair) elist)) ( pair ))
            )
        )
       '(
            (008 . "0")
            (006 . "BYLAYER")
            (039 . 0.0)
            (062 . 256)
            (048 . 1.0)
            (370 . -1)
        )
    )
)

;; Matrix x Vector  -  Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n

(defun mxv ( m v )
    (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)

(princ)

jack91066

  • Guest
Re: ellipse to arc
« Reply #10 on: March 17, 2017, 07:19:57 PM »
i use that coding but if major and minor radius is same that coding is work.
if i change major and minor radius  then that coding is not working.
if any coding have please share ........

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: ellipse to arc
« Reply #11 on: March 17, 2017, 08:00:26 PM »
Why not use Gile's EllipseToPolyline function and then explode the resulting polyline?

jack91066

  • Guest
Re: ellipse to arc
« Reply #12 on: March 17, 2017, 08:14:46 PM »
sir
roy_043

my cnc machine is only take arc object,
if you have any idea about it..

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ellipse to arc
« Reply #13 on: March 18, 2017, 03:36:52 AM »
Hi,

As said roy_043, you can simply explode the polylines generated by EL2PL and so get only arcs.

a video
Speaking English as a French Frog

jack91066

  • Guest
Re: ellipse to arc
« Reply #14 on: March 18, 2017, 03:52:47 PM »
thanks Gile's and roy_04 sir..............