Sandeep RC Posted September 27, 2021 Posted September 27, 2021 can anybody provide me the lisp for generating closed polyline boundary at an specified offset around the network of polylines as shown? (the actual set of polylines is very complex so i need a help please) Quote
zwonko Posted September 27, 2021 Posted September 27, 2021 (edited) Maybe use polyline global width and Lee mac polyoutline lsp http://www.lee-mac.com/advpolyoutline.html http://www.lee-mac.com/polyoutline.html Edited September 27, 2021 by zwonko 1 Quote
Sandeep RC Posted September 27, 2021 Author Posted September 27, 2021 thanks for the reply, but i already had those lisp, it gives me following output as shown is red, but i need only one outer closed boundary as shown in green, can you please help me with that? These are just couple of polylines, my actual network is really complex, ( example : just like centerlines of all the roads nearby your area where you live) Quote
eldon Posted September 27, 2021 Posted September 27, 2021 Now you just need to use Lee-Mac's Outline Object lisp and your task will be complete. 1 Quote
Sandeep RC Posted September 28, 2021 Author Posted September 28, 2021 i did that exactly but my network is fairly complex it is causing problems by this method. im attaching file here, can you please go through and check for yourself once? OUTPUT.dwg Quote
BIGAL Posted September 28, 2021 Posted September 28, 2021 (edited) Something I have been playing with, one way to union all the offsets is to do just that, then extrude all plines say 5, union the plines this will clean them up and do all the intersections, you explode the solids so get regions need to remove all regions that are not Z=zero, so then erase ss, only thing is you will be left with lines. Try this, worked on sample I need to add remove duplicates tomorrow. Also I am sure speed can be way better. ; https://www.cadtutor.net/forum/topic/73767-lisp-for-closed-boundary-with-offset-around-polyline/ ; road boundary from cl ; By AlanH consulting info@alanh.com.au sep 2021 (defun c:wow ( / ss off obj obj2 ent ent2 ent3 end1 end2 st1 st2 z) (command "-layer" "m" "offs" "c" 1 "offs" "M" "offs2" "C" 2 "offs2" "s" "offs" "") (setq ss (ssget '((0 . "LWPOLYLINE")))) (setq off (Getdist "Enter offset")) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (vla-offset obj off) (setq ent1 (entlast)) (setq obj2 (vlax-ename->vla-object (entlast))) (setq st1 (vlax-curve-getstartpoint obj2)) (setq end1 (vlax-curve-getendpoint obj2)) (vla-offset obj (- off)) (setq ent2 (entlast)) (setq obj2 (vlax-ename->vla-object (entlast))) (setq st2 (vlax-curve-getstartpoint obj2)) (setq end2 (vlax-curve-getendpoint obj2)) (command "line" end2 end1 "") (setq ent3 (entlast)) (command "line" st1 st2 "") (command "pedit" (entlast) "Y" "J" ent1 ent2 ent3 "") (command "chprop" (entlast) "" "layer" "offs" "") ) (setq ss (ssget "X" '((0 . "LWPOLYLINE")(8 . "offs")))) (command "extrude" ss "" 5) (command "union" (ssget "X" '((0 . "3DSOLID")(8 . "offs"))) "") (command "chprop" (entlast) "" "layer" "offs2" "") (command "layiso" (entlast) "") (command "explode" (entlast)) (command "explode" (ssget "X" '((0 . "REGION")(8 . "offs2")))) (setq ss (ssget "X" '((0 . "LINE")(8 . "offs2")))) (repeat (setq x (sslength ss)) (setq ent (ssname ss (setq x (- x 1)))) (setq Z (nth 2 (cdr (assoc 10 (entget ent))))) (if (> z 0.0)(command "erase" ent "")) ) (command "layuniso") (princ) ) Edited September 28, 2021 by BIGAL Quote
Sandeep RC Posted September 28, 2021 Author Posted September 28, 2021 JUST TRIED THIS. IT WORKS FOR SINGLE PLINE SEGMENT. PLEASE SEE IF IT CAN CREATE CLOSED OUTER BOUNDARY FOR ENTIRE NETWORK, MEAN WHILE IM ALSO SEACHING IF I CAN FIND ANY ALTERNATE SOLUTION. THANK YOU. Quote
zwonko Posted September 28, 2021 Posted September 28, 2021 9 hours ago, Sandeep RC said: i did that exactly but my network is fairly complex it is causing problems by this method. im attaching file here, can you please go through and check for yourself once? OUTPUT.dwg 394.4 kB · 4 downloads Did You tryied this one after polyout? http://www.lee-mac.com/outlineobjects.html IT is what eldon is saying about. Quote
lido Posted September 28, 2021 Posted September 28, 2021 5 hours ago, zwonko said: Did You tryied this one after polyout? http://www.lee-mac.com/outlineobjects.html IT is what eldon is saying about. Of course, there are more "elegant" solutions by using VLisp, but here I used some of BIGAL's code and got the attached drawing. So, try this: ;;Offset selected polylines (defun C:OFFPOL (/ *error* cm do of obj1 obj2 ent1 ent2 ent3 end1 end2 pe st1 st2 s1 s2 s3 xx) (defun *error* (s) (or (wcmatch (strcase s) "*BREAK,*CANCEL*,*EXIT*") (prompt (strcat "\nError: " s))) (setvar "CMDECHO" cm) (setvar "DELOBJ" do) (setvar "PEDITACCEPT" pe) (princ) ) ;;*error* (setq cm (getvar "CMDECHO") do (getvar "DELOBJ") pe (getvar "PEDITACCEPT") s1 (ssget (quote ((0 . "LWPOLYLINE")))) ) (setvar "CMDECHO" 0) (setvar "DELOBJ" 1) (setvar "PEDITACCEPT" 1) (if s1 (progn (if (not (tblsearch "LAYER" "Offs")) (command "-LAYER" "_M" "Offs" "_C" 1 "Offs" "")) (setq of (getdist "Enter offset: ")) (if of (progn (repeat (setq xx (sslength s1)) (setq obj1 (vlax-ename->vla-object (ssname s1 (setq xx (1- xx))))) (vla-offset obj1 of) (setq ent1 (entlast) obj2 (vlax-ename->vla-object ent1) st1 (vlax-curve-getstartpoint obj2) end1 (vlax-curve-getendpoint obj2) ) (vla-offset obj1 (- of)) (setq ent2 (entlast) obj2 (vlax-ename->vla-object ent2) st2 (vlax-curve-getstartpoint obj2) end2 (vlax-curve-getendpoint obj2) ) (command "line" end2 end1 "") (setq ent3 (entlast)) (command "_.LINE" st1 st2 "" "_.PEDIT" (entlast) "_J" ent1 ent2 ent3 "" "_C" "" ) ) (setq s2 (ssget "_X" (quote ((0 . "LWPOLYLINE") (8 . "Offs")))) s3 (ssadd) ) (while (< xx (sslength s2)) (command "_.REGION" (ssname s2 xx) "") (ssadd (entlast) s3) (setq xx (1+ xx)) ) (command "_.UNION" s3 "" "_.EXPLODE" (entlast) ) ) ) ) ) (setvar "CMDECHO" cm) (setvar "DELOBJ" do) (setvar "PEDITACCEPT" pe) (princ) ) ;;OFFPOL OUTPUT (1).dwg 1 Quote
ronjonp Posted September 28, 2021 Posted September 28, 2021 (edited) Here's another output using Lee's advanced outline along with overkill region and union ( similar to above ). OUTPUT-rjp.dwg Edited September 28, 2021 by ronjonp Quote
Sandeep RC Posted September 29, 2021 Author Posted September 29, 2021 (edited) "OFFPOL" WORKED LIKE A CHARM, THAT IS EXACTLY WHAT I NEEDED, THANK YOU FOR YOUR EFFORTS AND TIME. YOU GUYS ARE AWESOME. (ELDON, BIGAL, ZWONKO, LIDO, RONJONP) Edited September 29, 2021 by Sandeep RC 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.