Jump to content

Fillet Not Working...


Lee Mac

Recommended Posts

This is an extension of my previous post, however I thought it may be best in a new thread.

 

I have tried to create a LISP to fillet pairs of lines, using the code shown below:

 

(defun flangeelevfillet ()
   (command "_fillet"
       "R"
       "2"
       a6
       a8
   ) 
   (command "_fillet"
       "R"
       "2"
       a7
       a9
   ) 
   (command "_fillet"
       "R"
       "2"
       a8
       a10
   ) 
   (command "_fillet"
       "R"
       "2"
       a9
       a11
   ) 
   (command "_fillet"
       "R"
       "2"
       a10
       a12
   ) 
   (command "_fillet"
       "R"
       "2"
       a11
       a12
   ) 
   (command "regenall")
)

 

However, when using this code within another LISP program (where the variables a1, a2 etc are line entities set using the entlast script) the lines are not filleted and the command box just displays an entity name.... I cannot see what I am doing wrong.... hopefully a new set of eyes may spot something I've missed. :wink:

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    12

  • CAB

    7

  • Strix

    2

Top Posters In This Topic

CAB, would I be able to create such a thing if I know a point on the line and use the 'cons' syntax, ie.

 

(defun constest ()
   (setq b1
         (cons a1 pt1)
   ) ; end setq
) ; end program

 

where b1 is the ename and point (like in entsel) and a1 is the entity with pt1 as a point on the line...

Link to comment
Share on other sites

Yes.

    (command "_fillet"
       "R"
       "2"
       (cons a6 p6)
       (cons a8 p8)
   ) 

 

Note that osmode can cause problems with commands using points. It should be set OFF during the command.

Link to comment
Share on other sites

I have used the entsel format method and have tried with a point at the end of the line to be filleted and also mid-way along the line (in case it was the endpoint causing the problems)... both with osmode set to 0.

 

I have used !b1 to check the value of my variable with this result:

 

Command: !b1
(<Entity name: 7ed12f40> 1092.59 287.969 0.0)

 

and so I know that the variable has been set properly.

 

after the LISP completed its routine, I tried to fillet the lines myself and was successful, so why on earth can the LISP not do it!!! :x

Link to comment
Share on other sites

I have used the code shown below:

 

 
(defun flangeelevfillet ()
(command "_fillet"
 "R"
 "2"
 (setq b1
  (list a6
   flgotppt
  ) ; end list
 ) ; end setq
 (setq b2
  (list  a8
   flgoltppt
  ) ; end list
 ) ; end setq
) ; end fillet
(command "_fillet"
 "R"
 "2"
 (setq b3
  (list
   a7 
   flgobtpt
  ) ; end list
 ) ; end setq
 (setq b4
  (list
   a9
   flgolbtpt
  ) ; end list
 ) ; end setq
) ; end fillet
) ; end program

 

with no luck in filleting... and when checking the value of b1, I get this:

 

 
Command: !b1
(<Entity name: 7e88fdf0> (331.409 328.982 0.0))

Link to comment
Share on other sites

Note that your fillet command exits after the setting of radius, therefore the command as written doesn't work.

This is wrong:

 (command "_fillet"  "R"  "2"
 (setq b1 (list a6 flgotppt))
 (setq b2 (list a8 flgoltppt))
) ; end fillet 

This is correct:

 (command "_.fillet"  "R"  "2"
 "_.fillet" ; <---<<  command must be stated again
 (setq b1 (list a6 flgotppt))
 (setq b2 (list a8 flgoltppt))
) ; end fillet

 

Try this test routine using another way to set the radius:

(defun c:test (/ usrosm e1 e2)
 (setq usrosm (getvar "osmode"))
 (and
   (setq e1 (entsel "\nSelect the first line to fillet."))
   (setq e2 (entsel "\nSelect the second line to fillet."))
   (setvar "osmode" 0)
   (setq usrrad (getvar "osmode"))
   (setvar "filletrad" 2)
   (command "_.fillet" e1 e2)
 )
 (and usrrad (setvar "osmode" usrrad))
 (and usrosm (setvar "osmode" usrosm))
 (princ)
) 

 

 

