hokie555 Posted October 27, 2009 Posted October 27, 2009 In my plot style I have the "Line End Style" set to "Butt", and the "Line Join Style" set to "Round". The problem is that even though many of these lines touch at the same point, they are still not recognized by AutoCAD as being Joined since they were created separately. This results in a Butt end on each of the lines at the intersection point. Is there anything out there that will join all lines that share a common point, without having to manually join them one at a time? Thanks! Quote
JohnM Posted October 27, 2009 Posted October 27, 2009 Just line objects or plines also? You can use SSGET with the line polyline filter Then use the pedit command ;;; depending on what you want you can comment out the ssget function that does not apply (defun c:jln ( / ss) ;(setq ss (ssget "_X" '((0 . "LINE")(410 . "Model"))));_gets only lines ;(setq ss (ssget "_X" '((0 . "LWPOLYLINE")(410 . "Model")(70 . 0))));_gets only polylines (setq ss (ssget "_X" '( ( -4 . "<OR") ( -4 . "<AND") (0 . "LWPOLYLINE");(410 . "Model")(70 . 0) (-4 . "AND>") (-4 . "<AND") (0 . "LINE");(410 . "Model") (-4 . "AND>") ( -4 . "OR>") ) ) );_gets both pline and lines (command "pedit" "Multiple" "Previous" "" "Yes" "Join" "" "") (princ) );_defun Quote
CAB Posted October 28, 2009 Posted October 28, 2009 Another version: (defun c:jln ( / ss) (if (setq ss (ssget "_X" (list '(0 . "LINE,LWPOLYLINE")(cons 410 (getvar "ctab"))))); current space (command "pedit" "Multiple" ss "" "Yes" "Join" "" "") ) (princ) ) Quote
hokie555 Posted October 28, 2009 Author Posted October 28, 2009 That's great, thank you very much! Quote
hokie555 Posted October 29, 2009 Author Posted October 29, 2009 taking this one step further, I want to only join polylines that are on the same layer and have the same lineweight, so that the newly joined sections don't inheret the properties of the source polyline. I know i can create this using what I was given with each combination of layer and lineweight, but I imagine a loop would be a whole lot easier. Any assistance would be much appreciated. Quote
CAB Posted October 29, 2009 Posted October 29, 2009 No test for lineweight but add your layer name and the routine will select only that layer. Then it will set line width to zero. No testing so you must debug it. (defun c:jln ( / ss) (if (setq ss (ssget "_X" (list '(0 . "LINE,LWPOLYLINE") '(8 . "LayerName") (cons 410 (getvar "ctab"))))); current space (progn (command "pedit" "Multiple" ss "" "Yes" "Join" "" "") (setq elst (entget (entlast))) (entmod (subst '(43 0.0) (assoc 43 elst) elst)) ) ) (princ) ) Quote
hokie555 Posted October 29, 2009 Author Posted October 29, 2009 Thanks again CAB. I was thinking more of automatically performing the pedit command for each lineweight and for each layer, and also not changing any properties. I'm clearly not setting this loop up correctly, and possibly not using "cons" correctly, but this may help you better understand where I'm headed. (loop for lw in '(-2 -3 0 5 9 13 15 18 20 25 30 35 40 50 53 60 70 80 90 100 106 120 140 158 200 211) (loop for lyr in '("layer1" "layer2" "layer3") (setq ss1 (ssget "_X" '((0 . "LINE,LWPOLYLINE")(cons 8 lyr)(cons 370 lw)(410 . "Model")))) (if (/= ss1 nil) (command "pedit" "Multiple" ss1 "" "Join" "" "") (princ) ) ) Quote
CAB Posted October 29, 2009 Posted October 29, 2009 Try this: (not tested) You'll run into problems with LINES set to line weight ByLayer! (defun c:MyLisp (/ lyr lw ss1) (foreach lyr '("layer1" "layer2" "layer3") (foreach lw '(-2 -3 0 5 9 13 15 18 20 25 30 35 40 50 53 60 70 80 90 100 106 120 140 158 200 211) (setq ss1 (ssget "_X" (list '(0 . "LINE,LWPOLYLINE") (cons 8 lyr) (cons 370 lw) '(410 . "Model")))) (if ss1 (command "pedit" "Multiple" ss1 "" "Join" "" "") ) ) ) (princ) ) Quote
hokie555 Posted October 29, 2009 Author Posted October 29, 2009 thanks, that worked like a charm! didn't know this, but bylayer cooresponds to a "-1" in the list of lineweights so I added that. The problem I assume you are referring to is the program not combining two lines with the same lineweight value but a different setting (such as a line of 0.05mm and a line of bylayer when the layer is set to 0.05mm). I'm willing to overlook this instance. Thank you! 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.