Đến nội dung


Hình ảnh
- - - - -

LISP joint dimension _ nhờ giúp đỡ


  • Please log in to reply
1 reply to this topic

#1 colombus

colombus

    biết vẽ ellipse

  • Members
  • PipPip
  • 58 Bài viết
Điểm đánh giá: 3 (bình thường)

Đã gửi 11 May 2015 - 11:21 AM

Tôi down được 1 cái lisp tại đây http://autocadtips1....oin-dimensions/

 

 

nhưng kết quả không sử dụng được và bị báo lỗi thế này

 
Command: JDIMS
 convert two dimensions to total Dimension on the same position
 Select 1st Dimension :
 Select 2nd Dimension :
 Error in SpeedDraftLT
 
Ai biết được vì sao lại như thế và sửa thế nào thì xin giúp cho.
Xin cảm ơn!
 
ps: cadviet bị làm sao thế nhỉ mình soạn thảo rõ ràng thế này mà post lên thì không thây nội dung 
IHIxvSV.jpg

  • 0

#2 colombus

colombus

    biết vẽ ellipse

  • Members
  • PipPip
  • 58 Bài viết
Điểm đánh giá: 3 (bình thường)

Đã gửi 18 May 2015 - 08:43 AM

cái lỗi này đã sửa được rồi... Mời các bác xơi!. Cảm ơn một người xa lạ có tên Greg trên cadtutor.net đã giúp giải quyết vấn đề.

vào lệnh là jd

 

 

;“ñ‚‚̓¯‚¶ŒX‚«‚ðŽ‚Á? ?½¡–@‚ðŽwŽ¦‚µA‚»‚̇Œv? ?¡–@‚ð‚»‚Ìꊂɑ‚*
;ʼn‚ÉŽwŽ¦‚µ‚½2‚‚̡– @‚ÍÁ‚¦‚é
;UCS‘Ήž

;Shusei Hayashi
;OffshoreCad&Management Inc.
;10F Jaka Bldg., 6780 Ayala Ave.,
;Makati, Philippines
;http://www.offshorecad.com.ph/
;http://www.offshore-management.com.ph/

