+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member tmelancon's Avatar
    Computer Details
    tmelancon's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell Optiplex 7010
    CPU:
    i3-3220 Processor (Quad Core, 3.30GHz)
    RAM:
    8GB
    Graphics:
    HD2500 Graphics
    Primary Storage:
    500GB
    Secondary Storage:
    2TB External Backup
    Monitor:
    Dual Dell 27" Monitors!!
    Discipline
    Multi-disciplinary
    tmelancon's Discipline Details
    Occupation
    CAD Operations/Design
    Discipline
    Multi-disciplinary
    Details
    CAD Design, CAD Management, Project Management, ISO Drawings, Pressure Vessels, Inspection Reports, Data Analysis, Work Scope Recommendations, Troubleshooting, and anything else the boss needs to maximize efficiency. Also proficient in Electrical Engineering/Lighting Design and LEED Green Energy
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Posts
    327

    Exclamation Enter a Donut at two ends of a line. Please Help! Appreciated!

    Registered forum members do not see this ad.

    I really need a lisp to find the ends of the lines then offset from those ends by [.25] and insert a solid "donut" at the ends of a line or multiple lines. I have the donut lisp we are currently using as well as another lisp I found on the web that is verrrrrry close to what I am needing. See below for the lisp and pics of what the current code does and what I am looking for. THANKS IN ADVANCE to everyone in the forums, your help is greatly appreciated!

    Here is the Solid Donut command I use. We call them bb's.

    Code:
    (defun c:bb ()
      (command "donut" "0" ".0670")(PRINC))
    Here is the lisp I found that is sort of close. Courtesy of KENT1COOPER via AutoDesk Forums:

    Code:
    (DEFUN C:CMARK (/ CRAD SS LN)
     (SETQ CRAD 0.0335) 
     (SETQ SS (SSGET "X" '((0 . "LINE"))))
      (REPEAT (SSLENGTH SS)
       (SETQ LN (ENTGET (SSNAME SS 0)))
       (ENTMAKE
        (LIST
         '(0 . "CIRCLE")
          (ASSOC 10 LN)
          (CONS 40 CRAD)
        )
      )
      (ENTMAKE
       (LIST
        '(0 . "CIRCLE")
         (CONS 10 (CDR (ASSOC 11 LN)))
         (CONS 40 CRAD)
       )
      )
      (SSDEL (SSNAME SS 0) SS)
     )
    )
    current routine:


    new routine: (what I would like to try and get it to do)
    Attached Images
    It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt. -Abraham Lincoln

  2. #2
    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
    19,368

    Default

    Try something like this:
    Code:
    (defun c:dlines ( / e i p q s )
        (if (setq s (ssget '((0 . "LINE"))))
            (repeat (setq i (sslength s))
                (setq e (entget (ssname s (setq i (1- i))))
                      p (cdr (assoc 10 e))
                      q (cdr (assoc 11 e))
                )
                (LM:donut (polar p (angle p q) 0.25) 0.0 0.0335)
                (LM:donut (polar q (angle q p) 0.25) 0.0 0.0335)
            )
        )
        (princ)
    )
    
    ;; Donut  -  Lee Mac
    ;; cen - [lst] Donut center
    ;; rd1 - [num] Inside radius
    ;; rd2 - [num] Outside radius
    
    (defun LM:donut ( cen rd1 rd2 / ocs thk )
        (setq thk (abs (- rd2 rd1))
              ocs (trans '(0 0 1) 1 0 t)
        )
        (entmakex
            (list
               '(000 . "LWPOLYLINE")
               '(100 . "AcDbEntity")
               '(100 . "AcDbPolyline")
               '(090 . 2)
               '(070 . 1)
                (cons 43 thk)
                (cons 10 (polar (trans cen 0 ocs) pi (+ rd1 (/ thk 2.0))))
               '(042 . 1)
                (cons 10 (polar (trans cen 0 ocs) 0  (+ rd1 (/ thk 2.0))))
               '(042 . 1)
                (cons 210 ocs)
            )
        )
    )
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  3. #3
    Senior Member tmelancon's Avatar
    Computer Details
    tmelancon's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell Optiplex 7010
    CPU:
    i3-3220 Processor (Quad Core, 3.30GHz)
    RAM:
    8GB
    Graphics:
    HD2500 Graphics
    Primary Storage:
    500GB
    Secondary Storage:
    2TB External Backup
    Monitor:
    Dual Dell 27" Monitors!!
    Discipline
    Multi-disciplinary
    tmelancon's Discipline Details
    Occupation
    CAD Operations/Design
    Discipline
    Multi-disciplinary
    Details
    CAD Design, CAD Management, Project Management, ISO Drawings, Pressure Vessels, Inspection Reports, Data Analysis, Work Scope Recommendations, Troubleshooting, and anything else the boss needs to maximize efficiency. Also proficient in Electrical Engineering/Lighting Design and LEED Green Energy
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Posts
    327

    Default

    Again, another brilliant piece of work. Thank you so much Lee. Blessings! Worked like a charm!
    It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt. -Abraham Lincoln

  4. #4
    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
    19,368

    Default

    You're welcome
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,902

    Default

    You could do the same with a pline just stepping through the vertices to work out the new donut points. Lee ?
    A man who never made mistakes never made anything

  6. #6
    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
    19,368

    Default

    Quote Originally Posted by BIGAL View Post
    You could do the same with a pline just stepping through the vertices to work out the new donut points. Lee ?
    Sure - something like:
    Code:
    (defun c:dlines ( / e i l s )
        (if (setq s (ssget '((0 . "LINE,LWPOLYLINE"))))
            (repeat (setq i (sslength s))
                (setq e (entget (ssname s (setq i (1- i)))))
                (if (= "LINE" (cdr (assoc 0 e)))
                    (setq l (list (cdr (assoc 10 e)) (cdr (assoc 11 e))))
                    (setq l (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) e)))
                )
                (while (cadr l)
                    (LM:donut (polar (car  l) (angle (car  l) (cadr l)) 0.25) 0.0 0.0335)
                    (LM:donut (polar (cadr l) (angle (cadr l) (car  l)) 0.25) 0.0 0.0335)
                    (setq l (cdr l))
                )
            )
        )
        (princ)
    )
    
    ;; Donut  -  Lee Mac
    ;; cen - [lst] Donut center
    ;; rd1 - [num] Inside radius
    ;; rd2 - [num] Outside radius
    
    (defun LM:donut ( cen rd1 rd2 / ocs thk )
        (setq thk (abs (- rd2 rd1))
              ocs (trans '(0 0 1) 1 0 t)
        )
        (entmakex
            (list
               '(000 . "LWPOLYLINE")
               '(100 . "AcDbEntity")
               '(100 . "AcDbPolyline")
               '(090 . 2)
               '(070 . 1)
                (cons 43 thk)
                (cons 10 (polar (trans cen 0 ocs) pi (+ rd1 (/ thk 2.0))))
               '(042 . 1)
                (cons 10 (polar (trans cen 0 ocs) 0  (+ rd1 (/ thk 2.0))))
               '(042 . 1)
                (cons 210 ocs)
            )
        )
    )
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  7. #7
    Senior Member tmelancon's Avatar
    Computer Details
    tmelancon's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell Optiplex 7010
    CPU:
    i3-3220 Processor (Quad Core, 3.30GHz)
    RAM:
    8GB
    Graphics:
    HD2500 Graphics
    Primary Storage:
    500GB
    Secondary Storage:
    2TB External Backup
    Monitor:
    Dual Dell 27" Monitors!!
    Discipline
    Multi-disciplinary
    tmelancon's Discipline Details
    Occupation
    CAD Operations/Design
    Discipline
    Multi-disciplinary
    Details
    CAD Design, CAD Management, Project Management, ISO Drawings, Pressure Vessels, Inspection Reports, Data Analysis, Work Scope Recommendations, Troubleshooting, and anything else the boss needs to maximize efficiency. Also proficient in Electrical Engineering/Lighting Design and LEED Green Energy
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Posts
    327

    Default

    Nice work. By the way Lee, I use your Layer Director to throw all kinds of different commands we run on different layers. Is there any way to manipulate this routine to throw those donuts (bbs) onto a layer we currently use called "WELD".. Much obliged and thanks BIG AL for chiming in! You da man!
    It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt. -Abraham Lincoln

  8. #8
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,902

    Default

    All credit to Lee it was just obvious that the next question would be plines.
    A man who never made mistakes never made anything

  9. #9
    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
    19,368

    Default

    Quote Originally Posted by tmelancon View Post
    Nice work.
    Thanks

    Quote Originally Posted by tmelancon View Post
    Is there any way to manipulate this routine to throw those donuts (bbs) onto a layer we currently use called "WELD"
    Sure, change:
    Code:
               '(070 . 1)
                (cons 43 thk)
    to:
    Code:
               '(070 . 1)
               '(008 . "WELD")
                (cons 43 thk)
    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  10. #10
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Sep 2016
    Posts
    1

    Default need lisp for Enter a Donut at connecting lines

    Registered forum members do not see this ad.

    This is the lisp which is close what i need, can someone help and modify this for my requirement.

Similar Threads

  1. line at both ends of the extension
    By highflybird in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 27th Oct 2016, 12:29 am
  2. Convert DONUT to wipeout DONUT
    By marko_ribar in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 30th Mar 2014, 10:03 am
  3. Drawing a line with one or two arrow ends
    By titech in forum AutoCAD General
    Replies: 15
    Last Post: 25th Oct 2012, 12:29 pm
  4. special ends on line object
    By JerryFiedler in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 27th Aug 2009, 10:15 am
  5. special ends on line objects
    By JerryFiedler in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 5th Jun 2009, 05:10 pm

Tags for this Thread

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