cabltv1 Posted July 16, 2009 Posted July 16, 2009 Please help! I need to insert a block (Any Name) onto a Polyline then have the Polyline inside of the block removed. Before After Thanks in advance for any help. Quote
The Buzzard Posted July 16, 2009 Posted July 16, 2009 Please help!I need to insert a block (Any Name) onto a Polyline then have the Polyline inside of the block removed. Before After Thanks in advance for any help. Check out this link: http://www.afralisp.net/lispa/lisp52.htm Quote
Lee Mac Posted July 16, 2009 Posted July 16, 2009 There are many ways to accomplish this. Even on AfraLISP, they mention an "autobreaking block", using invisible attributes. http://www.afralisp.net/lispa/lisp52.htm But, you can do it just using the "BREAK" function within AutoCAD, providing you know the length of the block you are inserting. (It can be done without knowing the length, but this involves a few more VL methods...). Lee EDIT: Buzzard beat me to it with the link... Quote
The Buzzard Posted July 16, 2009 Posted July 16, 2009 There are many ways to accomplish this. Even on AfraLISP, they mention an "autobreaking block", using invisible attributes. http://www.afralisp.net/lispa/lisp52.htm But, you can do it just using the "BREAK" function within AutoCAD, providing you know the length of the block you are inserting. (It can be done without knowing the length, but this involves a few more VL methods...). Lee EDIT: Buzzard beat me to it with the link... Well than give him the VL treatment. You know I will not go there. Quote
Lee Mac Posted July 16, 2009 Posted July 16, 2009 Well than give him the VL treatment.You know I will not go there. Its so much more powerful though - you should really dip your feet in - you won't want to go back :wink: Quote
The Buzzard Posted July 16, 2009 Posted July 16, 2009 Its so much more powerful though - you should really dip your feet in - you won't want to go back :wink: So is a good hot cup of sumatra, But you could burn yourself. Quote
cabltv1 Posted July 16, 2009 Author Posted July 16, 2009 Thanks for the quick response Buzzard and Lee. My fault on the confussion as I was not clear with the original post. I would like the Pline/Line to break on both sides of the Block and erase automatically, without user input. Is this possible? Quote
Lee Mac Posted July 16, 2009 Posted July 16, 2009 Certainly, check the link we provided - that method should work to break both sides of the block. If you however don't want to go down that route, I am happy to help you accomplish this a different way Quote
cabltv1 Posted July 16, 2009 Author Posted July 16, 2009 Lee. If you have the time, I would very much like for you to try it. Quote
The Buzzard Posted July 17, 2009 Posted July 17, 2009 Thanks for the quick response Buzzard and Lee.My fault on the confussion as I was not clear with the original post. I would like the Pline/Line to break on both sides of the Block and erase automatically, without user input. Is this possible? A block by itself will not break the line without the help of the lisp. Attributes shown in that tutorial are to provide the coordinates to so that the lisp will know where to break the line. The block has no magical powers without the lisp. There may be a different way to go about it, But not without a program. The tutorial given is very easy to follow if you are willing learn. If you want a program written for you, Someone else may be willing to do it for you although there is no guarantee. The ability to learn how do these things for yourself is invaluable. Quote
Lee Mac Posted July 17, 2009 Posted July 17, 2009 Lee.If you have the time, I would very much like for you to try it. Are you not willing to have a stab at it yourself first? Quote
cabltv1 Posted July 17, 2009 Author Posted July 17, 2009 I have some code that will Break/Erase Pline by selecting outer edge of block but would prefer to skip selecting the block and do it automaticaly. I can't remeber where I picked up the code (possibly on this site). I tried modifying the code without success. Code: (defun dtr (a) ; Degrees to Radians (* pi (/ a 180.0))) (defun rtd (a) ; Radians to Degrees (/ (* a 180.0) pi)) (defun find_attr1 () ; Subroutine to find a few attributes of selected object (setq pt6 (cadr lin)) (setq lim (car lin)) (setq lin1 (entget lim)) (setq lin2 (cdr (assoc 2 lin1))) (setq att8 (cdr (assoc 8 lin1))) (setq lin10 (cdr (assoc 10 lin1))) (if (= nil (cdr (assoc 50 lin1)))(funky1)) (if (/= nil (cdr (assoc 50 lin1)))(setq ang1 (rtd (setq lin50 (cdr (assoc 50 lin1))))))) (defun poleped_box () ; Subroutine trimpoleped to clean lines from pole or other wblock (setq f1 (polar lin10 lin50 (* q_scale id_scale distemp))) (setq f3 (polar lin10 (+ lin50 pi) (* q_scale id_scale distemp))) (setq p1 (polar f1 (dtr (+ 90 ang1)) (* q_scale id_scale distemp))) (setq p2 (polar f1 (dtr (+ 270 ang1)) (* q_scale id_scale distemp))) (setq p3 (polar f3 (dtr (+ 90 ang1)) (* q_scale id_scale distemp))) (setq p4 (polar f3 (dtr (+ 270 ang1)) (* q_scale id_scale distemp)))) (defun poleped_box2 () ; Subroutine trimpoleped to clean lines from pole or other wblock (setq distemp 5) (poleped_box) (setvar "CLAYER" "0") (command "layer" "f" att8 "") (command "pline" p1 "w" "0" "0" p2 p4 p3 "c") (setq ce (ssget "L")) (setq distemp 4) (poleped_box) (setvar "CLAYER" "0") (command "layer" "f" att8 "") (command "trim" ce "" "f" p1 p2 p4 p3 "" "") (command "layer" "t" att8 "") (command "ERASE" (ssname ce 0) "") (command "")) ;====Below is for triming Poles====== (defun trimpole () ; Routine to clean lines from pole or ped (note: runs twice) (setq id_scale 1) (setq q_scale 12) (princ "\nZoom in to Pole/Ped ") (command "zoom" "w" pause pause "") (setq lin (entsel "Pick outer edge of Pole/Ped"))(terpri) (find_attr1) (poleped_box2) (command "zoom" "p") (command "-pan") (setq lin50 (+ lin50 hp)) (poleped_box2)) ;====End trim========= Quote
The Buzzard Posted July 17, 2009 Posted July 17, 2009 The code in the tutorial will do it automatically. Quote
cabltv1 Posted July 17, 2009 Author Posted July 17, 2009 Thanks for the reply Buzzrd. I did try the Afro Lisp code and it works fine but I am working with blocks supplied to me and I am not allowed to modify them. That is why I am looking for other options. Quote
The Buzzard Posted July 17, 2009 Posted July 17, 2009 Thanks for the reply Buzzrd.I did try the Afro Lisp code and it works fine but I am working with blocks supplied to me and I am not allowed to modify them. That is why I am looking for other options. I am not exactly sure if there can be another way to do that. It may be possible to assign a coordinate along given points on the block. The same code I would think can still apply, But would have to be modified a bit different. The method described on Afralisp would be a much easier method. Give it a while and see what happens. Maybe someone else will produce something you might find more suitable. Quote
Lee Mac Posted July 17, 2009 Posted July 17, 2009 There is definitely other ways to accomplish this - I personally don't like using the AfraLISP method - as it involves modifiying the original block. But, if you know the dimensions of the block, then you can easily create a LISP to do the breaking for you - automatically. The LISP will need to involves a set of commands to insert the block, and also to know where on the line to insert it. The LISP will need to know the angle of the line, and the dimensions of the block, so that the break points can be determined. Then, its just a case of using the BREAK command. Hopefully this will get you started. Lee Quote
The Buzzard Posted July 17, 2009 Posted July 17, 2009 Thanks for the reply Buzzrd.I did try the Afro Lisp code and it works fine but I am working with blocks supplied to me and I am not allowed to modify them. That is why I am looking for other options. Here is a Visual Lisp method by Tony Hotchkiss and it does not require attributes. pvsymbols.zip Quote
Lee Mac Posted July 17, 2009 Posted July 17, 2009 I don't think that's VL Buzzard But, it uses the same idea that I was explaining in my post above. Quote
The Buzzard Posted July 17, 2009 Posted July 17, 2009 I don't think that's VL Buzzard But, it uses the same idea that I was explaining in my post above. It just uses this one VL line: (setq pos (vl-position bnam block-list)) In any case, Attributes are not required in this program. That was one of cabltv's concerns since he is not allowed to modify his blocks. Just thought I would put this out there all the same. Quote
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.