Jump to content

Offset EXISTING polylines


mvr600

Recommended Posts

Hello,

 

I’m looking for some help to automate a process that takes a full day of work or more depending on the size of the area we are working in.

Currently we have some tails (orange polylines) that we offset manually to an equidistant amount depending on the situation. Then we proceed to place those tails in their respective layers.

 

Need a way to offset the existing polylines to X amount distance from each other. 

 

I attached a test 1.dwg that is how the original file will come in and an image of the final product.

 

Kind Regards

 

Marco

image.png

Tets 1.dwg

Link to comment
Share on other sites

Ok I did something for water mains keep picking points and a pline is made with an offset from those points, as your drawing looks like a services plan. It jumps roads etc so can draw a long route.

 

Ok 1st thing dont take this the wrong way but if my group drew it they would be asked to do it again with lines parallel to the street boundaries so that is 1st task. Wiil try to find water main lisp  for you.

 

Offsetting is easy part same with join ends to a pt. 

 

A small dwg with correct after  would be helpful and is needed before any one should jump in.

 

Ok found a version its just pick points like along a boundary, I dont think its final version which I am sure did plines so will fix soon. Can swap sides etc. Try it and resubmit a new DWG.

 

; draw offsets from points for random shape object making pline
; By Alan H AUG 2019


