Author Topic: again, the break line  (Read 3043 times)

0 Members and 1 Guest are viewing this topic.

Oak3s

  • Guest
again, the break line
« on: October 20, 2004, 01:44:47 PM »
well, ive played with the break line routine CAB gave me a couple days ago. so far i added a part to put the break on a spacific layer and then set it back. i also added a part where the break line is 2 units longer than the pick points. the '2' units was just to get it working. what i would like to do is have the unit number be determind by the dimscale. what ive been trying is to go 1/8" longer than the pick points but i cant seem to get it to work. i have an error somewhere but i cant find it. any help would be appreciated. im not really familiar with this. i just kind of jumped into it. and thanks go to CAB for the routine.
any sugestions at all would be appreciated.

Code: [Select]

[color=green];;;===========================================
;;;      Single Line Break Symbol Creator    
;;;===========================================
;;;
;|     Created by C. Alan Butler  2003
       Edited by J. Oakes 2004 (recieved by CAB on TheSwamp.org)
|;
 ;
(defun c:brkw (/ ang cla dist dscale oldcmd p1a p1 p2 p2 p3 p4 p5 p6a p6 plwidth size usercmd useros)
 ;
;;;<<<<<Error Function & Routine Exit>>>>>
;;;=======================================
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; if
    (setvar "CMDECHO" usercmd)
    (setvar "osmode" useros)
    (princ)
  ) ;
 ;end error function
;
;
;;;<<<<<Set value of Symbols>>>>>
;;;==============================
  (setq cla (getvar "clayer"))
  (setq oldcmd (getvar "CMDECHO"))
  (setq plwidth (getvar "plinewid"))
  (setq useros (getvar "osmode"))
  (setq usercmd (getvar "CMDECHO"))
  (setq dscale (getvar "dimscale"))
;
;
;;;<<<<<Set Variables
  (setvar "CMDECHO" 0)  
  (setvar "plinewid" 0)
   
  (if (and (setq p1a (getpoint "Starting point of line : "))
           (setq p6a (getpoint p1a "\nSelect second point: "))
      )
    (progn
      (setq dist (distance p1a p6a)
            ang  (angle p1a p6a)
            size (* dscale .125)
            p1   (polar p1a ang -size)
            p2   (polar p1a ang (* 0.4167 dist))
            p5   (polar p1a ang (* 0.5833 dist))
            p3   (polar p2 (+ 1.25664 ang) (* 0.1667 dist))
            p4   (polar p5 (+ 4.39824 ang) (* 0.1667 dist))
            p6   (polar p6a ang size)
      ) ;_ end of setq
      (setvar "osmode" 0)
      (command "-layer" "thaw" "S-STAIR" "on" "S-STAIR" "make" "S-STAIR" "color"
      "YELLOW" "S-STAIR" "lt" "continuous" "S-STAIR" "")
      (command "pline" p1 p2 p3 p4 p5 p6 "") ; Draw the Z-Line
      )
  )
;
;
;;;<<<<<Set Variables back to previous>>>>>
;;;========================================
(setvar "clayer" cla)
(setvar "plinewid" plwidth)
 
 
  (*error* "")
  (princ)
)

(princ)
[/color]

Oak3s

  • Guest
again, the break line
« Reply #1 on: October 20, 2004, 02:00:27 PM »
i forgot. the 'size' is where '2' used to be. i tried to get a number (size) by multiplying the dimscale by .125.  hope that helps clarify.....i hope.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
again, the break line
« Reply #2 on: October 20, 2004, 02:14:22 PM »
Good job figuring things out.
When you use a fraction  add a leading zero, like this.
Code: [Select]
size (* dscale 0.125)
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
again, the break line
« Reply #3 on: October 20, 2004, 02:18:46 PM »
The error routine is always the exit routine so move this:
Code: [Select]
;;;<<<<<Set Variables back to previous>>>>>
;;;========================================
(setvar "clayer" cla)
(setvar "plinewid" plwidth)