(defun c:jd( / Flag ObjName1 ObjName2 Ang Ang2 Pt1 Pt2 Pt3 Pt4)

; (if (= SD:Lang "E")
(princ "\n convert two dimensions to total Dimension on the same position")
; (princ "\n “ñ‚‚̡–@‚ðŽwŽ¦‚µA‚»? ?̇Œv¡–@‚ð‚»‚ÌꊂÉ? ??‚*")
; )

(princ "\n **********************************")

(setq *error* *myerror*)
(SD1028)

(setq LegLen 7.0)

(setq Flag nil)
(get_layer&ltype&color)
(RegistryRead_1001)

(setvar "Clayer" Lay1)
(setvar "Cecolor" Col1)
(setvar "Celtype" LT1)

(while (= Flag nil)
; (if (= SD:Lang "E")
(setq ObjName1 (car (entsel "\n Select 1st Dimension :")))
; (setq ObjName1 (car (entsel "\n ʼn‚Ì¡–@‚ðŽwŽ¦F ")))
; )
(if (and ObjName1(= (cdr (assoc 0 (setq Data1 (entget ObjName1)))) "DIMENSION"))
(setq Flag T)
)
)
(redraw ObjName1 3)
(setq theStyle (SD3511 3 ObjName1))

(setq Flag nil)
(while (= Flag nil)
; (if (= SD:Lang "E")
(setq ObjName2 (car (entsel "\n Select 2nd Dimension :")))
; (setq ObjName2 (car (entsel "\n 2‚–ڂ̡–@‚ðŽwŽ¦F ")))
; )
(if (and ObjName2
(= (cdr (assoc 0 (setq Data2 (entget ObjName2)))) "DIMENSION")
(or (equal (abs (- (cdr (assoc 50 Data1))(cdr (assoc 50 Data2)))) 0.0 0.0001)
(equal (abs (- (cdr (assoc 50 Data1))(cdr (assoc 50 Data2)))) pi 0.0001)
)
)
(setq Flag T)
; (if (= SD:Lang "E")
(princ "\n two dimensions should have same angle")
; (princ "\n 2‚‚̡–@‚Í“¯‚¶Šp“x‚Å‚? ?‚¯‚ê‚΂¢‚¯‚Ü‚¹‚ñ")
; )
)
)
(redraw ObjName1 4)

;‘«‚Ìæ‚Ì4“_
(setq PList (list (cdr (assoc 13 Data1))(cdr (assoc 14 Data1))(cdr (assoc 13 Data2))(cdr (assoc 14 Data2))))
;¡–@ˆÊ’u‚Ì2“_
(setq PList2 (list (cdr (assoc 10 Data1)) (cdr (assoc 10 Data2))))
;‘«‚©‚ç—§‚¿ã‚ª‚éŠp“x
(if (/= (distance (cdr (assoc 14 Data1))(cdr (assoc 10 Data1))) 0)
(setq Ang (angle (cdr (assoc 14 Data1))(cdr (assoc 10 Data1))))
(setq Ang (+ (angle (cdr (assoc 13 Data1))(cdr (assoc 14 Data1))) (* 0.5 pi)))
)

(setq Ang2 (+ Ang (* -0.5 pi))) ;‚í‚©‚è‚â‚·‚¢‚悤‚ɉE ‚Ö90“x‚Ü‚í‚·
;ƒŒƒCƒ„[
(setq ItsLayer (cdr (assoc 8 Data1)))

;¡–@‚ÌŒX‚«‚ɇ‚킹‚½? ?•WŒn‚É•ÏŠ·
(setq PList_n (mapcar '(lambda(x)(SD1862 x Ang2))PList))
(setq PList2_n (mapcar '(lambda(x)(SD1862 x Ang2))PList2))
;xÀ•W‚¾‚¯W‚ß‚é
(setq PList_n_x (mapcar 'car PList_n))
;yÀ•W‚¾‚¯W‚ß‚é
(setq PList2_n_y (mapcar 'cadr PList2_n))

;Ŭ’l‚̈ʒu
(setq Position1 (vl-position (apply 'min PList_n_x) PList_n_x))
;Å‘å’l‚̈ʒu
(setq Position2 (vl-position (apply 'max PList_n_x) PList_n_x))
;Å‘å’l‚̈ʒu
(setq Position3 (vl-position (apply 'max PList2_n_y) PList2_n_y))


(setq Pt1 (nth Position1 PList))
; (checkcircle Pt1 1.0 "A21")
(setq Pt2 (nth Position2 PList))
; (checkcircle Pt2 1.0 "A31")
(setq Pt3 (nth Position3 PList2))
; (checkcircle Pt3 1.0 "A51")
; (setq Pt4 (polar Pt3 Ang (* LegLen Scale)))
; (checkcircle Pt4 1.0 "A21")

(setq Pt1 (trans Pt1 0 1)
Pt2 (trans Pt2 0 1)
Pt3 (trans Pt3 0 1)
; Pt4 (trans Pt4 0 1)
)
(setq UAng (angle '(0 0) (getvar "UCSXDIR")))
(setq Ang2 (- Ang2 UAng))
(command "._dimstyle" "RE" theStyle)
(command "dimrotated" (* 180 (/ Ang2 pi)) Pt1 Pt2 Pt3)
(command "change" (entlast) "" "P" "LA" ItsLayer "")
(entdel ObjName1)(entdel ObjName2)

(SD2056)
(setq *error* nil)
(princ)
)
;ƒŒƒWƒXƒgƒŠ‚©‚çƒf[ƒ^‚ðŽæ“¾-----------------------------------------
(defun RegistryRead_1001()
(setq Path1001 "HKEY_CURRENT_USER\\Software\\SpeedDraftLT\\SD_1001")
(if (vl-registry-read Path1001 "LegLen" )
(progn (set_tile "LegLen" (vl-registry-read Path1001 "LegLen"))
(setq LegLen (atof (vl-registry-read Path1001 "LegLen"))) ;‘«‚Ì’·‚³
)
(setq LegLen 7.0) ;ƒŒƒWƒXƒgƒŠ‚É’l‚ª–³‚¢ê? ?
)
(if (and (vl-registry-read Path1001 "Lay1" )(member (vl-registry-read Path1001 "Lay1") Laylist1))
(progn (set_tile "Lay1" (itoa (vl-position (vl-registry-read Path1001 "Lay1") Laylist1)))
(setq Lay1 (vl-registry-read Path1001 "Lay1"))
)
(progn (setq Lay1 (getvar "Clayer"))(set_tile "Lay1" (itoa (vl-position Lay1 Laylist1))))
)
(if (and (vl-registry-read Path1001 "LT1" )(member (vl-registry-read Path1001 "LT1") Laylist3))
(progn (set_tile "LT1" (itoa (vl-position (vl-registry-read Path1001 "LT1") Laylist3)))
(setq LT1 (vl-registry-read Path1001 "LT1"))
)
(progn (setq LT1 "ByLayer")(set_tile "LT1" "0"))
)
(if (and (vl-registry-read Path1001 "Col1" )(member (vl-registry-read Path1001 "Col1") Laylist2))
(progn (set_tile "Col1" (itoa (vl-position (vl-registry-read Path1001 "Col1") Laylist2)))
(setq Col1 (vl-registry-read Path1001 "Col1"))
)
(progn (setq Col1 "ByLayer")(set_tile "Col1" "0"))
)
)
;‹¤’ʃRƒ}ƒ“ƒh
(defun SD1028 ()
(setq OldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "undo" "be")
(setq OldOsmode (getvar "OSMODE"))
(setq OldLayer (getvar "CLAYER"))
(setq OldLType (getvar "CeLType"))
(setq OldCeLWeight (getvar "CeLWeight"))
(setq OldColor (getvar "CeColor"))
(setq OldOrtho (getvar "ORTHOMODE"))
(setq OldDStyle (getvar "DIMSTYLE"))
(setq OldExpert (getvar "Expert"))
(setvar "EXPERT" 0)
(setq Path_Lang "HKEY_CURRENT_USER\\Software\\SpeedDraftLT")
; (if (vl-registry-read Path_Lang "SD_Language" )
; (setq SD:Lang (vl-registry-read Path_Lang "SD_Language" ))
; (progn (setq SD:Lang "J")
; (vl-registry-write Path_Lang "SD_Language" "J")
; )
; )
(princ)
)
;********************************
(defun SD2056 ()
(setvar "OSMODE" OldOsmode)
(command "undo" "end")
(setvar "CLAYER" OldLayer)
(setvar "CeLType" OldLType)
(setvar "CeLWeight" OldCeLWeight)
(setvar "CeColor" OldColor)
(setvar "ORTHOMODE" OldOrtho)
(setvar "Expert" OldExpert)
(if (and (/= (getvar "DIMSTYLE") OldDStyle)(tblsearch "DIMSTYLE" OldDStyle))
(command "-dimstyle" "Restore" OldDStyle)
)
(princ "\n ©OffshoreCad&Management")
(setvar "CMDECHO" OldCmdEcho)
(princ)
)

;********************************
(defun get_layer&ltype&color()
(setq Lay (tblnext "LAYER" T)
LT (tblnext "LTYPE" T)
Laylist1 (list)
Laylist2 (list "ByLayer" "Red" "Yellow" "Green" "Cyan" "Blue" "Magenta" "B/W")
Laylist3 (list"ByLayer")
)
(While Lay
(setq lay1 (list (cdr (assoc 2 Lay)))
lay2 (cdr (assoc 62 Lay))
lay3 (list (cdr (assoc 6 Lay)))
Laylist1 (append Laylist1 lay1)
Laylist3 (append Laylist3 lay3)
Lay (tblnext "LAYER")
)
(if (> lay2 7)(setq lay2 (list (itoa lay2)) Laylist2 (append Laylist2 lay2)))
)
(While LT
(setq lay3 (list (cdr (assoc 2 LT)))
Laylist3 (append Laylist3 lay3)
LT (tblnext "LTYPE")
)
)
(setq Laylist1 (RemoveOverlap Laylist1)
Laylist2 (RemoveOverlap Laylist2)
Laylist3 (RemoveOverlap Laylist3))
)
;************************
(defun RemoveOverlap ( List2 / List1 )
(while List2
(setq List1 (append List1 (list (car List2))))
(setq List2 (vl-remove (car List2) List2))
)
List1
)
;;;---------Rotate----------------------------
;;;“_A‚ð“_B‚ð’†S‚Ƀ¿‚¾‚? ?‰ñ“]‚³‚¹‚½À•W
;;;yˆø‚«”z“_A ’†S Šp“xƒ¿
;;;y–ß‚è’lz“_C

(defun SD8446 ( PointA PointB Ang / XA YA XB YB PointC)

(setq XA2(- (car PointA) (car PointB))
YA2(- (cadr PointA) (cadr PointB))
)
(setq PointC (list (- (* XA2 (cos Ang))(* YA2 (sin Ang))) (+ (* XA2 (sin Ang))(* YA2 (cos Ang)))))
(setq PointC (mapcar '+ PointC PointB))
PointC
)
;************************************************* ***
;À•WŒn•ÏŠ·iAng‚¾‚¯Œ´“_Žü? ??è‚ɉñ“]‚µ‚½À•WŒn‚Å•\Œ»‚·‚é
(defun SD1862 (OldPt Ang / NewCs)
(setq NewCs (SD8446 '(1 0) '(0 0) Ang))
(setq NewPt (trans OldPt 0 NewCs))
(setq NewPt (list (nth 2 NewPt)(nth 0 NewPt)))
NewPt
)
;**********************
(defun SD3511 (g e)
(cond
((= (type e) 'ename) (cdr (assoc g (entget e))))
((= (type e) 'list) (cdr (assoc g e)))
)
)
;********************************
(defun *myerror* (msg)
(setq *error* nil)
(SD2056)
(princ "\n Error in SpeedDraftLT")
(princ)
)
(if (= SD:Lang "E")
(princ "\n Command Name: SD_1005")
(princ "\n ƒRƒ}ƒ“ƒh–¼FSD_1005")
)
(princ)


  • 0