Jump to content

Change this to .fsa ?


Mike55

Recommended Posts

Mike,

 

Your formatting method is not very clear, I have reviewed the first part of your code (see below). It appears you have some unbalanced parenthesis, however due to your formating scheme it is very difficult to locate the issue. Please take some time to put your code into some order and it will become clear where the issue is.

 

(defun ls-error (str)
 (if (/= str "Function canaeled")
   (princ (strcat "\n Error Size,Offset,Length Change one Try again ERROR: " str))
   )
 (setvar "osmode" oom)
 (setvar "blipmode" obm)
 (setvar "dimzin" odz)
 (setvar "dimazin" odaz)
 (setq *error* olderr)
 (princ)
 )
(defun tan  (ang) (/ (sin ang)(cos ang)))  
(defun asin (sine) (atan sine (sqrt (- 1 (* sine sine )))))
(defun acos (cosine) (atan (sqrt (- 1 (* cosine cosine))) cosine))

(defun C:789 (/ svup2 )

;(command ".purge" "Block" "*" "no")

(command ".layer" "M" "1" "C" "7" ""
             "M" "2" "C" "3" ""
             "M" "3" "C" "4" ""
             "M" "4" "C" "5" ""
             "M" "5" "C" "7" ""
             "M" "center" "C" "1" ""
             "M" "6" "C" "1" ""
             "M" "7" "C" "6" """"
    ".layer" "S"  "1"  ""
    )
(setq olderr *error*
     *error* ls-error
     oom  (getvar   'osmode)
     obm  (getvar 'blipmode)
     odz  (getvar   'dimzin)
     ods  (getvar 'dimscale)
     ode  (getvar  'dimadec)
     odaz (getvar 'dimazin)
     )
(setvar "dimazin" 2)
(setvar "osmode" 0)
(setvar "blipmode" 0)
(setvar "dimzin" 
(setvar "dimscale" 
(setvar "dimadec" 4)
(setvar "cmdecho" 0)
(command ".viewres" "" 10000)
;(setvar "osmode" 4)
(command ".insert" "two day" "0,0" "" "" ""
    ".zoom" "all"
    )
(initget "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35")
(setq pick (getkword  "\n  Pick a number 1-35 and hit Enter  "))
(command ".erase" "L" "")


(while (= pick "31")
 (command ".insert" "CA1_31" "0,0" "" "" ""
      ".zoom" "A"
      ".zoom" ".9x"
      )
 (initget 7)
 (setq Sia (getreal "\n    Enter Curb Size {A}.  "))
 (initget 7)
 (setq Sib (getreal "\n    Enter Curb Size {B}.  "))
 (initget 7)
 (setq sic (getreal "\n    Enter Unit Size {C}.  "))
 (initget 7)
 (setq sid (getreal "\n    Enter Unit Size {D}.  "));ALL Letter are up one
 (command ".erase" "l" ""
      ".layer" "s" "Center" ""
      )
 (setq p1 (list 800 10)
   p2 (polar p1 0 4)
   p3 (polar p2 (/ pi 2) 12)
   p4 (polar p3 0 1.5)
   p5 (polar p4 (* pi 1.5) 1)
   p6 (polar p5 0 (- sia 3))
   p7 (polar p6 (/ pi 2) 1)
   p8 (polar p7 0 1.5)
   p9 (polar p8 (* pi 1.5) 12)
   p10 (polar p9 0 4)
   p11 (polar(polar(polar p3 0 (/ sia 2))(/ pi 2) 36) pi (/ sic 2))
   p12 (polar p11 0 sic)
   )
 (command ".line" p1 p2 p3 p4 p5 ""
      ".line" p6 p7 p8 p9 p10 ""
      ".dimlinear" p3 p8 "h" (polar p3 (/ pi 2) 6)
      ".layer" "s" 3 ""
      ".rectangle" p11 (polar(polar p11 0 sic)(/ pi 2) 48)
      ".zoom" "w" (polar p11 (* pi 1.25) 68)(polar(polar p12 (/ pi 2) 48)(/ pi 4)30)
      ".zoom" ".9x"
      ".dimlinear" p11 p12 "h" (polar p11 (* pi 1.5) 6)
      )
 (command ".dimlinear" p11 p3 "h" (polar p11 (* pi 1.5) 18))
       (setq en (entlast)
        en (entget en)
        ds "E")(entmod (subst (cons 1 ds) (assoc 1 en) en)
       )
 (command ".dimlinear" p12 p8 "h" (polar p12(* pi 1.5) 18))
       (setq en (entlast)
        en (entget en)
        ds "F")(entmod (subst (cons 1 ds) (assoc 1 en) en)
       )
       (initget 1 "Yes No")
       (setq ucoc (getkword  "\n Is the Unit Center Over the Curb Offsets E and F ? {Yes No} "))
 (setq ufs (if (= ucoc "No") 2));unit not center=2
 (while (= ufs 2)
       (initget 1 "E F")
       (setq offs (getkword "\n Which Offset do you have {E} or {F} {Zero offset is OK next question}")
             ufs 6
             )
   )
 (while (= offs "E")
       (initget 1)
       (setq loffs (getreal "\n    Enter Offset {E} Zero = Flat  ")
             eofs  (if (= loffs 0) 1 2)
             offs l6
             )
   )
 (setq eoff nil)
 (while (= eofs 2)
   (initget 1 "Inside Outside")
   (setq eoff (getkword  "\n Is the Unit Inside or Outside the Curb {I} or {O}")
     eoff(if (= eoff "Inside") 0 pi)
     offs l6
     eofs 6
     )
   )
 (while (= ucoc "Yes")
   (command ".layer" "s" 3 "")
   (command ".erase" "C"(polar p12 (* pi 1.75)16)(polar p11 (/ pi 1.33)16)"")
   (setq p11 (polar(polar(polar p3 0 (/ sia 2))(/ pi 2) 36) pi (/ sic 2))
     p12 (polar p11 0 sic)
     )



Link to comment
Share on other sites

Snow nut a freebie a check brackets lisp

 

; by BIGAL date years ago 1980s
(defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)
(setvar "cmdecho" 0)
(prompt "\nlook at end of line")
;(setq chekdfile (getstring "enter name of file :"))
(SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))

(setq opf (open chekdfile "r"))
(setq bkt 0)
(setq blkl 0)
(setq rdctl 1)
(setq wkfile (open "c:\temp\wow.lsp" "w"))

(setq currentln "a")
(while (/= blkl 6)
(setq currentln (read-line opf))
(if (= currentln nil)(setq currentln ""))
(if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
(setq wln currentln)                                                        
(while (/= wln "")
       (setq ltr (substr wln 1 1))
       (setq wln (substr wln 2))
       (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
               ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
               ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
               ((and (= ltr ";")(= rdctl 1))(setq wln ""))
               ;(t (prompt ltr))
       )
)
(setq ncln (strcat currentln ";" (itoa bkt)
(princ (itoa bkt))
(if (= rdctl 0) "string open" "")))
(if (/= currentln "")(write-line ncln wkfile))
)
(close wkfile)
(close opf)
(prompt (strcat "open brakets= " (itoa bkt) "."))
)

(setq ang1 nil
     pt1 nil
     pt2 nil
     pt3 nil
     pt4 nil
     pt5 nil)

(princ)

Link to comment
Share on other sites

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...