You are on page 1of 18

(defun c:bbb ()

(setq mo (car(entsel "select object")))


(setq w (getreal "\n weight :"))
(command "chprop" mo "" "lts" w "")

(setq gn (cdr(assoc '8 (entget mo))))

(setq jom2 (strcat"pleas name " "<" gn ">:"))


(setq nam (getstring jom2))

(if (and (/= nam gn)(/= nam ""))


(progn
(command "layer" "n" nam "")
(command "chprop" mo "" "la" nam "")
))

(defun c:bb ()
(setq mo (car(entsel "select object")))

(setq w (getreal "whight"))

(setq new1 (cons '48 w))

(setq get1 (entget mo))


(setq s (assoc '48 get1))

(if (= s nil)(setq ed (vl-list* new1 get1))


(setq ed (subst new1 s get1)))

(entmod ed)

(defun c:ccc () (cdr (assoc '48 (entget (car (entsel))))))

(defun c:fs () (command "solidedit" "body" "shell" ))


;--------------------------------------------------
(defun c:min ()
(setq min (ssget "x" '((0 . "INSERT")) )) )

;++++++++++++++++++++++++++++++++++++++++++++++++++++

;----------------------------------------

(defun c:bg1 ()
(command "ucs" "w")
(setq qkol (ssadd))
(setq hi 2)
(setq per (getvar "DWGPREFIX"))
(setq namf (getvar "dwgname"))
(setq namff (strcat "-" namf ))
(setq tts (vl-string-search "." namf))
(setq nnm (substr namf 1 tts))
(setq wbgg (strcat per nnm "-bg.txt"))

(setq sbs nil)


(setq ms nil)
(setq vs nil)
(if (= newn nil)(setq newn "Fe0.00787"))

(command "style" "bg" "romans" "" "" "" "" "" "")
(command "LUPREC" "1")
(command "layer" "n" "BG" "plot" "n" "bg" "")

(setq te (ssget "x" '((0 . "text")) ))


(command "erase" te "")

;++++++++++++++++++++++++++++++++++++++++++++++
(setq q (ssget))
(setq qs (ssget "P" '((0 . "3DSOLID"))))
(command "select" q "")
(setq q2 (ssget "P" '((0 . "INSERT"))))
(setq tbk (itoa (sslength q2)))
(setq msg (strcat "found of <" tbk "> block"))
(alert msg)

(setq z (sslength qs))


(setq nk 0)
(SETQ WK 0)
(setq mj2 (ssadd))

(while (/= 0 z)
(setq n1 (ssname qs 0))
(setq ww (assoc '48 (entget n1)))
(setq nn (assoc '8 (entget n1)))

(if (/= ww nil)


(progn
(setq mj1 (ssget "x" (list ww nn )))
(setq dd (sslength mj1))
(setq t1 0)

(repeat dd
(setq nam1 (ssname mj1 t1))
(ssdel nam1 qs)
(setq t1 (1+ t1))
)

(setq sk (itoa nk))


(setq snk (strcat "j" sk))
(set (read snk) mj1)
(setq nk (1+ nk))
)
(progn
(setq mj2 (ssadd n1 mj2))
(ssdel n1 qs)
(setq sWk (itoa WK))
(setq sSWk (strcat "s" sWk))
(set (read sSWk) mj2)
(setq Wk (1+ Wk))
))

(setq z (sslength qs))


)

(setq tkol (+ wk nk))

(setq qkk 0)

(repeat tkol

(if (= qkk 0)
(progn
(setq q s0)

)
(progn
(setq sk (itoa (1- qkk)))
(setq snk (strcat "j" sk))
(setq qs (eval (read snk)))
))

;555555555555555555555555555555555555555555555555

(command "massprop" q "" "y" "c:\\D.mpr" "w")


(setq f (open "c:\\D.mpr" "r"))
(setq s (read-line f)) (setq s (read-line f)) (setq s (read-line f)) (setq s
(read-line f)) (setq vv (read-line f)) (setq s (read-line f)) (setq s (read-line
f)) (setq s (read-line f)) (setq s (read-line f))(setq qq (read-line f)) (setq r
(read-line f))
(CLOSE F)
;222222222222222222222222222222222222222222222222

(setq lin2 (/ (atof(substr vv 8)) 1000))

(setq gn (substr newn 1 2))

(if (= qkk 0)(progn


(setq jom "Spacefy Density: Fe/Al/Tephlone/Bronze/Rubber/St-
s/Pb/Estimation/Defult")
(setq jom2 (strcat jom "<" gn ">:"))

(initget 8 "Fe0.00787 St0.00798 Br0.00878 Te0.0023 Ru0.00138 Al0.00266 Pb0.0113


Es0.0 De0.001")
(setq dn (getkword jom2))

(if (= dn nil)(setq dn newn))


(setq newn dn)

(setq den (substr dn 3))


(setq don (substr dn 1 2))
(setq denn (atof den))
(setq wight (* LIN2 denn))
(setq wg (rtos wight 2 2))
(setq sm (strcat "BY " don "=" WG " Kg"))
))

(if (/= qkk 0)


(progn
(setq ttk (sslength q))
(setq nk 0)
(setq we 0)

(repeat ttk
(setq sm (cdr (assoc '48 (entget (ssname q nk))))
(setq we (+ we sm))
)
))

;3333333333333333333333333333333333333333333333333
(setq v (read (substr vv 25)))
(setq sv1 (rtos v))
(setq sv (strcat "V=" sv1))

(setq x (read (substr s 25)))


(setq sx (rtos x))

(setq y (read (substr qq 25)))


(setq sy (rtos y))

(setq z (read(substr r 25)))


(setq sz (rtos z))

(setq qqq (strcat "(" sx " " sy " " sz ")" ))


(setq bs0 (list x y z))
(setq bs1 (list x (- y 3) z))
(setq bs2 (list x (- y 6) z ))
(setq bs3 (list x (- y 9) z ))

(command "clayer" "bg" )


(command "point" "0,0,0")
(setq ppo (entlast))
(setq qkol (ssadd (entlast) qkol))

(command "color" "30")

(command "text" bs0 hi "" namff "")


(setq qkol (ssadd (entlast) qkol))

(if (= sbs nil)(command "text" bs1 hi "" qqq "")


(progn
(setq qqq sbs)
(command "text" bs1 hi "" qqq "")
(command "chprop" "l" "" "c" "1" "")
))

(setq qkol (ssadd (entlast) qkol))


(if (/= qkk 0)
(progn
(setq sm (rtos (cdr (assoc '48 (entget (ssname q 0)))) 2 2 ))
(setq sm (strcat "By Defult=" sm " kg"))
))

(if (= ms nil)
(progn
(command "text" bs2 hi "" sm "")
(if (= (substr sm 4 1) "E" )(command "chprop" "l" "" "c" "1" ""))
)

(progn
(setq sm ms)
(command "text" bs2 hi "" sm "")
(command "chprop" "l" "" "c" "1" "")
))
(setq qkol (ssadd (entlast) qkol))

(if (= vs nil)(command "text" bs3 hi "" sv "")


(progn
(setq sv vs)
(command "text" bs3 hi "" sv "")
(command "chprop" "l" "" "c" "1" "")

))
(setq qkol (ssadd (entlast) qkol))

(command "color" "byl")


(command "LUPREC" "4")
(command "clayer" old-la )

(setq fff (findfile wbgg))


(if (= fff nil)(command "wblock" wbgg "" "0,0,0" qkol "")
(command "wblock" wbgg "y" "" "0,0,0" qkol ""))
(command "u" "")

(command "layer" "off" "bg" "")

(terpri)
(SETQ JOM (STRCAT " BODY = "NBO))
(write-line JOM)
(SETQ JOM (STRCAT "BLOCK = "NIN))
(write-line JOM)
(command "erase" ppo "")
(setq qkk (1+ qkk))
))
;****************************************
(defun c:bg-x ()
(setq khst nil)
(setq lin T)
(setq lis '("D:\\GHAEM\\INSTALLATION-SYSTEM\\" "D:\\GHAEM\\CHASIS\\"
"D:\\GHAEM\\MECHANICAL-SYSTEM\\" "D:\\GHAEM\\NAV-CONT\\" ))
(setq n (length lis))
(setq k 0)

(repeat n
(setq mo (nth k lis))
(setq mo2 (strcat mo "list.txt"))
(setq sh (strcat "dir " mo "*.dwg /b >" mo2 ))
(setq df (open "c:\\mm.lsp" "w"))
(write-line "(command" df)
(write-line "\"shell\"" df)
(prin1 sh df)
(write-line ")" df)
(close df)
(load "c:\\mm.lsp")
(setq k (1+ k))
))

;******************************************************
;****************************************
(defun c:bg-b ()
(setq khst nil)
(setq lin T)
(setq lis '("D:\\GHAEM\\INSTALLATION-SYSTEM\\" "D:\\GHAEM\\CHASIS\\"
"D:\\GHAEM\\MECHANICAL-SYSTEM\\" "D:\\GHAEM\\NAV-CONT\\" ))
(setq n (length lis))
(setq k 0)

(repeat n
(setq mo (nth k lis))
(setq mo2 (strcat mo "list.txt"))
(setq sh (strcat "dir " mo "*-bg.dwg /b >" mo2 ))
(setq df (open "c:\\mm.lsp" "w"))
(write-line "(command" df)
(write-line "\"shell\"" df)
(prin1 sh df)
(write-line ")" df)
(close df)
(load "c:\\mm.lsp")
(setq k (1+ k))
))

;******************************************************

(defun c:bg-x2 ()
(setq khst nil)
(setq lin T)
(setq lis '("D:\\GHAEM\\INSTALLATION-SYSTEM\\" "D:\\GHAEM\\CHASIS\\"
"D:\\GHAEM\\MECHANICAL-SYSTEM\\" "D:\\GHAEM\\NAV-CONT\\" ))
(setq n (length lis))
(setq k 0)

(repeat n
(setq mo (nth k lis))
(setq mo2 (strcat mo "list.txt"))
(setq sh (strcat "dir " mo "*.dwg /b >" mo2 ))
(setq fi1 (open mo2 "r"))
(setq lin (read-line fi1))

(while (/= lin nil)


(setq nn (- (strlen lin) 4))
(setq bo (substr lin 1 nn))
(setq shn (list (cons 2 bo)))
(setq bo1 (ssget "x" shn ))
(setq nl (strcat mo lin))

(if (= bo1 nil) (progn

(if (/= khst "A")


(progn
(setq pyam (strcat "\n" lin ": " "All/Y/N <Y> "))
(setq khst (strcase (getstring pyam)))
(if (or(= khst "Y") (= khst "")(= khst "A"))(PROGN
(command "xref" "a" nl "0,0,0" "" "" "")
(SETQ STST (STRCAT BO "|BACK"))
(COMMAND "LAYER" "F" STST "")
)) )
(PROGN
(command "xref" "a" nl "0,0,0" "" "" "")
(SETQ STST (STRCAT BO "|BACK"))
(COMMAND "LAYER" "F" STST "")
))

))
(setq lin (read-line fi1))
)
(close fi1)
(setq k (1+ k))
)
)

;*******************************************************
;******************************************************

(defun c:bg-kol ()

(setq khst nil)


(setq lin T)
(setq lis '("D:\\GHAEM\\INSTALLATION-SYSTEM\\" "D:\\GHAEM\\CHASIS\\"
"D:\\GHAEM\\MECHANICAL-SYSTEM\\" "D:\\GHAEM\\NAV-CONT\\" ))
(setq n (length lis))
(setq k 0)

(repeat n
(setq mo (nth k lis))
(setq mo2 (strcat mo "list.txt"))
(setq sh (strcat "dir " mo "*-bg.dwg /b >" mo2 ))
(setq df (open "c:\\mm.lsp" "w"))
(write-line "(command" df)
(write-line "\"shell\"" df)
(prin1 sh df)
(write-line ")" df)
(close df)
(load "c:\\mm.lsp")
(setq k (1+ k))
)

(setq khst nil)


(setq lin T)
(setq lis '("D:\\GHAEM\\INSTALLATION-SYSTEM\\" "D:\\GHAEM\\CHASIS\\"
"D:\\GHAEM\\MECHANICAL-SYSTEM\\" "D:\\GHAEM\\NAV-CONT\\" ))
(setq n (length lis))
(setq k 0)

(repeat n
(setq mo (nth k lis))
(setq mo2 (strcat mo "list.txt"))
(setq sh (strcat "dir " mo "*-bg.dwg /b >" mo2 ))
(setq fi1 (open mo2 "r"))
(setq lin (read-line fi1))

(while (/= lin nil)


(setq nn (- (strlen lin) 4))
(setq bo (substr lin 1 nn))
(setq shn (list (cons 2 bo)))
(setq bo1 (ssget "x" shn ))
(setq nl (strcat mo lin))

(if (= bo1 nil) (progn

(if (/= khst "A")


(progn
(setq pyam (strcat "\n" lin ": " "All/Y/N <Y> "))
(setq khst (strcase (getstring pyam)))
(if (or(= khst "Y") (= khst "")(= khst "A"))(PROGN
(command "xref" "a" nl "0,0,0" "" "" "")
(SETQ STST (STRCAT BO "|BACK"))
(COMMAND "LAYER" "F" STST "")
)) )
(PROGN
(command "xref" "a" nl "0,0,0" "" "" "")
(SETQ STST (STRCAT BO "|BACK"))
(COMMAND "LAYER" "F" STST "")
))

))
(setq lin (read-line fi1))
)
(close fi1)
(setq k (1+ k))
)

;//////////////////////////////////////////////////

(setq k 0)
(setq p1 '(0 0 0))
(setq mxkol 0 mykol 0 mzkol 0 wkol 0 vkol 0)

(command "zoom" "e")


(setq m1 (ssget p1 ))
(setq qk 0)

(while (/= m1 nil)


(setq namq (ssname m1 0))
(setq cc (cdr (assoc '2 (entget namq))))
(setq sqk (itoa qk))
(setq uu (strcat "q" sqk))
(set (read uu) cc )

(command "-xref" "u" cc )


(setq qk (1+ qk))
(setq m1 (ssget p1 '((0 . "INSERT")) ))
)

(setq per (getvar "DWGPREFIX"))


(setq namf (getvar "dwgname"))
(setq tts (vl-string-search "." namf))
(setq nnm (substr namf 1 tts))

(setq bbgg (strcat per nnm "-bg.txt"))

(setq f (open bbgg "w"))

(setq gg (strcat "No" " name " "Volume " "weight


" "Centroid "
"Moments of X " "Moments of Y " "Moments of Z " ))
(write-line gg f)
(setq k 0)

(repeat qk
(setq sk (itoa k))
(setq hh (eval(read(strcat "q" sk))))
(command "-xref" "r" hh )
(command "-refedit" p1 "o" "a" "")
(setq tx (ssget "x" '((0 . "TEXT")(8 . "$0$BG")) ))

(if (= tx nil)
(progn
(command "u" "")
(command "-xref" "u" hh )
))

(if (/= tx nil)


(progn
(setq n1 (sslength tx))
(setq kh (itoa (1+ k)))
(setq k1 0)

(repeat 3
(setq nam1 (ssname tx k1))
(setq t1 (cdr(assoc '1 (entget nam1))))

(if (= "(" (substr t1 1 1))


(progn
(setq xx (nth 0 (read t1)))
(setq yy (nth 1 (read t1)))
(setq zz (nth 2 (read t1)))
(setq bp t1)
))

(if (= "B" (substr t1 1 1))


(progn
(setq ww (read (substr t1 7)))
))

(if (= "V" (substr t1 1 1))


(progn
(setq vo (read (substr t1 3)))
))

(setq k1 (1+ k1))

(setq mx (* ww xx))
(setq my (* ww yy))
(setq mz (* ww zz))

(command "u" "")


(command "-xref" "u" hh )

))
(setq mxkol (+ mxkol mx))
(setq mykol (+ mykol my))
(setq mzkol (+ mzkol mz))
(setq wkol (+ wkol ww))
(setq vkol (+ vkol vo))

(setq smx (rtos mx 2 1))


(setq smy (rtos my 2 1))
(setq smz (rtos mz 2 1))
(setq svo (rtos vo 2 1))
(setq sww (rtos ww 2 1))

(if (> 5 (strlen kh))(progn (repeat (- 5 (strlen kh)) (setq kh (strcat kh "
")) ) ))
(if (> 20 (strlen hh))(progn (repeat (- 20 (strlen hh)) (setq hh (strcat hh " ")) )
))
(if (> 20 (strlen svo))(progn (repeat (- 20 (strlen svo)) (setq svo (strcat svo "
")) ) ))
(if (> 20 (strlen sww))(progn (repeat (- 20 (strlen sww)) (setq sww (strcat sww "
")) ) ))
(if (> 20 (strlen smx))(progn (repeat (- 20 (strlen smx)) (setq smx (strcat smx "
")) ) ))
(if (> 20 (strlen smy))(progn (repeat (- 20 (strlen smy)) (setq smy (strcat smy "
")) ) ))
(if (> 20 (strlen smz))(progn (repeat (- 20 (strlen smz)) (setq smz (strcat smz "
")) ) ))
(if (> 20 (strlen bp))(progn (repeat (- 20 (strlen bp)) (setq bp (strcat bp " ")) )
))

(setq sss (strcat kh hh svo sww bp smx smy smz ))


(write-line sss f)
(setq k (1+ k))
)

(setq xkol (/ mxkol wkol))


(setq ykol (/ mykol wkol))
(setq zkol (/ mzkol wkol))

(setq bs (list xkol ykol zkol))


(setq bs1 (list xkol (- ykol 3) zkol))
(setq bs2 (list xkol (- ykol 6) zkol))

(setq sxkol (rtos xkol 2 1))


(setq sykol (rtos ykol 2 1))
(setq szkol (rtos zkol 2 1 ))
(setq wkol (rtos wkol 2 1))
(setq vkol (rtos vkol 2 1))
(setq sbs (strcat "(" sxkol " " sykol " " szkol ")" ))

(command "text" bs 2 "" sbs "")


(command "text" bs1 2 "" wkol "")
(command "text" bs2 2 "" vkol "")

(setq kh (itoa (1+ k)))


(if (> 5 (strlen kh))(progn (repeat (- 5 (strlen kh)) (setq kh (strcat kh "
")) ) ))
(if (> 20 (strlen nnm))(progn (repeat (- 20 (strlen nnm)) (setq nnm (strcat nnm "
")) ) ))
(if (> 20 (strlen vkol))(progn (repeat (- 20 (strlen vkol)) (setq vkol (strcat vkol
" ")) ) ))
(if (> 20 (strlen wkol))(progn (repeat (- 20 (strlen wkol)) (setq wkol (strcat wkol
" ")) ) ))
(if (> 20 (strlen sbs))(progn (repeat (- 20 (strlen sbs)) (setq sbs (strcat sbs "
")) ) ))

(setq ll (strcat kh nnm vkol wkol sbs ))


(write-line
"----------------------------------------------------------------------------------
-------------------------------------------------------" f)
(write-line ll f)
(close f)

(command "-xref" "r" "*" )


)

;5555555555555555555555555555555555555555555555555

(defun c:bg2 ()
(setq k 0)
(setq p1 '(0 0 0))
(setq mxkol 0 mykol 0 mzkol 0 wkol 0 vkol 0)

(command "zoom" "e")


(setq m1 (ssget p1 ))
(setq qk 0)

(while (/= m1 nil)


(setq namq (ssname m1 0))
(setq cc (cdr (assoc '2 (entget namq))))
(setq sqk (itoa qk))
(setq uu (strcat "q" sqk))
(set (read uu) cc )

(command "-xref" "u" cc )


(setq qk (1+ qk))
(setq m1 (ssget p1 '((0 . "INSERT")) ))
)
(setq per (getvar "DWGPREFIX"))
(setq namf (getvar "dwgname"))
(setq tts (vl-string-search "." namf))
(setq nnm (substr namf 1 tts))

(setq bbgg (strcat per nnm "-bg.txt"))

(setq f (open bbgg "w"))

(setq gg (strcat "No" " name " "Volume " "weight


" "Centroid "
"Moments of X " "Moments of Y " "Moments of Z " ))
(write-line gg f)
(setq k 0)

(repeat qk
(setq sk (itoa k))
(setq hh (eval(read(strcat "q" sk))))
(command "-xref" "r" hh )
(command "-refedit" p1 "o" "a" "")
(setq tx (ssget "x" '((0 . "TEXT")(8 . "$0$BG")) ))

(if (= tx nil)
(progn
(command "u" "")
(command "-xref" "u" hh )
))

(if (/= tx nil)


(progn
(setq n1 (sslength tx))
(setq kh (itoa (1+ k)))
(setq k1 0)

(repeat 3
(setq nam1 (ssname tx k1))
(setq t1 (cdr(assoc '1 (entget nam1))))

(if (= "(" (substr t1 1 1))


(progn
(setq xx (nth 0 (read t1)))
(setq yy (nth 1 (read t1)))
(setq zz (nth 2 (read t1)))
(setq bp t1)
))

(if (= "B" (substr t1 1 1))


(progn
(setq ww (read (substr t1 7)))
))

(if (= "V" (substr t1 1 1))


(progn
(setq vo (read (substr t1 3)))
))

(setq k1 (1+ k1))


)

(setq mx (* ww xx))
(setq my (* ww yy))
(setq mz (* ww zz))

(command "u" "")


(command "-xref" "u" hh )

))
(setq mxkol (+ mxkol mx))
(setq mykol (+ mykol my))
(setq mzkol (+ mzkol mz))
(setq wkol (+ wkol ww))
(setq vkol (+ vkol vo))

(setq smx (rtos mx 2 1))


(setq smy (rtos my 2 1))
(setq smz (rtos mz 2 1))
(setq svo (rtos vo 2 1))
(setq sww (rtos ww 2 1))

(if (> 5 (strlen kh))(progn (repeat (- 5 (strlen kh)) (setq kh (strcat kh "
")) ) ))
(if (> 20 (strlen hh))(progn (repeat (- 20 (strlen hh)) (setq hh (strcat hh " ")) )
))
(if (> 20 (strlen svo))(progn (repeat (- 20 (strlen svo)) (setq svo (strcat svo "
")) ) ))
(if (> 20 (strlen sww))(progn (repeat (- 20 (strlen sww)) (setq sww (strcat sww "
")) ) ))
(if (> 20 (strlen smx))(progn (repeat (- 20 (strlen smx)) (setq smx (strcat smx "
")) ) ))
(if (> 20 (strlen smy))(progn (repeat (- 20 (strlen smy)) (setq smy (strcat smy "
")) ) ))
(if (> 20 (strlen smz))(progn (repeat (- 20 (strlen smz)) (setq smz (strcat smz "
")) ) ))
(if (> 20 (strlen bp))(progn (repeat (- 20 (strlen bp)) (setq bp (strcat bp " ")) )
))

(setq sss (strcat kh hh svo sww bp smx smy smz ))


(write-line sss f)
(setq k (1+ k))
)

(setq xkol (/ mxkol wkol))


(setq ykol (/ mykol wkol))
(setq zkol (/ mzkol wkol))

(setq bs (list xkol ykol zkol))


(setq bs1 (list xkol (- ykol 3) zkol))
(setq bs2 (list xkol (- ykol 6) zkol))

(setq sxkol (rtos xkol 2 1))


(setq sykol (rtos ykol 2 1))
(setq szkol (rtos zkol 2 1 ))
(setq wkol (rtos wkol 2 1))
(setq vkol (rtos vkol 2 1))
(setq sbs (strcat "(" sxkol " " sykol " " szkol ")" ))

(command "text" bs 2 "" sbs "")


(command "text" bs1 2 "" wkol "")
(command "text" bs2 2 "" vkol "")

(setq kh (itoa (1+ k)))


(if (> 5 (strlen kh))(progn (repeat (- 5 (strlen kh)) (setq kh (strcat kh "
")) ) ))
(if (> 20 (strlen nnm))(progn (repeat (- 20 (strlen nnm)) (setq nnm (strcat nnm "
")) ) ))
(if (> 20 (strlen vkol))(progn (repeat (- 20 (strlen vkol)) (setq vkol (strcat vkol
" ")) ) ))
(if (> 20 (strlen wkol))(progn (repeat (- 20 (strlen wkol)) (setq wkol (strcat wkol
" ")) ) ))
(if (> 20 (strlen sbs))(progn (repeat (- 20 (strlen sbs)) (setq sbs (strcat sbs "
")) ) ))

(setq ll (strcat kh nnm vkol wkol sbs ))


(write-line
"----------------------------------------------------------------------------------
-------------------------------------------------------" f)
(write-line ll f)
(close f)

(command "-xref" "r" "*" )


)

;//////////////////////////////////////////////

(defun c:bgK ()
(setq k 0)
(command "zoom" "e")
(setq kol (ssget "x" '((0 . "INSERT")) ))
(setq nkol (sslength kol))
(setq qk 0)
(setq f (open "d:\\list.txt" "w"))

(repeat nkol
(setq namq (ssname kol qk))
(setq sqk (itoa qk))
(setq cc (cdr (assoc '2 (entget namq))))
(setq uu (strcat sqk " " CC))
(WRITE-LINE UU F)

(command "-xref" "u" cc )


(setq qk (1+ qk))
)
(close f)
)
;//////////////////////////////////////////////////////////////////

(defun c:vpc () (command "vpclip"))

(defun c:mdh () (command "ampowerdim" ))

(defun c:ani ()
(setq l1 (car (entsel "select path")))
(setq n (getint "number of divide"))
(command "divide" l1 n "")
(setq mo (ssget "P"))
(setq z (sslength mo))
(setq k 1)
(repeat z
(setq m1 (ssname mo 0))
(setq p1 (cdr (assoc '10 (entget m1))))
(setq m2 (ssname mo 1))
(setq p2 (cdr (assoc '10 (entget m2))))

(command "camera" p1 p2 "v" "y" "")


(setq kk (itoa k))
(setq nam (strcat "d:\\m" kk ))
(command "plot" "y" "" "DWF6 ePlot.pc3" "" "" "" "" "D" "F" "" "" "" "" "V" "c" nam
"y" "y" )
(setq k (1+ k))
(ssdel m1 mo)
)

(defun c:cfa () (command "chamfer" "a" ))


(defun c:fa () (command "flatshot"))
(defun c:rx ()
(setq kol (ssget))
(setq n (sslength kol))
(setq k 0)
(setq mo (ssadd))

(repeat n
(setq n1 (ssname kol k))
(setq tx (cdr (assoc '0 (entget n1))))

(if (= tx "TEXT")(ssadd n1 mo ))
(setq k (1+ k))
)
(command "copy" mo "" "@" "@" )

(setq z (sslength mo))


(setq kk 0)

(repeat z
(setq m1 (ssname mo kk ))
(setq p1 (cdr (assoc '10 (entget m1))))
(setq p2 (trans p1 0 1))
(command "rotate" m1 "" p2 "-90")
(setq kk (1+ kk))
(command "move" m1 "" p2 "@30<0")
(command "move" m1 "" p2 "@30<90")
)
)

(defun c:qq ()

(setq n1 (getpoint " point 1 :"))


(setq x1 (nth 0 n1) y1 (nth 1 n1) z1 (nth 2 n1))
(setq n2 (getpoint " point 2 :"))
(setq x2 (nth 0 n2) y2 (nth 1 n2) z2 (nth 2 n2))
(setq n3 (getpoint " point 3 :"))
(setq x3 (nth 0 n3) y3 (nth 1 n3) z3 (nth 2 n3))
(setq n4 (getpoint " point 4 :"))
(setq x4 (nth 0 n4) y4 (nth 1 n4) z4 (nth 2 n4))
;(setq n5 (getpoint " point value :"))
;(setq x5 (nth 0 n5) y5 (nth 1 n5) z5 (nth 2 n5))

(setq mo (car(entsel "select object ")))


(setq ta (getint "number of divide"))
(command "divide" mo ta "")
(setq kol (ssget "p" ))
(setq nu (sslength kol))

(setq k 0)
(repeat nu
(setq m1 (ssname kol k))
(setq n5 (cdr (assoc '10 (entget m1))))
(setq x5 (nth 0 n5) y5 (nth 1 n5) z5 (nth 2 n5))

(setq sh (/ (- x3 x4) (- x1 x2) ))


(setq xx (+ x3 (* (- x5 x1 ) sh)))

(setq sh (/ (- y3 y4) (- y1 y2) ))


(setq yy (+ y3 (* (- y5 y1 ) sh)))

(setq sh (/ (- z3 z4) (- z1 z2) ))


(setq sh1 (* (- z5 z1 ) sh))
(setq zz (+ z3 sh1))

(setq p1 (list xx yy zz))


(command "point" p1 )
(setq k (1+ k))
(print jj )
))

(defun c:pg () (command "purge" "all" "" "" "brep" "all" "" ))
(defun c:br () (command "brep" "all" ""))
(defun c:scm () (command "setvar" "SHORTCUTMENU" "0"))
(defun c:mbp () (command "setvar" "MBUTTONPAN" "0"))
(defun c:gp ()
(command "ucs" "w")
(setq p1 (getpoint "\n getpoint "))
(setq x (rtos(car p1) 2 1))
(setq y (rtos(nth 1 p1) 2 1))
(setq z (rtos(nth 2 p1) 2 1))
(setq sss (strcat x "," y "," z ))
(command "ucs" "v")
(setq p2 (trans p1 0 1))
(setq p2 (mapcar '+ p2 '(-30 30 0)))

(command "text" p2 "100" "0" sss "" )


)

(defun c:vs2 () (command "VSCURRENT" "2d" ))


(defun c:vsh () (command "VSCURRENT" "H"))
(defun c:vsc () (command "VSCURRENT" "c"))
(defun c:vsr () (command "VSCURRENT" "r"))
(defun c:rc () (command "ucs" "v" "rectangle"))
(defun c:pg () (command "purge" "all" "" "n"))
(defun c:mvs1 () (command "SPACETRANS " "" ))
(defun c:mas () (command "ucs" "w")(command "massprop" ))
(defun c:cs () (command "CHSPACE"))

(defun c:sv ()
(setq k 0)
(setq v 1 h 1)

(while (or (/= v nil)(/= h nil))


(setq k (1+ k))
(setq kk (itoa k))
(setq nV (strcat kk "-VIS"))
(setq nH (strcat kk "-HID"))
(setq nnv (list (cons '8 nv)))
(setq nnh (list (cons '8 nh)))
(setq v (ssget "x" nnv))
(setq h (ssget "x" nnh))
)
(setq p1 (getpoint "\n center of view"))
(setq c1 (getpoint "\n corner-1 of view"))
(setq c2 (getcorner c1 "\n corner-2 of view"))
(command "solview" "u" "" "" p1 "" c1 c2 k "")
(setq ly (strcat kk "-HID"))
(command "layer" "c" "2" ly "")
)

(defun c:sd ()
;(setq mo (car (entsel "\n select viewports")))
(command "soldraw" pause "")
(setq ly (strcat kk "-VIS"))
(setq ck (list(cons 8 ly )))
(setq mv (ssget "X" ck))

(setq ly (strcat kk "-HID"))


(setq ck (list(cons 8 ly )))
(setq mh (ssget "X" ck))
(command "MSPACE")

(setq mb (ssget "X" '((2 . "AME_VW"))))


(command "select" mv mh "r" mb "")

(command "CHSPACE" "p" "")


)
;(defun c:sd () (command "soldraw" entlast ))
(defun c:bp () (command "bpoly"))
(defun c:3r () (command "rotate3d"))

You might also like