(defun C:ploffs (/ offdir offd x pt1 pt2 pt3 oldsnap ssp)

  (defun drawline (/ ang pt3 obj)
    (setq ang (angle pt1 pt2))
    (if (= offdir "L")
      (setq pt3 (polar pt2 (+ ang (/ pi 2.0)) 10))
      (setq pt3 (polar pt2 (- ang (/ pi 2.0)) 10))
    )
    (setvar 'osmode 0)
    (command "line" pt1 pt2 "")
    (setq obj (entlast))
    (command "offset" offd obj pt3 "")
    (setq ssp (ssadd (entlast) ssp))
    (command "erase" obj "")
    (setq pt1 pt2)
  )

  (defun swapr-l (/)
    (if (= (strcase offdir) "L")
      (setq offdir "R")
      (setq offdir "L")
    )
    (setvar 'osmode oldsnap)
    (setq pt1 (getpoint "\nPick  next point"))
    (setq pt2 (getpoint "\nPick  next point"))
    (drawline)
  )


; starts here
; add side pick
  (setq oldsnap (getvar 'osmode))
  (setq ssp nil)

  (initget 6 "R L")
  (setq offdir (strcase (getstring "Right or  Left")))
  (setq offd (getreal "Enter offset distance"))


  (setq pt1 (getpoint "pick 1st point"))
  (setq ssp (ssadd))

  (initget 6 "1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z")
  (while (setq pt2 (getpoint "\nPick  next point or [S Swap sides]:<"))
    (cond
      ((= (type pt2) 'LIST) (drawline))
      ((= (type pt2) 'str) (swapr-l))  ; also calls drawlines
      ((= pt2 nil) (quit))
    )
    (setvar 'osmode oldsnap)
    (initget 6 "Swap")
  )

  (setq x 0)
  (repeat (- (sslength ssp) 1)
    (setvar 'filletrad 0)
    (command "fillet" (ssname ssp x) (ssname ssp (1+ x)))
    (setq x (1+ x))
  )

  (setq x 0)
  (command "pedit" (entlast) "Y" "J")
  (repeat (- (sslength ssp) 1)
    (command (ssname ssp x))
    (setq x (1+ x))
  )
  (command "" "")

  (princ)

)
(C:ploffs)

 Look at red lines.

image.thumb.png.23951d87ea00f00c6482a628252acad0.png

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

Good morning Bigal,

 

First I want to say thank you very much for your prompt respond to my post. Greatly appreciated.

 

We run the plines behind the parcel lines because we have feeder cables, distribution, terminal etc. running on the street and there can be up to 7 tails in one run, so we have more room to place them behind the parcel lines.

The lisp you include creates new offset lines. The problem is that all of our plines have attributes and we are not drawing them, they are coming from another program called Vetro.

I'm trying to find a way to offset the existing plines  we get from Vetro and X amount from each other.

 

 

Bigal,  on your comment:  A small dwg with correct after  would be helpful and is needed before any one should jump in.

 

I have attached a smaller version of the original file I posted. I hope that is what you need.

 

My apologies if I'm not explaining myself correctly.

Test 1.dwg

Link to comment
Share on other sites

That dwg  is the same as before want a AFTER version for the end point details. 

 

As I said ( (250 1) (300 2) (500 3))  and so on this is linetype and offset can use -ve for left or ask is left or right. You can just enter as many values as required. Then pick pline.

 

Why are the lines drawn so badly could fix them move points to be at least parallel to a boundary. As I said before that type of drafting would not be accepted were I worked.

Link to comment
Share on other sites

Here is a sample of a different drawing (after) dwg.

As far as what you telling me for the information in the parenthesis and the other commands I don't know where to place them.

The lines come in like that and we fix them after the offsetting part.

 

Thank you.

 

TEST-FD.dwg

Link to comment
Share on other sites

I think it needs to be broken down into steps like draw 1st polys, then do the offsets, then do the join to point.

 

Re last you have 2 versions. A straight and a bent.

image.png.7d32feadc523cf66591c43cab9f67bfd.png

 

Using something like I mentioned already to draw 1st line more parallel. 

 

Re the offsets would be something simple maybe a custom dcl just repeat press cancel to exit Ok to add more.

image.png.248f1975c2f42a9cafe8790d82ab0bc8.png

 

As I have said doing the offsets is the easy part working out a procedure flow is the hard part and needs to be addressed 1st. Then speeding up will occur.

 

 

Edited by BIGAL
Link to comment
Share on other sites

Hi Bigal,

That is correct, if we think that the existing polylines are step 1 (drawing the polylines), then we will offset them and if the polys are not join then join them.

Every time we get the polylines from Vetro they come as 1 polyline not broken down.

I believe that in your process you are thinking of drawing new lines instead of using the existing lines we get from vetro, am I correct on assuming that? 

 

Thank you.

Link to comment
Share on other sites

I guess if you have to start with badly drawn lines then yes your stuck, as a first step will do the offset bit for you, what are the normal offsets you would use if happy with the idea of a dcl input v's manual, you can modify in code supports up to about 20 buttons.

 

I will look into a fix parallel for you so tidied up a bit before starting. Not sure if this makes any sense bits its fast and we could make it simpler. When looking at the plines they are lots of little bits and all over the place, so draw draw a new line from a lot street boundary to say other end of street lot boundray, move this line to where say the 45 corners are do a fillet of existing pline and new line the dodgy pline will be gone. Need to look a bit more at start and points to make sure they dont say lose a lot. Wiil have a go.

 

In image 2 plines one all over the place and bits, the second 1 line and parallel a fillet fixes to start. It does not change offset etc 

 

image.png.c685756b8f6d5ccebfc140a905c3a118.png

 

yeah need a different method move last selected point to match pick point then remove all vertices between so nice straight line and parallel.

Edited by BIGAL
Link to comment
Share on other sites

Thank you Bigal,

 

 

 

Even if the lines are broken into small bits, it doesn't matter as long as we can offset them. There is a lot of work we have to do after offsetting the polys, but the tedious work is to peak each individual line and offset them manually. I think that if there is a way to just pick all of the tails (orange lines) in one selection and give them an offset amount, it is a huge help. Then we can place them in the correct layer and linetype but at least they will be separate.

 

Again Thank you.

 

Link to comment
Share on other sites

Doing the offset is easy and putting in correct layer is part of it, I am just hesitant to do the code which by the way is out there, but I would rather fix up the messy plines 1st. 

simage.thumb.png.afa593ecadad86d2f94651905ae3128e.png

(defun c:wow ( / )
(setq pt1 (getpoint "\nPick 1st point "))
(setq pt2 (getpoint "\nPick 2nd point "))
(setq ent1 (ssname (ssget pt1) 0))
(command "break" pt1 pt2)
(setq ent2 (entlast))
(command "LINE" pt1 pt2 "")
(command "pedit" ent1 "J" (entlast) ent2 "" "X")
(princ)
)
(c:wow)

 

Please be patient. Worked out how to remove extras. Have a select align so now start to put it all together as one program.

 

Just a side note the dwg has some weird things in it some of the linework is duplicated or partially duplicated is this correct ? Look at curved end plines right side. This is at top.

image.thumb.png.04565c94b29e447e775c69a017be2894.png

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

Bigal,

 

I'm not in a rush take as much time as you need, everything you are doing is greatly appreciated.

Works great to straight the lines.

All the parts or tails coming from the same splice point are duplicates with different lengths to each term, if you look at the attributes of each term they are all label to the specific length.

 

Thank you.

Link to comment
Share on other sites

I have been looking at the dwg and its a nightmare there is so many lines overlapping lines, for the offsetting to work need like a clean dwg, the WOW is working and helps, how did you get such a terrible dwg in the first place ?

 

For the offsetting to work if you need go left or right can not have two or more plines else will end up with more lines than you want.

 

Just one example moved a point.

image.png.a71e44cdf2571d1a889d031f934c9984.png

Edited by BIGAL
Link to comment
Share on other sites

It is a clean dwg, I only include the terminals, row and parcel lines to make it easier.

In the export we get all the terminals come in one shp file and there is no way to separate them while doing the mapimport.

The export has the following lines right on top of each other with all their respective attributes:

2 conduits, feeder cable, distribution cables, and terminal tails from 1 to 8 tails per splice. 

 

"For the offsetting to work if you need go left or right can not have two or more plines else will end up with more lines than you want."

Correct, and that is why I have been looking for a way to separate all the existing lines and maintain their attributes. The task of separating takes a long time in a drawing of 130 sheets. 

 

 

Thank you.

Link to comment
Share on other sites

Not sure how I can help, I pulled info out of a GIS every day including telecoms they were similar in that they were diagrammatic and not true location where as the sewer was survey located and the water very close to real. 

 

Yeah lots of OD data in those plines, so each line has a different name. Ie its type of cable.

image.png.8b6d6239b7479884b407761b49ab4b79.png

 

So back to offsetting what gets offset, both lines or what ?

 

In the telecom plans they would draw 2 lines but a small gap.

Link to comment
Share on other sites

Bigal, 

 

No worries I know that your time is valuable and I'm glad that you answer my  post.

Usually we leave the conduit at the bottom and offset all of the terminal tails behind the hand holes that are located 1' away from the ROW.

 

Thanks for all your time and help.

Link to comment
Share on other sites

I Will do the offset for you just don't know how you will use it. You can use the straighten code to remove vertices just rename WOW to some thing more useful.

 

Ok this is the crude start on how to do multi offsets enter values -ve is ok.

 

(defun c:moff ( / obj lst n)
(setq obj (vlax-ename->vla-object (car (entsel "\nPick pline "))))
(setq lst '())
(while (setq offnew (getreal "\nEnter a offset -ve for left Enter to exit "))
(setq lst (cons offnew lst))
)

(foreach n lst
(vl-catch-all-apply 'vlax-invoke (list obj 'offset n))
)
; n is offset value note - is ok
(princ)
)

I am a bit busy so will go back and add a offset and linetype answer. 

 

It looks like the layers to use are.

image.png.6eb71fcd3b8f501f2a5beeec240f40d8.png

Is this correct

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

  • 3 weeks later...

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...