Membuat Garis Sejajar


;Membuat garis sejajar dengan hanya memberi jaraknya saja
(defun c:SW (/ A FAN DI KU SU MA rr)
(setq rr *error* *error* merr)(command "ucs" "W")
(IF(NULL MYG)(SETQ MYG 3.0))
(setq FAN (ENTsel " OFFSET by New Base Line\nSelect line to Offset : ") )
(if FAN(progn
(setq KU 0.0 DI (getdist (osnap(cadr FAN)"endp")
(STRCAT"\n Enter distance <"(RTOS MYG 2 2)"> : ") ))
(if DI (setq MYG DI) (setq DI MYG))
(setq SU(list DI))
;(command "ucs" "e" FAN)
(while DI
(if(/= DI "Undo")(progn
(setq SU(append(list DI)SU))
(setq KU (+ KU DI))
(command "offset" KU FAN"NON"(cadr(grread t))"")
) )
(initget "eXit Undo .")
(setq DI(getreal(strcat"\n eXit/Undo/Enter distance <"(rtos MYG)"> : ")) )
(if DI(IF(NUMBERP DI)(setq MYG DI))(setq DI MYG))
(if(or(="."DI)(="eXit"DI))(setq DI nil))
(if (= DI "Undo")
(if(cdr SU)(progn
(entdel(entlast))
(setq KU(- KU (car SU)))
(setq SU(cdr SU))
)(princ"Nothing to undo"))
) ) ))
(setq *error* rr)(princ))
;(defun c:wa(/ P LAY)(SETQ LAY(GETVAR"CLAYER"))(COMMAND"LAYER""M""ARBANG""")(WHILE(SETQ P(GETPOINT"\n Insertion point: "))(COMMAND"INSERT""D:/PROJECT/LIBRARY/WATUS.DWG""non"P""""""))(SETVAR"CLAYER"LAY)'°)
;(defun c:aw(/ P)(SETQ P(GETPOINT"\n Insertion point: "))(COMMAND"INSERT""*D:/PROJECT/LIBRARY/aalir.DWG""non"P"")'°)
;(defun c:AS(/ P)(SETQ P(GETPOINT"\n Insertion point: "))(COMMAND"INSERT""*D:/PROJECT/LIBRARY/ARSIR.DWG""non"P"""")'°)
(DEFUN C:Tr(/ osm rr pt1 pt2 pt3 pt4 se)(setq rr *error* *error* merr)
(setq osm(getvar"osmode"))(setvar"osmode"0)
(setq pt1 (getpoint "\nFirst corner: ")
pt2 (getcorner pt1 "\nOther corner: ")
pt3 (list(car pt1)(cadr pt2))
pt4 (list(car pt2)(cadr pt1))
se (ssget"c"pt1 pt2))
(command"trim"se"""f"pt3 pt1 pt4"""f"pt3 pt2 pt4"")
(setvar"osmode"osm)(setq *error* rr)(princ))
(defun c:bc(/ ct x y t en)
(setq ct (getpoint" BOCK\n Pick point to intersection/






: ")

x (getreal"\n Enter two distance <20>: ")
y (getreal"\n second distance <20>: "))
(initget "Non")
(setq t (getreal"\n Non / Enter thickness <3>: "))
(if(not ct)(setq ct(getvar"viewctr")) )
(if(not x)(setq x 20))(if(not y)(setq y 20))(if(not t)(setq t 3))
(command"pline""NON"ct"NON"(list(+(car ct)x)(cadr ct))
"NON"(list(+(car ct)x)(+(cadr ct)y))"NON"(list(car ct)(+(cadr ct)y))"c")
(setq en(entlast))
(if(="Non"t)(command"explode"en)(progn
(command"offset"t(list en ct)"non"(list(+(car ct)(/ x 2))(+(cadr ct)(/ y 2)))"")
(command"explode"(entlast)"explode"en)))
(princ))
(defun c:SW2 (/ A FAN DI KU SU MA rr)
(setq rr *error* *error* merr)(command "ucs" "W")
(IF(NULL MYG)(SETQ MYG 3.0))
(setq FAN (ENTsel " OFFSET by New Base Line 1:2 \nSelect line to Offset : ") )
(if FAN(progn
(setq KU 0.0 DI (getdist (osnap(cadr FAN)"endp")
(STRCAT"\n Enter distance <"(RTOS MYG 2 2)"> : ") ))
(if DI (setq MYG DI) (setq DI MYG))
(setq SU(list DI))
(while DI
(if(/= DI "Undo")(progn
(setq SU(append(list DI)SU))
(setq KU (+ KU DI))
(command "offset"(* 0.5 KU) FAN"NON"(cadr(grread t))"")
) )
(initget "eXit Undo .")
(setq DI(getreal(strcat"\n eXit/Undo/Enter distance <"(rtos MYG)"> : ")) )
(if DI(IF(NUMBERP DI)(setq MYG DI))(setq DI MYG))
(if(or(="."DI)(="eXit"DI))(setq DI nil))
(if (= DI "Undo")
(if(cdr SU)(progn
(entdel(entlast))
(setq KU(- KU (car SU)))
(setq SU(cdr SU))
)(princ"Nothing to undo"))
) ) ))
(setq *error* rr)(princ))
(defun c:ws (/ A FAN DI KU SU MA rr)
(setq rr *error* *error* merr)(command "ucs" "W")
(IF(NULL MA)(SETQ MA 3.0))
(setq FAN (ENTsel " OFFSET by ONE Base Line\nSelect line to Offset : ") )
(if FAN(progn
(setq KU 0.0 DI (getdist (osnap(cadr FAN)"endp")
(STRCAT"\n Enter distance <"(RTOS MA 2 2)"> : ") ))
(if DI (setq MA DI) (setq DI MA))
(command "ucs" "e" FAN)
(while DI
(if(/= DI "Undo")(command "offset" di FAN"NON"(list 0 KU)"") )
(initget "eXit Undo .")
(setq DI(getreal(strcat"\n eXit/Undo/Enter distance <"(rtos MA)"> : ")) )
(if DI(IF(NUMBERP DI)(setq MA DI))(setq DI MA))
(if(or(="."DI)(="eXit"DI))(setq DI nil))
(if (= DI "Undo")(entdel(entlast)) )
) ) )
(command "ucs" "W")(setq *error* rr)(princ))
(defun c:ga (/ a ar pt sc pt1)
(setq pt1 (getpoint "Select point inside area to be calculated: "))
(command "-boundary" pt1 "")
(setq A (ssget "L"))
(setq unts (getvar "lunits"))
(setvar "lunits" 2)
(command "area" "e" a )
(setq ar (getvar "area"))
(setvar "lunits" unts)
(setq pt (getpoint "select location for area note: "))
(command "text" pt"""" ar)
)
;Array vertikal
(defun c:vr (/ A FAN DI KU SU MA rr)
(setq rr *error* *error* merr)(command "ucs" "W")
(Princ" Vertical Array ")
(setq A (ssget ))
(setq FAN (ssname A 0)
DI(cdr(assoc 10(entget FAN)))
KU(getint " Enter the number of rows (---): <10> ")
SU (getdist DI " Specify the distance between rows: ")
)(IF(NULL KU)(SETQ KU 10))
(command"-array" A "" "_R" KU "1" SU)
(setq *error* rr)(princ))
;Array horizontal
(defun c:hr (/ A FAN DI KU SU MA rr)
(setq rr *error* *error* merr)(command "ucs" "W")
(Princ" Vertical Array ")
(setq A (ssget ))
(setq FAN (ssname A 0)
DI(cdr(assoc 10(entget FAN)))
KU(getint " Enter the number of columns (|||): <10> ")
SU (getdist DI " Specify the distance between columns: ")
)(IF(NULL KU)(SETQ KU 10))
(command"-array" A "" "_R" "1" KU SU)
(setq *error* rr)(princ))
________________________________________________________

Garis Sejajar Merenggang

;Membuat garis sejajar yang makin merapat atau makin merenggang

(defun co(F)(if(="ok"A)(- x2(*(pp 1(cos(*(/ F 180.0)pi)))di))(pm MA F) ))
(defun li(F)
(if(= AN cadr)(setq po1(list(co F)S) po2(list(co F)U) )
(setq po1(list S(co F)) po2(list U(co F)) ))
(command"line""non"po1"non"po2""))

(defun aarray(A / A F AN D I KU S U MA di rr c2)
(setq rr *error* *error* merr)
(setq I(getpoint" First point to radial: "))
(if I(setq KU(getcorner I" End corner: ")))
(if(and I KU)(progn
(setq lay(getvar"clayer"))(command"layer""m""arbang""")
(if(<(cadr I)(cadr KU))(setq AN cadr c2 car pp *)(progn (if(<(car I)(car KU))(setq pp *)(setq pp -)) (setq AN car c2 cadr) )) (setq S(AN I) U(AN KU) MA(c2 I) x2(c2 KU) di(- x2 MA) D 0) (if(="ok"A)(progn(li 15)(li 30)(li 45)(li 60)(li 75)(li 90))(progn (if(> x2 MA)(setq pm +)(setq pm -))(setq F 0.5)
(if(and(= AN car)(= pp -))(setq pm + MA x2))
(while(>(abs di)F)(li F)(setq D(+ 1 D) F(+ D F)) )))
))(setvar"clayer"lay)(setq *error* rr)(princ))

(defun c:ry()(PROMPT" View Circle")(aarray"ok"))
(defun c:yr()(PROMPT" array View")(aarray 0.5))

Membuat Arsir

;Membuat arsir horizontal
;Membuat arsir vertical
;Membuat arsir 45 derajat

(defun c:rr(/ p osm rr r)(setq rr *error* *error* merr)
(setq osm(getvar"osmode") r 0)(setvar"osmode"0)
(prompt" Boundary Area\n Select internal point: ")
(while(setq p(getpoint))
(if(C:boundary p)(progn(princ" Next point: ")(setq r(1+ r))) )
)(command "cmdecho""0" "area""a")
(repeat r(command"e"(entlast)"")(entdel(entlast)) )(command"")
(REDRAW)
(setvar"osmode"osm)(setq *error* rr)(princ))

(defun arsir(A FAN DI / A FAN DI p lay rr osm)
(setq rr *error* *error* merr)(setq lay(getvar"clayer"))
(setq osm(getvar"osmode"))(setvar"osmode"0)
(prompt" Boundary HATCH\n ")
(while(setq p(getpoint"Select internal point: "))(command"-boundary" p"")
(command"layer""m"A"" "hatch""u"FAN DI"n""l""")
)(REDRAW)(setvar"clayer"lay)(setvar"osmode"osm)(setq *error* rr)(princ))

(defun c:vv()(arsir"hatch""90""1"))
(defun c:hh()(arsir"hatch""0""1"))
(defun c:h4()(arsir"hatch""45""3"))
(defun c:h5()(arsir"hatch""-45""3"))
(defun c:h2()(arsir"hatch""45""2"))
(defun c:h6()(arsir"hatch""45""1"))

(defun ahatch(ahat sc / A FAN DI p osm lay rr)
(setq rr *error* *error* merr)(setq lay(getvar"clayer"))
(setq osm(getvar"osmode"))(setvar"osmode"0)
(princ ahat)(prompt" Boundary HATCH\n ")
(while(setq p(getpoint"Select internal point: "))(if(c:bpoly p)
(command"layer""m""HATCH""" "hatch"ahat sc"0""l""" "erase""p"""))
)(REDRAW)(setvar"clayer"lay)(setvar"osmode"osm)(setq *error* rr)(princ))

(defun c:36()(ahatch"ANSI36""15" ))
(defun c:H3()(ahatch"AR-CONC""0.75"))
(defun c:H7()(ahatch"AR-SAND""0.75"))
(defun c:Hd()(ahatch"DOTS""5"))
(defun c:HC()(ahatch"CROSS""5"))

(defun C:44(/ lay p1 p2 e1 e2 sd l d)(setq lay(getvar"clayer"))
(setq p1(getp"\n First point: ") p2(getpoint p1"\n To point: "))
(if(and p1 p2)(progn(if(>(cadr p1)(cadr p2))(setq sd 45 l -)(setq sd -45 l +))
(command"line""non"p1"non"p2"" "offset""2"(list(setq e1(entlast))p1)"non"(list(car p1)(-(cadr p1)50))"")
(setq e2(entlast))
(command"layer""m""artanah""" "hatch""*u"sd"2"""e1 e2"" "erase" e1 e2 "")
(setq d(distance(cdr(assoc 10(entget(entlast))))(cdr(assoc 11(entget(entlast))))))
(command"line""non"p1"non"(strcat"@"(rtos(l 0 d))"<"(rtos sd))"" "line""non"p2"non"(strcat"@"(rtos(l 0 d))"<"(rtos sd))"")
(setvar"clayer"lay)))(princ))

(defun c:ur(/ p lay rr osm)
(setq rr *error* *error* merr)(setq lay(getvar"clayer"))
(setq osm(getvar"osmode"))(setvar"osmode"0)
(prompt" Boundary HATCH\n ")
(while(setq p(getpoint"Select internal point: "))(if(c:-boundary p)
(command"layer""m""arbang""" "hatch""u""45""2""y""l""" "erase""p"""))
)(REDRAW)(setvar"clayer"lay)(setvar"osmode"osm)(setq *error* rr)(princ))

(defun c:ga (/ a ar pt sc pt1)
(setq pt1 (getpoint "Select point inside area to be calculated: "))
(command "-boundary" pt1 "")
(setq a (ssget "L"))
(setq unts (getvar "lunits"))
(setvar "lunits" 2)
(command "area" "e" a )
(setq ar (getvar "area"))
(setvar "lunits" unts)
(setq pt (getpoint "select location for area note: "))
(command"erase"a"")
(command "text" pt"""" ar)
)

Merubah sudut text

;Merubah sudut text berdasarkan satu garis yang dipilih
;Dari end point terdekat kearah endpoint terjauh


(DEFUN C:99(/ rr v2 se a f an d i k u su ma)
(setq rr *error* *error* merr)
(setq v1(ssget '((0 . "TEXT"))) V2 0
se(nsel" Select line : "))
(setq a (cdr (assoc 10 (entget (car se))))
an (distance (car (cdr se)) a)
f (cdr (assoc 11 (entget (car se))))
d (distance (car (cdr se)) f) )
(if (< an d )(setq i a k f)(setq i f k a))
(setq u (cons 50(ANGLE i k)))
(while (< v2 (sslength v1))
(setq su (assoc 50 (setq ma(entget (ssname v1 v2)))))
(entmod (subst u su ma))
(setq v2 (1+ v2))
)
(setq *error* rr)(princ))