Then try this routine:

(defun c:test (/ usrosm e1 e2 p1 rad)
 (setq rad 2.0)
 (setq usrosm (getvar "osmode"))
 (and
   (setq p1 (getpoint "\nPick a test point for fillet."))
   (setq e1 (entmakex (list (cons 0 "LINE")
              (cons 8 "0") ; layer
              (cons 10 p1) ; start point
              (cons 11 (polar p1 pi 100)) ; end point
              ))) 
   (setq e2 (entmakex (list (cons 0 "LINE")
              (cons 8 "0") ; layer
              (cons 10 p1) ; start point
              (cons 11 (polar p1 (* pi 1.5) 100)) ; end point
              ))) 
   (setvar "osmode" 0)
   (setq usrrad (getvar "osmode"))
   (setvar "filletrad" rad)
   (command "_.fillet"
            (list e1 (polar p1 pi rad))
            (list e2 (polar p1 (* pi 1.5) rad)))
 )
 (and usrrad (setvar "osmode" usrrad))
 (and usrosm (setvar "osmode" usrosm))
 (princ)
) 

Link to comment
Share on other sites

Thanks for those CAB, much appreciated - I may set the fillet radius using the (setvar "filletrad" 2) instead of trudging through the command using "R" and "2".

 

I have updated the LISP with your ideas and have tried to run it. Most of the lines are filleted, however when the LISP gets to some lines it says that the fillet radius is too large, when it clearly isn't

 

I have attached the LISP, (zipped as it is too large). I will understand if you dont want to go ploughing through it as it is pretty long, but some help on the 'fillet' program would be much appreciated. :)

PIPE & FLANGE DRAUGHTSMAN.zip

Link to comment
Share on other sites

The error "fillet radius is too large" is usually caused when the picked point is too close to the end of the line.

Most likely you are using the START or END of the line point. That is why in my sample routine I use

(polar pt (angle away from the end point) (distance of the radius))

to move the pick point away from the end of the line.

 

Does that help?

Link to comment
Share on other sites

CAB, you are absolutely right, I am using the start/endpoint of the line!

 

I have not yet tried it, but I am sure that will solve the problem.

 

Thanks ever so much. :)

Link to comment
Share on other sites

This works for me.

(defun c:test (/ usrosm e1 e2 p1 rad)
 (setq rad 2.0)
 (setq usrosm (getvar "osmode"))
 (and
   (setq p1 (getpoint "\nPick a test point for fillet."))
   (setq e1 (entmakex (list (cons 0 "LINE")
              (cons 8 "0") ; layer
              (cons 10 p1) ; start point
              (cons 11 (polar p1 pi 100)) ; end point
              ))) 
   (setq e2 (entmakex (list (cons 0 "LINE")
              (cons 8 "0") ; layer
              (cons 10 p1) ; start point
              (cons 11 (polar p1 (* pi 1.5) 100)) ; end point
              ))) 
   (setvar "osmode" 0)
   (setq usrrad (getvar "osmode"))
   (setvar "filletrad" rad)
   (vl-cmdf "_.fillet"
            (list e1 (polar p1 pi rad))
            (list e2 (polar p1 (* pi 1.5) rad)))
   (setq rent1 (entlast)) ; [b]this works[/b]
   (entdel rent1) ; [b]remove the entity as a test[/b]
 )
 (and usrrad (setvar "osmode" usrrad))
 (and usrosm (setvar "osmode" usrosm))
 (princ)
)

Link to comment
Share on other sites

Thanks CAB,

 

Just out of interest, I have a few queries....

 

1) (this may seem a little ignorant.. but I'm new to LISP) Why do you list your variables in the brackets after the (defun c:XXX ("here")... with a " / " ?

 

2) Why do you use the "vl-cmdf" instead of "command"?

 

Thanks once again for your help. :)

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