Jump to content

Fillet Lisp


Scoutr4
 Share

Recommended Posts

Posted (edited)

Hi everyone,

I'm trying to write a fillet lisp.

(defun C:denx ()
  (setq p1 (ssget))
  (setq p2 (ssget))
  (setq p3 (ssget))
  (command "_.fillet" p1 p2 "_.fillet" p1 p3)
  (princ)
)

- make a list of the two lines I chose that I'm trying to do

- I dont know how doing list. Can anyone help this?

(defun C:denx ()
  (setq p1 (ssget))
  (setq p2 (ssget)); list of lines
  (command "_.fillet" p1 p2)
  (princ)
)

 

example.PNG

Edited by Scoutr4
Link to comment
Share on other sites

Posted (edited)

Try this, ok expects main line as a single "LINE" Pick 90 line well away from fillet size. Does what you want limited testing.

 

; do 2 fillets to a tee line intersection
; By Alanh May 2022

(defun c:2fil ( )
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setvar 'filletrad (getreal "\nEnter radius"))
(setq ent1 (entsel "\npick square off line away from intersection "))
(setq pt1 (cadr ent1))
(setq ent2 (entsel "\npick main line"))
(setq obj1 (vlax-ename->vla-object (car ent1)))
(setq obj2 (vlax-ename->vla-object (car ent2)))
(setq pt2 (vlax-invoke obj1 'intersectwith obj2 acExtendBoth))
(setq start (vlax-get Obj2 'StartPoint))
(setq end (vlax-get Obj2 'EndPoint))
(setq pt3 (polar pt2 (angle start end) 0.05))
(setq pt4 (polar pt2 (- (angle start end) pi) 0.05))
(command "break" pt3 pt2)
(setq ent3 (entlast))
(command "fillet" pt1 ent2)
(command "fillet" pt1 ent3)
(setvar 'osmode oldsnap)
)
(c:2fil)

 

Edited by BIGAL
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)
11 hours ago, BIGAL said:

Try this, ok expects main line as a single "LINE" Pick 90 line well away from fillet size. Does what you want limited testing.

 

; do 2 fillets to a tee line intersection
; By Alanh May 2022

(defun c:2fil ( )
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setvar 'filletrad (getreal "\nEnter radius"))
(setq ent1 (entsel "\npick square off line away from intersection "))
(setq pt1 (cadr ent1))
(setq ent2 (entsel "\npick main line"))
(setq obj1 (vlax-ename->vla-object (car ent1)))
(setq obj2 (vlax-ename->vla-object (car ent2)))
(setq pt2 (vlax-invoke obj1 'intersectwith obj2 acExtendBoth))
(setq start (vlax-get Obj2 'StartPoint))
(setq end (vlax-get Obj2 'EndPoint))
(setq pt3 (polar pt2 (angle start end) 0.05))
(setq pt4 (polar pt2 (- (angle start end) pi) 0.05))
(command "break" pt3 pt2)
(setq ent3 (entlast))
(command "fillet" pt1 ent2)
(command "fillet" pt1 ent3)
(setvar 'osmode oldsnap)
)
(c:2fil)

 

Thank you so much but i found a problem. This autocad's normal starting.(1st photo)

After clicking on the option to load the lisp file continuously from the Appload menu, I closed the Autocad program and reopened it. It is waiting in the "startup-load" menu when opening Autocad. When I press ESC, autocad completes the opening process. (2nd and 3rd photos)

 

 

normal.PNG

start.PNG

start1.PNG

Edited by Scoutr4
Link to comment
Share on other sites

Why repeat load just appload once, to do again type 2fil. Thats what the C:2fil means its a command now just run on 1st load. 

  • Agree 1
Link to comment
Share on other sites

Okay. I draw electrical installation projects. I'm currently using over 15 lisp files. I open at least 30 or 40 dwg files every day. If I upload all the files once, I always have to do this again when I open the dwg. 

As soon as it was installed from the Appload menu, the command was working and was asking for the radius even though I didn't enter the command. 

so it probably loads the command when autocad starts and asks me to enter the radius during "startup load" and autocad program fails to start. I deleted the last row and this problem solved. Thank you again.🙂

Link to comment
Share on other sites

Posted (edited)

Glad you realised remove last line (c:2fil) if your autoloading. I set up most of my lisps as menu or toolbar load.

 

image.png.0d5da66e09d4d34948c707a1b2d2a8d1.png

 

Ok you should look at AUTOLOAD in your start up it will load the lisp file when you type the command so you don't have 30-40 lisps already loaded. For me lisps are in search path so name only of lisp. eg PLACESDXF.lsp

 

(autoload "TEXT2LINE" '("TEXT2LINE"))
(autoload "EXLMARK" '("EXLMARK"))
(autoload "MoveRotateText" '("MOVEROTATETEXT"))
(autoload "PLACESDXF" '("PLACESDXF"))
(autoload "PLANVIEW" '("PLANVIEW"))
(autoload "p2p" '("p2p"))
(autoload "p2pp" '("p2pp"))
(autoload "sqp" '("sqp"))
(autoload "sqlinetoend" '("sql"))
(autoload "REV" '("REV"))

 

Edited by BIGAL
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
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.

 Share

×
×
  • Create New...