how to fillet with continuous lines?

how to fillet with continuous lines?

thsa2501
Enthusiast Enthusiast
3,057 Views
13 Replies
Message 1 of 14

how to fillet with continuous lines?

thsa2501
Enthusiast
Enthusiast

need this area fillet.PNGhi everyone,

i am having trouble with in lisp code. how to get fillet autolisp function to write with this code?why not getting fillet with these two points  after the offset while putting the continuous lines.

 

 

(defun c:line () (setq p1 (getpoint "\npickt first point:")) (while (/= nil (setq p2 (getpoint p1 "\npick second point: "))) (command "line" p1 p2 "") (setq p1 p2) (command "offset" "0.2" p1 p2 "") (command "fillet" p1 p2 ) ) )

0 Likes
Accepted solutions (2)
3,058 Views
13 Replies
Replies (13)
Message 2 of 14

Kent1Cooper
Consultant
Consultant

Your p1 and p2 variables are on the original Line, never on the one resulting from the Offset, and by the time it gets to the Fillet command, they're at the same place.  So the Offset will go to the side AutoCAD chooses, not necessarily the side you want it to.  And the first time, the Line you want to Fillet that Offset result with doesn't even exist yet.

 

It could be worked out with a lot of additional code, the biggest complication being the side to which to Offset and ensuring that always goes the right way with any turn in direction.  BUT AutoCAD will figure it all out for you without any custom command, with the MLINE command.

Kent Cooper, AIA
0 Likes
Message 3 of 14

Sea-Haven
Mentor
Mentor
Accepted solution

Like Kent why not just draw a pline then offset ? You can do a pick points in a lisp.

 

Just one of many ways to do a pline. The offset will be right to the 1st leg direction, a -ve offset will go left. Close is still valid finish.

 

 

 

