+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Senior Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    243

    Default add small circles to start and end of arcs

    Registered forum members do not see this ad.

    hello
    can any one help to add a predefined circle or block to each end and start of all arcs in the drawing
    thanks

  2. #2
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    What is the diameter of circles or what is the name of the block ?
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  3. #3
    Senior Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    243

    Default

    hello tharwat
    any diameter(optional)any block in the drawing
    command line:
    select arcs: all arcs selected even polyline if contain circles
    enter radius of circle or name of block:

  4. #4
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    Try this at the moment ....

    Code:
    (defun c:Test (/ ss i sn ins d bname)
    ;;; Tharwat 08. June. 2012  ;;;
      (if
        (and
          (setq ss (ssget "_x" '((0 . "ARC"))))
          (progn
            (initget "Circle Block")
            (setq ins (getkword "\n Choose one [Circle/Block] :"))
          )
        )
         (progn
           (if (eq ins "Block")
             (progn
               (setq bname (getstring t "\n Enter name of Block :"))
               (tblsearch "BLOCK" bname)
               (repeat (setq i (sslength ss))
                 (setq sn (ssname ss (setq i (1- i))))
                 (foreach p (list (vlax-curve-getstartpoint sn)
                                  (vlax-curve-getendpoint sn)
                            )
                   (entmakex (list '(0 . "INSERT")
                                   (cons 2 bname)
                                   (cons 10 p)
                                   '(41 . 1.0)
                                   '(42 . 1.0)
                                   '(43 . 1.0)
                             )
                   )
                 )
               )
             )
             (progn
               (if (setq d (getdist "\n Specify Diameter of Circle :"))
                 (repeat (setq i (sslength ss))
                   (setq sn (ssname ss (setq i (1- i))))
                   (foreach p (list (vlax-curve-getstartpoint sn)
                                    (vlax-curve-getendpoint sn)
                              )
                     (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 d))
                     )
                   )
                 )
               )
             )
           )
         )
         (princ)
      )
      (princ)
    )
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    My version for fun:

    Code:
    (defun c:carc ( / b c d e f i p r s x )
        (if
            (setq s
                (ssget "_X"
                   '(
                        (-4 . "<OR")
                            (0 . "ARC")
                            (-4 . "<AND")
                                (0 . "LWPOLYLINE")
                                (-4 . "<>")
                                (42 . 0.0)
                            (-4 . "AND>")
                        (-4 . "OR>")
                    )
                )
            )
            (progn
                (initget "Block Circle")
                (if (eq "Circle" (getkword "\nBlock or Circle? <Block>: "))
                    (if (setq r (getdist "\nSpecify Circle Radius: "))
                        (setq f (lambda ( p ) (entmake (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))))
                    )
                    (progn
                        (while
                            (not
                                (or (eq "" (setq b (getstring t "\nSpecify Name of Block: ")))
                                    (tblsearch "BLOCK" b)
                                    (and
                                        (setq d (findfile (strcat b ".dwg")))
                                        (progn
                                            (setq c (getvar 'cmdecho))
                                            (setvar 'cmdecho 0)
                                            (command "_.-insert" d nil)
                                            (setvar 'cmdecho c)
                                        )
                                    )
                                )
                            )
                            (princ "\nBlock not found.")
                        )
                        (if (tblsearch "BLOCK" b)
                            (setq f (lambda ( p ) (entmake (list '(0 . "INSERT") (cons 10 p) (cons 2 b)))))
                        )
                    )
                )
                (if f
                    (repeat (setq i (sslength s))
                        (setq e (entget (ssname s (setq i (1- i))))
                              x nil
                        )
                        (if (eq "ARC" (cdr (assoc 0 e)))
                            (foreach a '(50 51)
                                (f (polar (cdr (assoc 10 e)) (cdr (assoc a e)) (cdr (assoc 40 e))))
                            )
                            (while (setq p (assoc 10 e))
                                (setq e (cdr (member p e)))
                                (if (or x (not (equal 0.0 (cdr (assoc 42 e)) 1e-8)))
                                    (progn
                                        (f (cdr p))
                                        (setq x (/= 0.0 (cdr (assoc 42 e))))
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (princ "\nNo Arcs or PolyArcs found.")
        )
        (princ)
    )
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Senior Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    243

    Default

    thank you for tharwat thank you Lee Mac for reply
    code of Lee Mac works fine but there is a problem at tharwat code
    thank you both

  7. #7
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    what is the error message that you have received ?
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  8. #8
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    @motee-z: Just add the line below to Tharwat's code:
    Code:
    (vl-load-com)
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  9. #9
    Senior Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    243

    Default

    it works tharwat after adding (vl-load-com)
    but polylines arcs not considered

    thank you very much

  10. #10
    Senior Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    243

    Default

    Registered forum members do not see this ad.

    mr Lee Mac
    i tried to add these lines in all possible places to create layer named(markarc) to lay circles on but i failed
    (command "layer" "make" "arcmark" "")
    (command "layer" "c" "3" "arcmark" "")
    (command "color" "bylayer")
    any suggestion

Similar Threads

  1. break arcs & circles with 5mm gap - No 2
    By jimpcfd in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 2nd Aug 2010, 09:00 pm
  2. Arcs and Circles
    By aldawn in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 19th Nov 2009, 11:34 am
  3. arcs and extruding circles
    By xander3 in forum AutoCAD 3D Modelling & Rendering
    Replies: 3
    Last Post: 16th Dec 2008, 03:38 pm
  4. arcs print different than circles
    By phonhead in forum AutoCAD Drawing Management & Output
    Replies: 14
    Last Post: 23rd Aug 2007, 05:27 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts