Author Topic: cut lines  (Read 6474 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
cut lines
« Reply #15 on: October 05, 2004, 08:04:36 AM »
hey cab tried it out and it does what i want sometimes. it seems to only trim the stuff out if the cutline extends far past the object. if not the trim gets all screwed up. is this what you meant about fixing the trim part? anyhow works pretty nice so far good job.

ELOQUINTET

  • Guest
cut lines
« Reply #16 on: October 05, 2004, 11:28:41 AM »
so what's up with this routine should i begin modifying small stuff in it or are you still refining it cab. i would like to have ortho turned on and have my osnaps reset upon exiting but don't want to modify it if you are going to update it???

hendie

  • Guest
cut lines
« Reply #17 on: October 05, 2004, 11:44:19 AM »
Dan, what's wrong with you updating it ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
cut lines
« Reply #18 on: October 05, 2004, 11:59:32 AM »
Quote from: eloquintet
hey cab tried it out and it does what i want sometimes. it seems to only trim the stuff out if the cutline extends far past the object. if not the trim gets all screwed up. is this what you meant about fixing the trim part? anyhow works pretty nice so far good job.

Can you post a drawing example of when it fails to trim.
I can not recreate the error.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
cut lines
« Reply #19 on: October 05, 2004, 01:35:45 PM »
Quote from: eloquintet
so what's up with this routine should i begin modifying small stuff in it or are you still refining it cab. i would like to have ortho turned on and have my osnaps reset upon exiting but don't want to modify it if you are going to update it???

I updated the code posted above with changes to osnaps.
Yes, more to come.
Still can not recreate your error.
CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
cut lines
« Reply #20 on: October 05, 2004, 02:49:59 PM »
i can update the simple things hendie but solving the entire riddle is kind of beyond my knowledge at this point. besides i didn't want to do work i was sure cab was already doing to improve the routine. cab i'll post a picture shortly ok.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
cut lines
« Reply #21 on: October 05, 2004, 08:54:21 PM »
OK,here is the updated code.
Still has an issue with lines to be trimmed that run through the Z part
of the pline. If the line to be trimmed runs through 3 times some of the
line may not be trimmed. There also an issue with lines that just protrude
into the trim space but are closer that the trim distance. i set the trim
distance at (break line length / 70) which works out to be 36/70= 0.51
That is 1/2 inch on a 36 inch break line.
If this is not close enough I'll change it.
Code: [Select]
;;; Lisp to draw Single or Double "Z" Break Lines
;;;                 © A.Henderson 2002
;;;
;;;  Modified By Charles Alan Butler  10/02/2004
;;;  To allow any angle and to trim lines that
;;;  do not run through both break symbols
;;;

(defun c:dz (/ oldlay oldotho oldosmode ztype dist ang
             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>"))
  (setosnaps "ON") ; force on
  ;;===========================================
  (if (and (setq p1 (getpoint "Starting point of break line : "))
           (setq p6 (getpoint p1 "End point of break line : "))
      )
    (progn;===========================================
      (setvar "plinewid" 0)
      (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
         (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
         (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))

      ;;  trim function
      (initget "Y N")
      (setq ans (getkword "\n Do you wish to trim the lines now ? (Y or N) <N>"))
      (if (= ans "Y")
        (progn
          (setq evl1 (cdrs 10 (entget e1)) ; ent vertex list
                evl2 (cdrs 10 (entget e2))
                ang1 (angle p1 (car evl2))
                ang2 (angle (car evl2) p1)
          )
          (setq lst  '()
                dist (/ dist 70.0)
          )
          (foreach x evl1
            (setq lst (cons (polar x ang1 1) lst))
          )
          (foreach x (reverse evl2)
            (setq lst (cons (polar x ang2 1) lst))
          )
          (setosnaps "OFF") ; force off
          (command ".trim" e1 e2 "" "F")
          (apply 'command lst)
          (command "" "")
        ) ; progn
      ) ;_ endif


    ) ; 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)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
cut lines
« Reply #22 on: October 06, 2004, 08:11:37 AM »
ok cab i haven't tried the newest version, didn't know it was up but here's my screenshot from this morning. i'll try the new one and see how it goes. the width of my obect in the drawing is 1/2"

http://theswamp.org/lilly_pond/dan/CUTLINE%202.JPG?nossi=1

PDJ

  • Guest
cut lines
« Reply #23 on: October 06, 2004, 12:37:45 PM »
Hey HypoSmurf, I have one I wrote a while back that does what you need.  Check this out and let me know:

[code](defun c:TR2 (/ p1 p2 e1 e2 d1)
  (setvar "cmdecho" 0)
  (prompt "\nIndicate TRIM planes: ")
  (setq p1 (getpoint))
  (setq p2 (getpoint p1))
  (command nil nil nil "point" "@")
  (setq e1 (entlast))
  (entdel e1)
  (command "line" p1 p2 "")
  (setq e2 (entnext e1))
  (prompt "\nIndicate 2nd TRIM plane: ")
  (setq p3 (getpoint))
  (setq p4 (getpoint p3))
  (command nil nil nil "point" "@")
  (setq e3 (entlast))
  (entdel e3)
  (command "line" p3 p4 "")
  (setq e4 (entnext e3))
   (while
    (setq d1 (entsel "\nSelect object(s) to TRIM: "))
    (command "TRIM" e2 e4 "" d1 "")
   );while
  (entdel e2)
  (entdel e4)
(setvar "cmdecho" 1)
 (princ)
)
[code][/code]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
cut lines
« Reply #24 on: October 06, 2004, 02:51:20 PM »
Dan,
Here is the latest code.
Reduced the trim distance to catch any close lines.
Had the routine trim twice to get any lines that the first
may have missed. Revised the method to get a fence as the old
method had a gotcha in it.

Code: [Select]
;;; 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
;;;

(defun c:dz (/ oldlay oldotho oldosmode ztype dist ang
             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>"))
  (setosnaps "ON") ; force on
  ;;===========================================
  (if (and (setq p1 (getpoint "Starting point of break line : "))
           (setq p6 (getpoint p1 "End point of break line : "))
      )
    (progn;===========================================
      (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
         (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
         (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 "\n Do you wish to trim the lines now ? (Y or N) <N>"))
      (if (= ans "Y")
        (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)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
cut lines
« Reply #25 on: October 07, 2004, 08:24:51 AM »
ok i'll give it a try later today thanks man

M-dub

  • Guest
cut lines
« Reply #26 on: October 07, 2004, 08:44:29 AM »
That's pretty sweet.  I like it.  :)

ELOQUINTET

  • Guest
cut lines
« Reply #27 on: October 07, 2004, 11:08:23 AM »
cab works great now. i changed a couple things though. i removed the single or double prompt at the beginning as i only use single and kept picking instead. and of course i changed the layer. one question though if i wanted it to trim automatically instead of having to say yes how would i modify it. i tried just taking this section  out of the trim function but get an error



Code: [Select]
     (initget "Y N")
      (setq ans (getkword "\n Do you wish to trim the lines now ? (Y or N) <N>"))
      (if (= ans "Y")

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
cut lines
« Reply #28 on: October 07, 2004, 11:27:35 AM »
Code: [Select]
       ) ; progn
      ) ;_ endif         <--------------<<<  Remove this line
      (command "._undo" "_end")
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
cut lines
« Reply #29 on: October 07, 2004, 11:40:29 AM »
hmmm when i took it out i got malformed list