Đến nội dung


Hình ảnh
- - - - -

Lisp bị lỗi


  • Please log in to reply
1 reply to this topic

#1 hatieu

hatieu

    biết vẽ pline

  • Advance Member
  • PipPip
  • 67 Bài viết
Điểm đánh giá: 13 (tàm tạm)

Đã gửi 31 March 2010 - 03:37 PM

Anh nào xem hộ em cái lisp này, nó bị lỗi
Command: sglass
; error: no function definition: UGET1
;***********************************************
(defun c:direc()
(graphscr)
(setvar "blipmode" 1)
(setq sp1 (getpoint "\nStart point : "))
(setq om (getvar "orthomode"))
(setvar "orthomode" 1)
(setq sp2 (getpoint sp1 "\nEnd point : "))
(command "line" sp1 sp2 "" )

(setq l_direc (angle sp1 sp2))
(setq sp1x (car sp1 )
sp1y (cadr sp1 )
sp2x (car sp2 )
sp2y (cadr sp2 ))
(command "ucsicon" "off")
(command "ucs" "o" sp1)
(command "ucs" "z" (rtd l_direc))

(setq lp (getpoint "\nSide to drawing: "))
(command "erase" "l" "" )
(setvar "orthomode" om)
(setvar "blipmode" 0)
(setq lpx (car lp )
lpy (cadr lp ))
(command "ucs" "")
(command "ucsicon" "on")


(if (> lpy 0)
(setq direc (+ l_direc (* 0.5 pi)))
(setq direc (- l_direc (* 0.5 pi)))
)
(setq l_direc1 l_direc
l_direc2 (+ l_direc pi))
)

;******************************************************************
;******************** Single glass drawing ************************
;******************************************************************
(defun c:sglass()
(COMMAND "UCS" "W")
(SETQ t1 (UGET1"Glass thikness " 5.0)) ;defualt 5
(setvar "cmdecho" 0)
(c:direc)
(setvar "blipmode" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq skin (/ t1 10)
sp3 (polar sp1 direc skin)
sp4 (polar sp2 direc skin)
sp5 (polar sp1 direc (- t1 skin))
sp6 (polar sp2 direc (- t1 skin))
sp7 (polar sp1 direc t1 )
sp8 (polar sp2 direc t1)
)
(setq culr (getvar "clayer"))
(command "layer" "s" "3" "")
(command "line" sp1 sp7 sp8 sp2 "c" )
(command "layer" "s" "1" "")
(command "line" sp3 sp4 "" )
(command "line" sp5 sp6 "" )
(command "layer" "s" culr "")
(setvar "cmdecho" 0)
(setvar "blipmode" 1)
(setvar "osmode" osm)
(princ)
)


;******************************************************************
;******************** Pair glass drawing **************************
;******************************************************************


(defun c:pglass()
(setvar "cmdecho" 0)
(COMMAND "UCS" "W")
(SETQ t1 (UGET1 "1st Glass thikness : " 3.0) ;defualt 3.0
sp (UGET1 "Space gap :" 6.0) ;defualt 6.0
t2 (UGET1 "2nd Glass thikness : " t1) ;defualt 1st
)
(c:direc)
(setvar "blipmode" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq skin (/ t1 10))
(setq sp13 (polar sp1 direc skin)
sp14 (polar sp2 direc skin)
sp15 (polar sp1 direc (- t1 skin))
sp16 (polar sp2 direc (- t1 skin))
sp17 (polar sp1 direc t1)
sp18 (polar sp2 direc t1)
)

(setq sp21 (polar sp17 direc sp)
sp22 (polar sp18 direc sp)

sp23 (polar sp21 direc skin)
sp24 (polar sp22 direc skin)
sp25 (polar sp21 direc (- t2 skin))
sp26 (polar sp22 direc (- t2 skin))
sp27 (polar sp21 direc t2)
sp28 (polar sp22 direc t2)


b11 (polar sp17 l_direc1 1)
b12 (polar b11 l_direc1 sp)
b13 (polar b11 direc sp)
b14 (polar b13 l_direc1 sp)

b21 (polar sp18 l_direc2 1)
b22 (polar b21 l_direc2 sp)
b23 (polar b21 direc sp)
b24 (polar b23 l_direc2 sp)
)

(setq culr (getvar "clayer"))
(command "layer" "s" "3" "")
(command "line" sp1 sp17 sp18 sp2 "c" )
(command "line" sp21 sp27 sp28 sp22 "c" )
(command "line" b11 b13 b12 b14 "c" )
(command "line" b21 b23 b22 b24 "c" )


(command "layer" "s" "2" "")
(command "line" sp13 sp14 "" )
(command "line" sp15 sp16 "" )

(command "line" sp23 sp24 "" )
(command "line" sp25 sp26 "" )
(command "layer" "s" culr "")
(setvar "cmdecho" 0)
(setvar "blipmode" 1)
(setvar "osmode" osm)
(princ)

)

