Hello,
I have read this topic but is did not solve my problem:
http://www.theswamp.org/index.php?topic=17392.0When drawing polylines, sometimes they need to be chamfered. That can only be done when exploding the polyline.
Or not drawing polylines but drawing just plain and simple lines.
What I was searching for (and I have done a lot searching) is a routine that would be able to:
1. prompt for the polyline to be chamfered
2. prompt for the remaining polyline
3. promt the side of chamfer
In the routine itself (or 4.) the chamfer distance A and B can be given.
See image for what I mean.
I have tried several routines like this:
; Chamfers first line to second line and leaves second line unchanged.
; In other words, does not trim second line to chamfer.
;
(DEFUN C:CHAMFER2 (/ A B AN BN AE BE AN1
AN2 TN1 TN2 TN3 NS RS R C)
(SETVAR "CMDECHO" 0)
(SETQ B (ENTSEL "LINE TO CHAMFER: ")
BN (OSNAP (CADR B) "NEAR")
BE (OSNAP (CADR B) "END")
A (ENTSEL "UNCHANGING LINE: ")
AN (OSNAP (CADR A) "NEAR")
AE (OSNAP (CADR A) "END")
NS (INTERS AN AE BN BE NIL)
RS (STRCAT "CHAMFER <" (RTOS
(GETVAR "CHAMFERA")) ">: ")
R (GETREAL RS))
(IF R (SETVAR "CHAMFERA" R)
(SETQ R (GETVAR "CHAMFERA"))
)
(SETQ AN1 (ANGLE NS AN)
AN2 (ANGLE NS BN)
C (- AN2 AN1))
(IF (> C PI)
(SETQ C (- C (* 2.0 PI))))
(IF (< C (- PI))
(SETQ C (+ C (* 2.0 PI))))
(SETQ TN3 (ABS (/ (* R (COS
(/ C 2.0 ))) (SIN (/ C 2.0))))
TN1 (POLAR NS AN1 TN3)
TN2 (POLAR NS AN2 TN3))
(IF (MINUSP C)
(COMMAND "LINE" TN1 TN2 "")
(COMMAND "LINE" TN2 TN1 "")
)
(COMMAND "CHANGE" (CAR B) "" TN2)
(SETVAR "CMDECHO" 1)
)
But this given routine only works with lines, not polylines.
Also it does not work constant: half the time it does create zero length lines.
Anyway... does anybody have a routine that does the trick?
Or maybe kick me in the right direction?
Thanks already.