to here:
Code: [Select]
;;;<<<<<Error Function & Routine Exit>>>>>
;;;=======================================
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; if
    (setvar "CMDECHO" usercmd)
    (setvar "osmode" useros)
    (setvar "clayer" cla) ; <=========<<<
    (setvar "plinewid" plwidth) ; <=======<<<
    (princ)
  ) ;
 ;end error function
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.

Oak3s

  • Guest
again, the break line
« Reply #4 on: October 20, 2004, 03:14:35 PM »
thanks again CAB. it will at least start but it wont finish now.  

Command: brk Starting point of line :
Select second point:
Error: bad argument type: numberp: nil

i dont know what that means. here is what i have now.

Code: [Select]

[color=green];;;===========================================
;;;      Single Line Break Symbol Creator    
;;;===========================================
;;;
;|     Created by C. Alan Butler  2003
       Edited by J. Oakes 2004 (recieved by CAB on TheSwamp.org)
                 Added:
                       >>> Clayer Variable is stored and reset after completion
                       >>> Plinewid variables is stored and reset after completion
                       >>> S-STAIR layer is created and set current for routine
                       >>> Break line is drawn on the S-STAIR layer
                       >>> Extension lines on both sides determind by the dimscale
|;
 ;
(defun c:brkw (/ ang cla dist dscale oldcmd p1a p1 p2 p2 p3 p4 p5 p6a p6 plwidth size usercmd useros)
 ;
;;;<<<<<Error Function & Routine Exit>>>>>
;;;=======================================
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; if
    (setvar "CMDECHO" usercmd)
    (setvar "osmode" useros)
    (setvar "clayer" cla)
    (setvar "plinewid" plwidth)
    (princ)
  ) ;
 ;end error function
;
;
;;;<<<<<Set value of Symbols>>>>>
;;;==============================
  (setq cla (getvar "clayer"))
  (setq oldcmd (getvar "CMDECHO"))
  (setq plwidth (getvar "plinewid"))
  (setq useros (getvar "osmode"))
  (setq usercmd (getvar "CMDECHO"))
  (setq dscale (getvar "dimscale"))
;
;
;;;<<<<<Set Variables>>>>>
;;;=======================
  (setvar "CMDECHO" 0)  
  (setvar "plinewid" 0)
   
  (if (and (setq p1a (getpoint "Starting point of line : "))
           (setq p6a (getpoint p1a "\nSelect second point: "))
      )
    (progn
      (setq dist (distance p1a p6a)
            ang  (angle p1a p6a)
            size (* dscale 0.125)
            p1   (polar p1a ang -size)
            p2   (polar p1a ang (* 0.4167 dist))
            p5   (polar p1a ang (* 0.5833 dist))
            p3   (polar p2 (+ 1.25664 ang) (* 0.1667 dist))
            p4   (polar p5 (+ 4.39824 ang) (* 0.1667 dist))
            p6   (polar p6a ang size)
      ) ;_ end of setq
      (setvar "osmode" 0)
      (command "-layer" "thaw" "S-STAIR" "on" "S-STAIR" "make" "S-STAIR" "color"
      "YELLOW" "S-STAIR" "lt" "continuous" "S-STAIR" "")
      (command "pline" p1 p2 p3 p4 p5 p6 "") ; Draw the Z-Line
      )
  )
(*error* "")
  (princ)
)

(princ)
[/color]

Oak3s

  • Guest
again, the break line
« Reply #5 on: October 20, 2004, 03:16:45 PM »
i think it has to do with the '-' before one of the 'size' variables. how do i make it use the negative of that value?

Oak3s

  • Guest
again, the break line
« Reply #6 on: October 20, 2004, 03:43:55 PM »
(- (abs Number))
i got it working now. thanks to all that have helped so far. i still have some more i want to do to it. you will probably hear more about this one from me.
Jeremy

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
again, the break line
« Reply #7 on: October 20, 2004, 03:56:46 PM »
Just use this
(polar p1a ang (- size))
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.