;******************************************************************
;********************** Insulation drawing*************************
;******************************************************************


(defun c:insu(/ stp1 sp3 stp2 sp4 stp3 sp1 stp4 sp2
ea v_eq eq pp qq p0 p1 p2 p3 q0 q1 q2 q3
width length)
(graphscr)
(setvar "cmdecho" 0)
(COMMAND "UCS" "W")
(SETQ t1 (getdist "\nWidth of Insulation :" ))
(c:direc)
(setvar "blipmode" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq sp3 (polar sp1 direc t1))
(setq sp4 (polar sp2 direc t1))


;******************** Aux points***************************

(if (< lpy 0)

(setq stp1 sp3 stp2 sp4 stp3 sp1 stp4 sp2
direc (+ direc pi))
(setq stp1 sp1 stp2 sp2 stp3 sp3 stp4 sp4)
)
(setq culr (getvar "clayer"))
(command "layer" "s" "3" "")
(command "line" stp1 stp3 stp4 stp2 "c")


(setq width t1
length (distance sp1 sp2))

(setq v_eq (/ width 4))
(setq ea (fix (/ length v_eq)))
(setq eq (/ (/ length ea) 2))
(setq pp (polar stp1 direc eq))
(setq qq (polar stp1 direc (- width eq)))

;******************** Start Arc dwg ***************************

(setq lp1 (polar stp1 direc (- width eq )))
(setq q1 (polar qq l_direc eq))
(command "arc" "c" lp1 q1 "a" "90")

;******************** Repeat ***************************

(repeat ea
(setq p0 nil p1 nil p2 nil p3 nil q0 nil q1 nil q2 nil q3 nil)
(setq p0 (polar pp l_direc 0))
(setq p1 (polar p0 l_direc eq))
(setq p2 (polar p1 l_direc eq))
(setq p3 (polar p2 l_direc eq))
(setq q0 (polar qq l_direc 0))
(setq q1 (polar q0 l_direc eq))
(setq q2 (polar q1 l_direc eq))
(setq q3 (polar q2 l_direc eq))
(command "line" p0 q1 "")
(command "line" q1 p2 "")
(command "arc" "c" p1 p0 p2)
(command "arc" "c" q2 q3 q1)
(setq pp (polar p1 l_direc eq))
(setq qq (polar q1 l_direc eq))
)
(command "break" "l" q3 stp4)
(command "layer" "s" culr "")
(setq direc nil)
(setq l_direc nil)
(setvar "cmdecho" 0)
(setvar "blipmode" 1)
(setvar "osmode" osm)
(princ)
)


;******************************************************************
;********************** Insulation drawing*************************
;******************************************************************


(defun c:weld(/ stp1 stp2 stp3 th sp4 stp3 sp1 stp4 sp2
ea v_eq eq pp qq p0 p1 p2 p3 q0 q1 q2 q3
width length)
(graphscr)
(setvar "cmdecho" 0)
(COMMAND "UCS" "W")
(SETQ t1 (getdist "\nWelding Thickness :" ))
(c:direc)
(setvar "blipmode" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq stp1 (polar sp1 direc (* t1 0.84)))
(setq stp2 (polar stp1 l_direc1 (* t1 0.5)))
(setq stp3 (polar sp1 l_direc1 (* t1 0.7)))


;******************** Aux points***************************
(setq width t1
length (distance sp1 sp2))
(setq v_eq (* width 0.7))
(setq ea (fix (/ length v_eq)))
;;******************** Start Arc dwg ***************************
(command "layer" "s" "2" "")
(command "arc" sp1 stp2 stp3)
;;******************** Repeat ***************************

(repeat ea
(setq stp1 stp2)
(setq stp2 (polar stp2 l_direc1 (* t1 0.7)))
(setq stp3 (polar stp3 l_direc1 (* t1 0.7)))
(command "arc" stp1 stp2 stp3)
)
(command "layer" "s" culr "")
(setq direc nil)
(setq l_direc nil)
(setvar "cmdecho" 0)
(setvar "blipmode" 1)
(setvar "osmode" osm)
(princ)
)