(defun c:plpts ( / pt)
(setq off (getreal "\nOffset distance + -"))
(setq pt (getpoint "\nStarting point of Pline : "))
(command "_pline" pt)
(while (= (getvar "cmdactive") 1 )
(command (getpoint (getvar 'lastpoint)))
)
(vla-offset (vlax-ename->vla-object (entlast)) off)
(princ)
)

 

 

 

Message 4 of 14

john.uhden
Mentor
Mentor

Umm, shouldn't that be...

(command (getpoint "\nNext point: " (getvar 'lastpoint)))

or do you guys from down under just expect the bartender to pass you another Great Northern without prompting?

And where is the Undo option?  😖

John F. Uhden

0 Likes
Message 5 of 14

Sea-Haven
Mentor
Mentor

Yes a hint is always a good idea, 

0 Likes
Message 6 of 14

thsa2501
Enthusiast
Enthusiast

hi kent

sorry for the delay message. thanks for the reply. yes, i agree your point. why additional code need for fillet function?

just not like come offset by given points for fillet.

0 Likes
Message 7 of 14

thsa2501
Enthusiast
Enthusiast

hi sea_haven

thanks for the reply. yes, I totally forget to put the pline there.

i would like to know. why put their function? i totally confused. can you clarify?

(while (= (getvar "cmdactive") 1 )
(command (getpoint (getvar 'lastpoint)))
)

 

0 Likes
Message 8 of 14

Kent1Cooper
Consultant
Consultant
Accepted solution

@thsa2501 wrote:

.... why additional code need for fillet function? ....


Because, for example, the things you want to Fillet are the results from Offsetting the things that you actually draw.  That means code would be required after each Offset to get information [such as endpoints] about the last object, and save it somewhere, and then after the next source Line is drawn and Offset, more code to get information about what is now the last object, so that the Fillet operation can use some location on each of those newer Lines.  But it can't use just any point on them.  In this situation [with the white being the ones you draw and the red being the results of Offsetting those]:

Kent1Cooper_0-1635338661002.png

using just the start point or the end point of each red Line could result in any of these:

Kent1Cooper_3-1635339091365.png

or it might even "see" one of the white Lines in Filleting.  So code would be needed to find some unambiguous place on each red Line that is not on a white Line, such as its midpoint, and even that could lie on some other object that the Fillet command might see instead of the right one:

Kent1Cooper_2-1635338926961.png

Have you tried MLINE yet?  It will do what you want, with no custom command definition.

Kent Cooper, AIA
Message 9 of 14

john.uhden
Mentor
Mentor
@Kent1Cooper,
It's not quite as difficult as that.
The FILLET command is actually looking for 2 picks, a pick being a list of
ename and point, exactly as returned by entsel. So as long as the picks
provided include the ename of the offsets, you don't need to worry about
"seeing" other objects.
But I do think the points need to be more than the radius away from the
intersection point.

I don't remember how this started, but couldn't he achieve the correct
result by joining the original lines into a polyline and offsetting with
OFFSETGAPTYPE set to 1?

John F. Uhden

0 Likes
Message 10 of 14

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:
.... couldn't he achieve the correct result by joining the original lines into a polyline and offsetting with OFFSETGAPTYPE set to 1?

That raises the question of the shape of Filleted corners.  The OP didn't specify or illustrate what is needed.  If they should be rounded, and only on outside corners, OFFSETGAPTYPE = 1 would do that.  If they should be sharp corners, it should be set to 0, but in that case I still say MLINE is the way to go.

Kent Cooper, AIA
0 Likes
Message 11 of 14

Sea-Haven
Mentor
Mentor

Pedit Join, fillet P is not that hard, now offset.

Message 12 of 14

thsa2501
Enthusiast
Enthusiast

hi kent 

i totally agreed with your point. i did not yet use mline. just wanted to know about the fillet function, because the offset function works for me.

0 Likes
Message 13 of 14

john.uhden
Mentor
Mentor
Um, you don't need to fillet at all.

John F. Uhden

0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

 

Fillet if radius required was pre-empting next question add a radius.

 

I do have a pline offset from other objects did it for water mains they can cross over sides of roads when going around intersections would do what was requested forgot all about it. Trying to find it. I need to index my lisps.

; draw offsets from points for random shape object making pline
; By Alan H AUG 2019
; Just pick points in sequence then press enter a pline will be drawn

(defun ah:ploffs (/ offdir offd x pt1 pt2 pt3 oldsnap ssp)

  (defun drawline (/ ang pt3 obj)
    (setq ang (angle pt1 pt2))
    (if (= offdir "L")
      (setq pt3 (polar pt2 (+ ang (/ pi 2.0)) 10))
      (setq pt3 (polar pt2 (- ang (/ pi 2.0)) 10))
    )
    (setvar 'osmode 0)
    (command "line" pt1 pt2 "")
    (setq obj (entlast))
    (command "offset" offd obj pt3 "")
    (setq ssp (ssadd (entlast) ssp))
    (command "erase" obj "")
    (setq pt1 pt2)
  )

  (defun swapr-l (/)
    (if (= (strcase offdir) "L")
      (setq offdir "R")
      (setq offdir "L")
    )
    (setvar 'osmode oldsnap)
    (setq pt1 (getpoint "\nPick  next point"))
    (setq pt2 (getpoint "\nPick  next point"))
    (drawline)
  )


; starts here
; add side pick
  (setq oldsnap (getvar 'osmode))
  (setq ssp nil)

  (initget 6 "R L")
  (setq offdir (strcase (getstring "Right or  Left")))
  (setq offd (getreal "Enter offset distance"))


  (setq pt1 (getpoint "pick 1st point"))
  (setq ssp (ssadd))

  (initget 6 "1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z")
  (while (setq pt2 (getpoint "\nPick  next point or [S Swap sides]:<"))
    (cond
      ((= (type pt2) 'LIST) (drawline))
      ((= (type pt2) 'str) (swapr-l))  ; also calls drawlines
      ((= pt2 nil) (quit))
    )
    (setvar 'osmode oldsnap)
    (initget 6 "Swap")
  )

  (setq x 0)
  (repeat (- (sslength ssp) 1)
    (setvar 'filletrad 0)
    (command "fillet" (ssname ssp x) (ssname ssp (1+ x)))
    (setq x (1+ x))
  )

  (setq x 0)
  (command "pedit" (entlast) "Y" "J")
  (repeat (- (sslength ssp) 1)
    (command (ssname ssp x))
    (setq x (1+ x))
  )
  (command "" "")

  (princ)

)
(ah:ploffs)

 

 

 

0 Likes