Jump to content

Recommended Posts

Posted

as1.jpgas1.jpg

 

 

Hello, who is always here to study Lisp. Fillet-related questions. I want to change the polyline, as shown. Lisp functions as visual rather than a command available?

Thank you for your interest.

as1.jpg

Posted

Not sure that you really need an AutoLISP routine for that - please check the _Polyline option of _FILLET command. Did you use a localized version of AutoCAD?

Posted

here is sample for what i want..

 

If angle is 90degree no problem.

 

but if not 90dregree It is strange shape of the polyline

 

i think variable p4 p5 were wrong but can not calculation point.. is it possible visual lisp (not Command _.fillet function)

and i`m korean cad version AUTOCAD 2007

 

(defun c:aa
   ( / r o b p1 p2 p3 p4 p5 

       _pt->cen
       _tan
       _lwpoly
       _GetBulge

       LM:Clockwise
   )

   (defun _pt->cen ( p1 p2)
       (mapcar '(lambda (a b) (* 0.5 (+ a b))) p1 p2)
   )

   (defun _tan ( x )
       (if (not (equal 0. (cos x) 1e-) (/ (sin x) (cos x)))
   )

   (defun _lwpoly ( lst cls )
       (vlax-ename->vla-object
           (entmakex 
               (append 
                   (list 
                       (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity")
                       (cons 100 "AcDbPolyline") (cons 90 (length lst))
                       (cons 70 cls)
                   )
                   (mapcar '(lambda (p) (cons 10 (trans p 1 0)))lst)
               )
           )
       )
   )

   (defun LM:Clockwise ( p1 p2 p3 )
       (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14)
   )

   (defun _GetBulge ( p1 p2 r / c a l p )
       (setq c (_pt->cen p1 p2)
             a (- (angle p1 p2) (* 0.5 pi))
             l (sqrt (abs (- (* r r) (* (distance p1 c) (distance p1 c)))))
             p (polar c a l)
       ) (_tan (* (rem (- (angle p p2) (angle p p1)) pi) 0.25))
   )

   (setq p1 (getpoint "\n1st point :")
         p2 (getpoint p1 "\n2nd point :")
         p3 (getpoint p2 "\n3rd point :")
         r  (getreal "\nFillet Radius :")
         p4 (polar p2 (angle p2 p1) r)
         p5 (polar p2 (angle p2 p3) r)
   )

   (setq o (_lwpoly (list p1 p4 p5 p3) 0)
         b (_Getbulge p4 p5 r)
   )
   (if (LM:clockwise p1 p2 p3) 
       (setq b (- (abs b)))
       (setq b (abs b))
   )
   (vla-setbulge o 1 b)
   b
)(vl-load-com)

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...