TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: PM on March 31, 2021, 01:54:32 AM
-
Hi. I am trying to write a code for door frame. I want to trim the mangenta wall lines between the two magenta vertical lines
and i want to trim the windoor green (color 90) lines between the the two green (color 90) vertical lines ,like the attach photo
(COMMAND "_layer" "_m" "WINDOOR" "_c" "90" "" "") (setq gonia12
(+ (- (* 2 PI
) (angle point1 point2
)) (/ PI
2))) (IF (> GONIA12
(* 2 PI
)) (- GONIA12
(* 2 PI
))) (setq gonia21
(+ (- (* 2 PI
) (angle point2 point1
)) (/ PI
2))) (IF (> GONIA21
(* 2 PI
)) (- GONIA21
(* 2 PI
))) (setq gonia23
(+ (- (* 2 PI
) (angle point2 point3
)) (/ PI
2))) (IF (> GONIA23
(* 2 PI
)) (- GONIA23
(* 2 PI
))) (setq x4
(+ x3
(* anoigma
(sin gonia21
)))) (setq y4
(+ y3
(* anoigma
(cos gonia21
)))) (setq x5
(+ x1
(* 0.05 (sin gonia12
)))) (setq y5
(+ y1
(* 0.05 (cos gonia12
)))) (setq x6
(+ x4
(* 0.05 (sin gonia12
)))) (setq y6
(+ y4
(* 0.05 (cos gonia12
)))) (setq x7
(+ x2
(* 0.05 (sin gonia21
)))) (setq y7
(+ y2
(* 0.05 (cos gonia21
)))) (setq x8
(+ x3
(* 0.05 (sin gonia21
)))) (setq y8
(+ y3
(* 0.05 (cos gonia21
)))) (COMMAND "_layer" "_m" "WALLS" "_c" "6" "" "_lw" "0.5" "" "") )
)
)
)
)
)
)
Thanks
-
any ideas?
-
(Defun dfn_enamk_line
(p1 p2 la color lt
/ $rr nfl
) (if (= color
nil) (setq;|a20225|; color
256)) (setq;|a20253|;$rr)
any ideas?
You replace the (command "line" point1 point2) with (dfn_enamk_line...)
(command "OSNAP" "NONE" "")
(command "line" point1 point2 "")
(command "line" point3 point4 "")
(command "line" point5 point6 "")
(command "line" point7 point8 "")
(COMMAND "_layer" "_m" "WALLS" "_c" "6" "" "_lw" "0.5" "" "")
(command "line" point1 point4 "")
(command "line" point2 point3 "")
:thinking:
-
If your interested this is very cheap, does windows and doors, roofs, elevations etc. Just PM me.
(http://)
-
Hi d2010 . Thanks for the reply, but i can not understand your code
what is
I never use them before. And i can not see anywere the command trim in your code. I want to trim the lines between magenta and color 90 like the attach photo
-
Try this code.
You extract the command break
I do not push-here the mySource because I hope other user/s respond to you, other solution/s, more better, that I have my pocket.
-
TEE lisp is not doing what i am searching for.
Thanks
-
You,only, extract the (command "break"..) and you insert it into your-lisp.
-
layer and color need adjusted by youself. How to upload a picture?
(defun GetUserInput ( / p1 p2 p3 osmd)
(setq osmd (getvar "OSMODE"))
(setvar "OSMODE" 545) ; nea + int + end
(setq p1 (getpoint "\nthe first insertion point: "))
(if (/= nil p1) (setq p2 (getpoint p1 "\nthe second insertion point: ")))
(setvar "OSMODE" 128) ; Per
(if (/= nil p2) (setq p3 (getpoint p2 "\nthe opposite wall point: ")))
(setvar "OSMODE" osmd)
(list p1 p2 p3)
)
(defun DoorFrame(/ p1 p2 p3 p4 dist delta ang p5 p6 p7 p8 osmd ss cmd)
(setq osmd (getvar "OSMODE") cmd (getvar "CMDECHO"))
(setvar "OSMODE" 0)
(setq Plist (GetUserInput))
(setq p1 (car Plist) p2 (cadr Plist) p3 (caddr Plist))
(if (or (not p1)(not p2)(not p3))
(princ "\nFunction Canceled.")
(progn
(setq ang (angle p1 p2)
delta 55 ; correct the value
dist (distance p1 p2)
p4 (polar p3 (+ pi ang) dist)
p5 (polar p1 ang delta)
p6 (polar p4 ang delta)
p7 (polar p2 (+ pi ang) delta)
p8 (polar p3 (+ pi ang) delta)
)
(command "_pline" p1 p4 "")
(setq ss (ssadd))
(ssadd (entlast) ss)
(command "_pline" p2 p3 "")
(ssadd (entlast) ss)
(command "_trim" ss "" "C" p7 p6 "")
(command "_line" p1 p5 p6 p4 "")
(command "_line" p2 p7 p8 p3 "")
) ; _ end of progn
) ; _ end of if
(setvar "OSMODE" osmd)
(setvar "CMDECHO" cmd)
(princ)
)