Jump to content

Recommended Posts

Posted

Hello,

 

i want to round that corner in AutoLISP. Who could be able to help me? It's a task for mark.

 

(DEFUN C:Disc()
 (setq t1 (getpoint "\n Select first point:"))
 (setq t2 (list(+(car t1)10) (+(cadr t1)10)))
 (setq t3 (list(+(car t2)38) (cadr t2)))
 (setq t4 (list(car t3) (-(cadr t3)50)))
 (command "line" t1 t2 t3 t4 ""))

 

aa45895139f80ffac001f83f2cfc7a0e162.png

Posted
How about the standard "fillet" command?

 

It is a task in university to do with AutoLISP

Posted

Easy!

 

(defun c:fillet ()
(command "fillet")
)

Posted

Well, I guess that it has to be in a single function...?

Using commands if not the most efficient way of making lisp, but academicly speaking it is a good starting point.

You could use the arc commmand. lets say i want to make an 90 degres arc, centered at 0,0,0, going from the coordinate 5,0 to 0,5, you could use the following:

(command "._arc" "c" "0,0,0" "5,0" "0,5").

Now what is left for you to do is inserting the arc command at the correct place, and changing both the coordinates of the endpoint of your line 2, and the startpoint of your line 3 by a length equivalent to the radius of your arc.

If needed you could ask the users input for the radius, store it into a variable and use it to make the calculations required, or hard code it like the length of your lines are.

 

I hope that hint will help you achieve what you need.

Posted

You could use a window option and pick the two lines or a "F" fence option both of these return the two lines or search here for my auto fillet routine that uses F123.45 and auto runs the fillet command for a given radius.

Posted

This may be of help getting started :

 


[color=#8b4513];;;CREATE A FILLET ARC FROM A LIST OF 3 CCW POINTS AND RADIUS[/color]

[b][color=BLACK]([/color][/b]defun f3p_fil3p [b][color=FUCHSIA]([/color][/b]l ra / a1 a2 i1 d1 c1 c2 cn sa ea[b][color=FUCHSIA])[/color][/b]
    [b][color=FUCHSIA]([/color][/b]setq a1 [b][color=NAVY]([/color][/b]angle [b][color=MAROON]([/color][/b]nth 1 l[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]nth 2 l[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
          a2 [b][color=NAVY]([/color][/b]angle [b][color=MAROON]([/color][/b]nth 1 l[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]nth 0 l[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
          i1 [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]> a1 a2[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]+ [b][color=BLUE]([/color][/b]* 2 pi[b][color=BLUE])[/color][/b] a2[b][color=GREEN])[/color][/b] a1[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]- a2 a1[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
          d1 [b][color=NAVY]([/color][/b]abs [b][color=MAROON]([/color][/b]/ ra [b][color=GREEN]([/color][/b]/ [b][color=BLUE]([/color][/b]sin [b][color=RED]([/color][/b]* i1 0.5[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                           [b][color=BLUE]([/color][/b]cos [b][color=RED]([/color][/b]* i1 0.5[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
          c1 [b][color=NAVY]([/color][/b]polar [b][color=MAROON]([/color][/b]nth 1 l[b][color=MAROON])[/color][/b] a1 d1[b][color=NAVY])[/color][/b]
          c2 [b][color=NAVY]([/color][/b]polar [b][color=MAROON]([/color][/b]nth 1 l[b][color=MAROON])[/color][/b] a2 d1[b][color=NAVY])[/color][/b]
          cn [b][color=NAVY]([/color][/b]inters c1 [b][color=MAROON]([/color][/b]polar c1 [b][color=GREEN]([/color][/b]+ a1 [b][color=BLUE]([/color][/b]* pi 0.5[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] 1.0[b][color=MAROON])[/color][/b]
                     c2 [b][color=MAROON]([/color][/b]polar c2 [b][color=GREEN]([/color][/b]+ a2 [b][color=BLUE]([/color][/b]* pi 0.5[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] 1.0[b][color=MAROON])[/color][/b] nil[b][color=NAVY])[/color][/b]
          sa [b][color=NAVY]([/color][/b]angle cn c2[b][color=NAVY])[/color][/b]
          ea [b][color=NAVY]([/color][/b]angle cn c1[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

  [b][color=FUCHSIA]([/color][/b]entmake [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 0 [color=#2f4f4f]"ARC"[/color][b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]cons 10 cn[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]cons 40 ra[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]cons 50 sa[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b]cons 51 ea[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[b][color=BLACK]([/color][/b]defun LM:Clockwise-p [b][color=FUCHSIA]([/color][/b] p1 p2 p3 [b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]< [b][color=NAVY]([/color][/b]* [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]car  p2[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]car  p1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]cadr p3[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cadr p1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]* [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]cadr p2[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cadr p1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]- [b][color=GREEN]([/color][/b]car  p3[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]car  p1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]


[color=#8b4513];************ TEST BED ***************************************[/color]
[b][color=BLACK]([/color][/b]defun c:f3p [b][color=FUCHSIA]([/color][/b]/ ra p1 p2 p3[b][color=FUCHSIA])[/color][/b]

   [b][color=FUCHSIA]([/color][/b]initget 7[b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]setq ra [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nFillet Radius:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

   [b][color=FUCHSIA]([/color][/b]princ [color=#2f4f4f]"\nSelect 3 CCW Pts:   "[/color][b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]setq p1 [b][color=NAVY]([/color][/b]getpoint [color=#2f4f4f]"\nStart Pt - P1:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]setq p2 [b][color=NAVY]([/color][/b]getpoint p1 [color=#2f4f4f]"\nVertex Pt - P2:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]grdraw p1 p2 1 3[b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]setq p3 [b][color=NAVY]([/color][/b]getpoint p2 [color=#2f4f4f]"\nEnd Pt - P3:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
   [b][color=FUCHSIA]([/color][/b]grdraw p2 p3 2 3[b][color=FUCHSIA])[/color][/b]

   [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]LM:Clockwise-p p1 p2 p3[b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]alert [color=#2f4f4f]"Ponts Are Not CCW"[/color][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]f3p_fil3p [b][color=MAROON]([/color][/b]list p1 p2 p3[b][color=MAROON])[/color][/b] ra[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

Lee had a lot to do with this a while ago on another subject.

 

-David

Posted

Since the lines are being created by specifying the points from the initial selection point, how about inserting code using the points already created? If you set the fillet radius first, you could do something like this:

 

(setq rad1 (getreal "\nEnter Fillet Radius: "))

(setvar "FILLETRAD" rad1)

(command "._fillet" (list (+ (car t2) (- 38 rad1)) (cadr t2)) (list (car t3)(- (cadr t3) rad1)))

To get this to work consistently I had to turn off OSNAPS before drawing the lines and fillet.

Posted
You could use a window option and pick the two lines or a "F" fence option both of these return the two lines or search here for my auto fillet routine that uses F123.45 and auto runs the fillet command for a given radius.

 

BIGAL, could you give a link for this fillet with fence option?

Posted

Drag a diagonal across the two line using ssget "f" it's still 2 picks but lots of room for error. Returns the 2 objects or more. Handy when you want a pick 1st as a implied 1st crossing object.

 

As I mentioned on other post out of Internet access but will post multi lines fillet as many as you like. Just drag using 3 points across the 2 sets of multi lines.

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