Jump to content

Why don't this lisp work with polylines?


MarcoW

Recommended Posts

I found this nice routine to edit my 1 - line piping...

It works for as long as we draw lines, not polylines, too bad.

Why doesn't it work with polylines?

 

I get the message:

 

 
Zero length line created at (13097.1724, 1164.9590, 0.0000)
No changeable object selected

 

So I figured it has to do with the object type.

 

 
; 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)
)

 

For the chamfer command itself works with plines. :?

Only a hint would be okay.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...