;************************************************;
;* This is "pin_zst.lsp" program 		*;
;* Complete compiled in 02/24/99                *;
;* Last change in 02/24/99    			*;
;* ZX Mold Ltd  XY Liao    			*;
;************************************************;

;******************** Main function start ************************;
(defun pin_zst( / sel_ent)
  (setvar "osmode" 0)
  (if (= "1" if_h_v)
    (progn
      (command "linetype" "s" "hidden" "")
      (setvar "cecolor" "yellow")
    )
  )
  (setq sel_ent (ssadd))
  (command "insert" "pin.dwg" cenpt d "" "")
  (setq sel_ent (ssadd (entlast) sel_ent))
;-----------------------------------------------------
;Dim specification and item number
;-----------------------------------------------------
  (progn
    (setvar "celtype" "bylayer")
    (setvar "cecolor" "bylayer")
  )
  (if (not (tblsearch "style" "lxy2"))
    (command "-style" "lxy2" "txt" "" 0.6 "" "" "" "")
    (setvar "textstyle" "lxy2")
  )
  (setq textpt (polar cenpt (/ pi 4) (+ (/ d 2) 2.5)))
  (command "text" "j" "mc" textpt 2.5 0 rep)
  (setq sel_ent (ssadd (entlast) sel_ent))
  (setvar "textstyle" st_old)
;-----------------------------------------------------
;Make screw block and add extend data in it
;-----------------------------------------------------
  (mblk (strcat "AC_LXY_BLK" (itoa (getvar "useri2"))) cenpt sel_ent)
  (setq xd (strcat 	rep " " 			;item number
			"Z" " " 			;view flag
			pin_type " " 			;dim diameter
			pin_len " " 			;dim length
			if_h_v " " 			;hidden flag
			typ " " 			;type flag
			mb )) 				;meter or inch flag
  (setq xd (list (list -3 (list "pin" (cons 1000 xd)))))
  (mxdata  (entlast) xd)
  (setvar "useri2" (+ 1 (getvar "useri2")))
  (setvar "osmode" os_old)
)
;*************************************** End of function ****************************************;