Jump to content

Recommended Posts

Posted

hello:

Does anyone have something that does this or something similar?

 

image.thumb.png.d1093ae686fe8d37ba1e5d018408e21b.png

Break the lines and draw those symbols

Any comments are welcome, thank you.

Posted (edited)

A small modification of the DZ code for convenience.
The Break lines can be lengthen by the specified distance (Fixed) 
or proportionally (by 1/3) or None.
[Fixed/Proportional/None]

;;; Lisp to draw Single or Double "Z" Break Lines
;;;                 © A.Henderson 2002
;;;  Modified By Charles Alan Butler  10/06/2004
;;;  To allow any angle and to trim lines that
;;;  do not run through both break symbols
;;;  Modified 12/02/26
;;;  The Break lines can be lengthen by the specified distance (Fixed) 
;;;  or proportionally (by 1/3) or None

(defun c:dz-mod (/ oldlay oldotho oldosmode ztype dist ang
             extOpt extLen dist0 segLen
             e1 e2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10)
  ;; return vertex list by MP
  (defun cdrs (key lst / pair rtn)
    (while (setq pair (assoc key lst))
      (setq rtn (cons (cdr pair) rtn)
            lst (cdr (member pair lst))
      )
    )
    (reverse rtn)
  ) ; defun
  ;;  set osnaps ON/OFF
  (defun setosnaps (value) ; value = "ON" or default to "OFF"
    (if value
      (setq value (strcase value))
    )
    (cond
      ((or (and (= value "ON") (>= (getvar "osmode") 16383))
           (and (/= value "ON") (<= (getvar "osmode") 16383))
       )
       (setvar "osmode" (boole 6 (getvar "osmode") 16384))
      )
    )
  ); defun
  ;;   Start of routine  ==================================
  ;;  Save settings
  (setq oldlay    (getvar "clayer")
        oldortho  (getvar "orthomode")
        oldosmode (getvar "osmode")
  ) ;_ end of setq
  ;;  I use current layer - CAB
  ;;(command "_.layer" "_make" "Z-Line" "_Colour" "41" "" "")
  (initget "S D")
  ;(setq ztype (getkword "\n Single or Double -^v-^v- ? (S or D) <S>"))
  (setq ztype (getkword "\n Single or Double -^v-^v- ? [S/D] <S>"))
  (setosnaps "ON") ; force on
  ;;===========================================
  (if (and (setq p1 (getpoint "Starting point of break line : "))
           (setq p6 (getpoint p1 "End point of break line : "))
      )
    (progn;===========================================
      ;;; --- EXT --- calculate the base length/angle based on the selected points                        
      (setq dist0 (distance p1 p6))
      ;;; --- EXT --- elongation mode (Fixed = 50 by default)
      (initget "F P N")
      (setq extOpt (getkword "\nExtend beyond picked points? [Fixed/Proportional/None] <Fixed>: "))
      (cond
        ((or (not extOpt) (= extOpt "F"))
          (setq extLen (getdist "\nExtension length <50>: "))
          (if (null extLen) (setq extLen 50.0))
        )
        ((= extOpt "P")
          ;; 1/3 of the straight section (straight section = 0.4167*dist for S, and 0.4167*(dist/2) for D)
          (setq segLen (* 0.4167 (if (= ztype "D") (/ dist0 2.0) dist0)))
          (setq extLen (/ segLen 3.0))
        )
        (T (setq extLen 0.0))
      )
      (setvar "plinewid" 0)
      (command "._undo" "_begin")
      (cond
        ((/= ztype "D") ; default to single
         (setq dist (distance p1 p6)
               ang  (angle p1 p6)
               p2   (polar p1 ang (* 0.4167 dist))
               p5   (polar p1 ang (* 0.5833 dist))
               p3   (polar p2 (+ 1.25664 ang) (* 0.1667 dist))
               p4   (polar p5 (+ 4.39824 ang) (* 0.1667 dist))
         ) ;_ end of setq
         ;;; --- EXT ---  we only lengthen the ends (the symbol remains at the base points)
         (setq p1 (polar p1 (+ ang pi) extLen)
               p6 (polar p6 ang extLen)
         )
         (setosnaps "OFF") ; force off
         (command "_.pline" p1 p2 p3 p4 p5 p6 "") ; Draw the Z-Line
        ) ;_ end cond "S"
        ;;===========================================
        ((= ztype "D")
         (setq p10  p6
               dist (/ (distance p1 p6) 2.0)
               ang  (angle p1 p6)
               p2   (polar p1 ang (* 0.4167 dist))
               p5   (polar p1 ang (* 0.5833 dist))
               p3   (polar p2 (+ 1.25664 ang) (* 0.1667 dist))
               p4   (polar p5 (+ 4.39824 ang) (* 0.1667 dist))
               p6   (polar p5 ang (* 0.8334 dist))
               p9   (polar p6 ang (* 0.1661 dist))
               p7   (polar p6 (+ 1.25664 ang) (* 0.1667 dist))
               p8   (polar p9 (+ 4.39824 ang) (* 0.1667 dist))
         ) ;_ end of setq

         ;;; --- EXT ---  we extend the start and the very end (p10), we do not touch the inside                       
         (setq p1  (polar p1 (+ ang pi) extLen)
               p10 (polar p10 ang extLen)
         )
         (setosnaps "OFF") ; force off
         (command "_.pline" p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 "") ; Draw the Z-Line
        ) ;_ end cond
      ) ; end cond stmt
      ;;  Position the second break line
      (setq e1 (entlast))
      (command "_.pedit" e1 "_L" "_ON" "")
      (command "_.copy" e1 "" (getvar "lastpoint") pause)
      (setq e2 (entlast))
      (setq plast (getvar "lastpoint"))
  ;;  trim function
      (initget "Y N")
      (setq ans (getkword "
Do you wish to trim the lines now ? [Y/N] <Y>"))
      (if (or (= ans "Y") (not ans))
        (progn
          (setq lst  '()
                dist (/ dist 140.0) ; trim distance
          )
          ;;  create trim lines
          (command "._offset" dist e1 plast "")
          (setq evl1 (cdrs 10 (entget (entlast)))) ; ent vertex list
          (entdel (entlast))
          (command "._offset" dist e2 p1 "")
          (setq evl2 (cdrs 10 (entget (entlast))))
          (entdel (entlast))
          (setq lst (append evl1 (reverse evl2)))
          (setosnaps "OFF") ; force off
          (command "_.trim" e1 e2 "" "_F")
          (apply 'command lst)
          (command "" "")
          (command "_.trim" e1 e2 "" "_F")
          (apply 'command lst)
          (command "" "")
        ) ; progn
      ) ;_ endif
      (command "._undo" "_end")
    ) ; progn
  ) ; endif
  ;;================
  ;;  Exit sequence
  ;;================\
  ;;  Restore settings
  ;;  I use current layer - CAB
  ;;(command "_.layer" "set" oldlay "")
  (setvar "orthomode" oldortho)
  (setvar "osmode" oldosmode)
  (princ)
) ;_ end of defun
(prompt
  "\nDouble Break Symbol Creator loaded.  Type DZ to run it."
)
(princ)
(setfunhelp "c:dz" "acadtools.chm" "dz")

 

dz-mod2.png

Edited by Nikon
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...