;******************************************************************
;*********************** sheet drawing ****************************
;******************************************************************

(defun c:sheet(/ sp1 npt direc temp)
(graphscr)
(setvar "cmdecho" 0)
(setq fillr (getvar "filletrad"))
(setvar "filletrad" 0)
(setq temp (getvar "tracewid"))
(setq tmp 1)

(while (< tmp 2)
(initget "Thickness")
(setvar "blipmode" 1)
(setq sp1 (getpoint "\nThickness/: "))
(setq osm (getvar "osmode"))
(setvar "blipmode" 1)
(setq b1 sp1)
(cond
((null sp1)
(princ)
(setq tmp 3)
)
((= sp1 "Thickness")
(dl_snw)
(setq tmp 1)
)
(T
(setq tmp 2)
)
)
)
;;;

(setq n 1
fil2 (entlast))
(while (< tmp 3)
(setvar "osmode" osm)
(initget "Thickness")
(setq npt (getpoint sp1 "\nThickness/: "))
(setvar "osmode" 0)
(if (= n 1)
(setq b2 (polar sp1 (+ (angle sp1 npt) (* 0.5 pi)) temp))
(command "line" b1 b2 "")
)
(cond
((= npt "Thickness")
(dl_snw)
(setq tmp 2)

)
((null npt)
(command "line" sp3 (polar sp3 (- direc (* 0.5 pi)) temp) "")
(setq tmp 4)
(princ)
)

(T
(setq ldirec direc)
(setq direc (angle sp1 npt)
lp_direc (+ (* 0.5 pi) direc))
(setq sp2 (polar sp1 lp_direc temp))
(setq sp3 (polar npt lp_direc temp))

(command "line" sp1 npt "")
(command "line" sp2 sp3 "")
(if (/= ldirec direc)
(progn
(setq fil1 fil2 fil2 (entlast))
(if (> n 1)
(command "fillet" fil1 fil2)
(command "line" sp1 sp2 "")
)
)
)

(setq sp1 npt)
(setq n (+ n 1))

) ; end of inner cond
)
)
(setvar "filletrad" fillr)
(setvar "cmdecho" 0)
(setvar "osmode" osm)
(princ)
(terpri)
)

(defun dl_snw()
(setvar "tracewid"
(if (setq temp (getdist (strcat
"\nSheet New thickness <" (rtos (getvar "tracewid")) ">: ")))
temp
(getvar "tracewid")
)
)
)
(princ)

  • 0
Công ty cổ phần đầu tư và xây dựng AGA
Chuyên tư vấn, cung cấp, thi công hệ vách dựng nhôm kính khổ lớn, cửa nhôm kính,
kính cường lực, vách ngăn, lan can, cầu thang kinh, lam nhôm chăn nắng.
Hot: 0984.985.119

#2 phamthanhbinh

phamthanhbinh

    biết lệnh adcenter

  • Moderator
  • PipPipPipPipPipPipPip
  • 6009 Bài viết
Điểm đánh giá: 3113 (tuyệt vời)

Đã gửi 31 March 2010 - 05:33 PM

Anh nào xem hộ em cái lisp này, nó bị lỗi
Command: sglass
; error: no function definition: UGET1

(defun c:pglass()
(setvar "cmdecho" 0)
(COMMAND "UCS" "W")
(SETQ t1 (UGET1 "1st Glass thikness : " 3.0) ;defualt 3.0
sp (UGET1 "Space gap :" 6.0) ;defualt 6.0
t2 (UGET1 "2nd Glass thikness : " t1) ;defualt 1st
)

Chào bạn hatieu,
Do đoạn lisp này của bạn chép bị thiếu mất phần xác định hàm UGET1 mà trong cái hàm (defun c:pglass () .......) của bạn có sử dụng cái hàm uget1 này nên lisp bị báo lỗi mà thôi.
Bạn hãy tìm tới chỗ mà bạn chép lisp để chép cả cái hàm UGET1 này nữa thì mới sử dụng được bạn ạ.
Vì cái lisp này được viết theo một yêu cầu riêng nào đó nên có lẽ khó có thể làm lại cho bạn cái hàm uget1 này.
Rất mong bạn thông cảm.
Chúc bạn vui.
  • 0
Chúc các quý Anh trên diễn đàn luôn khỏe, đẻ thêm được nhiều thứ để mót.