Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaidong committed Oct 21, 2019
1 parent 32c6d7e commit 5d75889
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 259 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
test.lsp
**/*.orig
tags

3 changes: 1 addition & 2 deletions caad.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

;; wall & openning
(load "wallx.lsp")
;只支持visul lisp
;(load "wall.lsp")
(load "wall.lsp")

;; symbole
(load "bubble.lsp")
Expand Down
7 changes: 7 additions & 0 deletions geom.lsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;几何算法;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 算斜度 pt1(x1 y1) pt2(x2 y2) |(y1-y2)/(x1-x2)|
(defun Geom-GetSlope (pt1 pt2 / x)
; Vertical?
Expand All @@ -10,3 +13,7 @@
(rtos (/ (abs (- (cadr pt1) (cadr pt2))) x) 2 4)
)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;retrieve the Entity Data;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 changes: 22 additions & 7 deletions util.lsp
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
; A real number defining the maximum amount by which expr1 and expr2 can differ and still be considered equal.
;; A real number defining the maximum amount by which expr1 and expr2 can differ
;; and still be considered equal.
(setq Util-Fuzz 1.0e-6)

;; debug程序加载进程情况;;;
(setq @Util-Working '("\\" "|" "/" "-"))
;; debug程序加载进程情况
(setq @Util-Working
'("\\" "|" "/" "-"))
(defun Util-Working ()
; Backspace
(prompt "\010")
(setq @Util-Working (append (cdr @Util-Working) (list (princ (car @Util-Working)))))
)
; Backspace
(prompt "\010")
(setq @Util-Working
(append
(cdr @Util-Working)
(list
(princ (car @Util-Working)))
)
)
)

(defun Util-HelloWorld ()
(princ "hello world")
(setq greeding
'(1 2 3)
)
)
89 changes: 37 additions & 52 deletions wall.lsp
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
;;;=============================================
;;; Most of the following codes are writen by ;
;;; CHEN QING JUN ;
;;; Civil engineering Department, ;
;;; South China University of Technology ;
;;; http://autolisper.googlepages.com ;
;;; http://qjchen.googlepages.com ;
;;; Purpose:Draw different width double line ;
;;; 2006.07.02 ;
;;; Version:0.1 ;
;;; ============================================

;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Main function
;;; require autocad
;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:wall (/ p1 plist w1 w1a w2 w2a w1lst w2lst anglist seglist
seg1list seg2list)
(setq w1 10
(defun c:wall (/ p1 plist w1 w1a w2 w2a w1lst w2lst anglist seglist seg1list seg2list)
;设置wall的宽度
(setq w1 10
w1a 10
w2 20
w2 20
w2a 20
)
(setq w1lst (makew w1 w1a 100))
Expand Down Expand Up @@ -48,28 +37,24 @@ seg1list seg2list)
(entmakepolyline seg1list)
(entmakepolyline seg2list)
)

;;;getpointlist
(defun getpointlst (w1lst w2lst / plist p1 p i)
(setq p1 (getpoint))
(setq plist (append
plist
(list p1)
)
)
(setq plist (append plist (list p1)))
(setq i 0)

(while (setq p (getpoint p1))
;;grdraw: Draws a vector between two points, in the current viewport
(grdraw p1 p 9)
(tempgrdraw p1 p i w1lst w2lst)
(setq plist (append
plist
(list p)
)
)
(setq plist (append plist (list p)))
(setq p1 p)
(setq i (1+ i))
)
plist
)

;;;tempdraw
(defun tempgrdraw (p1 p2 n lst1 lst2 / ang)
(setq ang (angle p1 p2))
Expand All @@ -85,6 +70,7 @@ seg1list seg2list)
(defun 1ton_1 (lst)
(reverse (cdr (reverse lst)))
)

;;;to get the offset segment of two side line
(defun segxlist (lst lst1 direction wlst / i res xa xb x1a x1b)
(setq i 0)
Expand All @@ -107,6 +93,8 @@ seg1list seg2list)
)
res
)


;;;;find the inter intersections of a list of points
(defun intlst (lst / i res p1 p2 p3 p4)
(setq i 0)
Expand All @@ -131,40 +119,38 @@ seg1list seg2list)
)
res
)


(defun inter (a b c d / res)
(if (equal b c)
b
(inters
a
b
c
d
nil
)
(inters a b c d nil)
)
)
;;;function of entmake lwpolyline,by ElpanovEvgeniy at
;www.theswamp.org
(defun entmakepolyline (lst)
(entmakex (append
(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 .

"AcDbPolyline")
(cons 90 (length lst)) '(70 . 0) ;;;1 is closed
;; function of entmake lwpolyline
(defun entmakepolyline (lst)
(entmakex
(append
(list '(0 . "LWPOLYLINE")
(cons 90 (length lst))
'(70 . 0) ;;;1 is closed
) ;_ list
(mapcar '(lambda (x)
(cons 10 x)
)
lst
)
) ;_ append
(mapcar '(lambda (x) (cons 10 x)) lst)
) ;_ append
)
)

;;;;make width list
;;w1: 墙点1宽度
;;w2: 墙点2宽度
;;n: 100
(defun makew (w1 w2 n / res i)
(setq i 1)
(repeat n
(if (odd i)
;; The REM function divides the first number on the second number and returns the reminder.
;; 判断i是否是奇数
(if (= (rem i 2) 1)
(setq res (append
res
(list w1 w2)
Expand All @@ -179,8 +165,7 @@ seg1list seg2list)
(setq i (1+ i))
)
res
;; 需要改进这个宽度方法,不需要为宽度设置数组
(princ res)
)
;;;judge whether a number is an odd number
(defun odd (x)
(/= (/ x 2) (* 0.5 x))
)

Loading

0 comments on commit 5d75889

Please sign in to comment.