Kenter Posted July 21, 2010 Share Posted July 21, 2010 I made a polyline in LISP and want to add to the program so it will automatically fillet that polyline without asking the user to click on the one they want. I know you can use ssget, and have it aquire the last object made or something like that. And i know the fillet will hit every corner on the polyline as soon as you click the polyline. I am unsure how to do it though. I looked at the help and it didn't clear it up for me. I have a few polylines on the page so a select all wont work. Any idea's welcome. Quote Link to comment Share on other sites More sharing options...
jammie Posted July 21, 2010 Share Posted July 21, 2010 Hi Is it a constant radius at each corner? Also is it at each corner that needs a fillet? Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 21, 2010 Share Posted July 21, 2010 You should really post your code, to remove all confusion. So, you are wanting to draw an LWPolyline and have each vertex filleted with a specified radius or are you wanting to fillet a drawn LWPolyline with something else? Quote Link to comment Share on other sites More sharing options...
Kenter Posted July 21, 2010 Author Share Posted July 21, 2010 I have a very long code. However all I need is a way to fillet a polyline I have already created using LISP. All the corners will have a 0.03 fillet. Here is the code to take a look. You must have two layers created 'plate' 'x-laser' or else nothing will happen. It makes one piece off to the right side which is a wall mount and only the polyline outside and two inner boxes will be filleted.BoxPlate90.LSP Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 21, 2010 Share Posted July 21, 2010 Here, I did this as an example, so you can follow suite from it. (defun c:PF (/ pt eLast ent) ;; Alan J. Thompson, 07.21.10 (setvar 'filletrad (cond ((getdist (strcat "\nSpecify fillet radius <" (rtos (getvar 'filletrad)) ">: "))) ((getvar 'filletrad)) ) ) (if (setq pt (getpoint "\nSpecify start point: ")) (progn (setq eLast (entlast)) (command "_.pline" "_non" pt) (while (= 1 (logand (getvar 'cmdactive) 1)) (princ "\nSpecify next point: ") (command PAUSE) ) (or (equal eLast (setq ent (entlast))) (command "_.fillet" "_P" ent) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
jammie Posted July 21, 2010 Share Posted July 21, 2010 (setvar 'filletrad (cond ((getdist (strcat "\nSpecify fillet radius <" (rtos (getvar 'filletrad)) ">: "))) ((getvar 'filletrad)) ) ) Nice coding! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2010 Share Posted July 21, 2010 How do you make a Layer current since that it isn't in a drawing, I maen you should make a Layer first and automatically would be set to current. (setvar 'clayer "x-laser") (setvar 'clayer "plate") "_.-layer" So where is the area that you want to fillet? Tharwat Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 21, 2010 Share Posted July 21, 2010 How do you make a Layer current since that it isn't in a drawing, I maen you should make a Layer first and automatically wouldbe set to current. (setvar 'clayer "x-laser") (setvar 'clayer "plate") "_.-layer" So where is the area that you want to fillet? Tharwat Excellent point. Also, know that if a layer is frozen and you try and set it as current with setvar 'clayer or vla-put-activelayer, it will crash. Always use -layer and thaw the layer before setting as current or vla-put-freeze x :vlax-false before setting a layer as current. I would also check. (if (tblsearch "LAYER" "BLAH") thaw and set layer as current create layer ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2010 Share Posted July 21, 2010 Excellent point. Thanks Alanjt. And here is many more. ) [color="red"](BPReset) ) (defun BPReset () (setvar 'plinewid plw) (setvar 'osmode osm) (setvar 'blipmode blipm) (setvar 'clayer curlay) (command "_.undo" "_end") (setvar 'cmdecho cmde) ) [/color] ; end defun (setq cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.undo" "_begin") (setq osm (getvar 'osmode)) (setvar 'osmode 0) (setq blipm (getvar 'blipmode)) (setqcurlay (getvar 'clayer) plw (getvar 'plinewid) The defun of functions must be called after getting the values of Sys Vars, just to let the defun get a value for each SETVAR's. And if you wanted to turn specific Sys Vars off first, so you can bring them out of the routine codes and just include the name of the defun at your favourite place. Regards Tharwat Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 21, 2010 Share Posted July 21, 2010 (setqcurlay (getvar 'clayer)You might want to fix this. I also don't see the point in making this into a subroutine. Just save variables before and reset them at appropriate time. Quote Link to comment Share on other sites More sharing options...
Kenter Posted July 22, 2010 Author Share Posted July 22, 2010 Thank you all, I have gone through and made changes from you suggestions. Figured out the fillet thing as well. (command "_.fillet" "_r" 0.03 "_.fillet" "_polyline" b1 "_.fillet" "_polyline" b2 "_.fillet" "_polyline" b6 "_.fillet" "_polyline" b9 "_.fillet" "_polyline" (mapcar '+ pLL (list 10.941 2.5 0)) "_.fillet" "_polyline" (mapcar '+ pUL (list 10.941 -2.5 0)) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 22, 2010 Share Posted July 22, 2010 Thank you all, I have gone through and made changes from you suggestions. Figured out the fillet thing as well. (command "_.fillet" "_r" 0.03 "_.fillet" "_polyline" b1 "_.fillet" "_polyline" b2 "_.fillet" "_polyline" b6 "_.fillet" "_polyline" b9 "_.fillet" "_polyline" (mapcar '+ pLL (list 10.941 2.5 0)) "_.fillet" "_polyline" (mapcar '+ pUL (list 10.941 -2.5 0)) ) Good deal. Quote Link to comment Share on other sites More sharing options...
萬里独行 Posted November 14, 2014 Share Posted November 14, 2014 Dear all! Please help me! (defun fb (r1 r2 b) .... ) Requirements content are described in Figure Link: https://drive.google.com/file/d/0B4IWlz7EzcZLa3Z0X2hCWGh5bWc/view?usp=sharing Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 14, 2014 Share Posted November 14, 2014 (edited) Dear all! Please help me! (defun fb (r1 r2 b) .... ) hi 萬里独行 welcome to forum please understand we are volunteers so don't expect too high 1.not working well if close polyline. (tips: dxf 70) 2.error if offset too sharp 3.only standard fillet & radius applied so you can study, modify etc.. hope better than nothing ;fop.lsp :fillet open polyline (defun c:fop (/ *error* r e d) ;hanhphuc 2014 (defun *error* (msg) (if msg (princ "\n*cancel*"))) (if (and (not (initget 5)) (setq r (getdist "\nRadius : ")) (not (initget 7)) (setq d (getdist "\nWidth : ")) (setq e (entsel "\nSelect Polyline.. ")) (setq e (car e)) (=(cdr(assoc 0 (entget e)))"LWPOLYLINE") (vl-cmdf "_fillet" "P" e) (setq e (vlax-ename->vla-object e)) ) ;_ end of and (foreach x '("StartPoint" "EndPoint") (entmakex (vl-list* '(0 . "LINE") (cons 8 (vla-get-layer e)) (mapcar 'cons '(10 11) (mapcar '(lambda (o) ((eval (read (strcat "vlax-curve-get" x))) o)) (apply 'append (mapcar ''((x) (vlax-invoke e 'Offset (x (* d 0.5)))) (list + -))) ) ;_ end of mapcar ) ;_ end of mapcar ) ;_ end of vl-list* ) ;_ end of entmakex ) ;_ end of foreach (princ "\nsorry..") ) ;_ end of if (princ) ) Edited November 14, 2014 by hanhphuc Method applicable filter can be ignored Quote Link to comment Share on other sites More sharing options...
萬里独行 Posted November 14, 2014 Share Posted November 14, 2014 hi 萬里独行 welcome to forum please understand we help volunteer so don't expect too high 1.not working well if close polyline. (tips: dxf 70) 2.error if offset too sharp 3.only standard fillet & radius applied so you can study, modify etc.. hope better than nothing Thank you so much! But... Fillet polyline with 2 radius: R1 and R2 + R1 for END + R2 for MID Please! Sorry! My English skills so poor! Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 14, 2014 Share Posted November 14, 2014 (edited) Thank you so much! But... Fillet polyline with 2 radius: R1 and R2 + R1 for END + R2 for MID Please! Sorry! My English skills so poor! It means you have just 2 numbers of R1, why can be done manually?? use FOP.lsp for R2 in MID. If fully automated you need to write single fillet function. but wish i could have more free time here is some useful polyline tools HTH Edited November 14, 2014 by hanhphuc add reference link Quote Link to comment Share on other sites More sharing options...
萬里独行 Posted November 17, 2014 Share Posted November 17, 2014 Was available: 1. Open polyline. 2. Layer Boundaries. Input: R1, R2 and B 1. R1 is fillet radius for begin & end vertices. 2. R2 is fillet radius for between the remaining vertices 3. B is width of boundaries. Requirements: Boundaries is a polyline in layer “Boundaries” (was available) (*) Detailed description in attach file. Pline.dwg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.