Jump to content

Help lisp Straighten out route...


Recommended Posts

Posted

I design a road passing through a field with sharp corners. Now, I want to straighten out route but I do not know how. I used to do manually as follows: I draw the rectangle and then cut the rectangle; removal of the intersection (cross) and put together.

Please help me write a lisp that I do that line straighten out.

Sincerely thank you very much.

P / S: Default corridor road is 100m. I was offset to either side of the line is 100m.

Image attachment:

3.jpg

DWG file:

XDM L474.dwg

1.jpg

2.jpg

Posted

Here we go :)

 

(defun c:Test (/ s o _p lst lng st)
 ;;	Tharwat 22.7.2015	;;
 (princ "\nPick on LWpolyline to draw Rectangles between coordinates")
 (if (and (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
          (setq _p (getpoint "\nSpecify point to redraw the LWpolyline with Rectangles:"))
          )
   (progn
     (setq o   (ssname s 0)
           lst (mapcar 'cdr (vl-remove-if-not '(lambda (p) (eq (car p) 10)) (entget o)))
           st  (car lst)
           )
     (mapcar '(lambda (l)
                (setq lng (cons (distance st l) lng)
                      st  l
                      )
                )
             (cdr lst)
             )
     (entmake
       (append
         (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")
               '(100 . "AcDbPolyline") '(90 . 2) '(70 . 0)
               )
         (vl-remove-if-not '(lambda (x) (member (car x) '(62 6 370))) (entget o) )
         (list (cons 10 _p) (cons 10 (polar _p 0. (vlax-curve-getdistatpoint o (vlax-curve-getendpoint o)))))
         )
       )
     (mapcar
       '(lambda (d)
          (entmake (append
                     (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1))
                     (mapcar '(lambda (a p) (cons 10 (polar p a 100.)))
                             (list (* pi 0.5) (* pi 0.5) (* pi 1.5) (* pi 1.5))
                             (list _p (polar _p 0. d) (polar _p 0. d) _p)
                      )
              )
            )
          (setq _p (polar _p 0. d))
          )
       (reverse lng)
       )
     )
   )
 (princ)
 ) (vl-load-com)

Posted
Here we go :)

 

(defun c:Test (/ s o _p lst lng st)
 ;;	Tharwat 22.7.2015	;;
 (princ "\nPick on LWpolyline to draw Rectangles between coordinates")
 (if (and (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
          (setq _p (getpoint "\nSpecify point to redraw the LWpolyline with Rectangles:"))
          )
   (progn
     (setq o   (ssname s 0)
           lst (mapcar 'cdr (vl-remove-if-not '(lambda (p) (eq (car p) 10)) (entget o)))
           st  (car lst)
           )
     (mapcar '(lambda (l)
                (setq lng (cons (distance st l) lng)
                      st  l
                      )
                )
             (cdr lst)
             )
     (entmake
       (append
         (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")
               '(100 . "AcDbPolyline") '(90 . 2) '(70 . 0)
               )
         (vl-remove-if-not '(lambda (x) (member (car x) '(62 6 370))) (entget o) )
         (list (cons 10 _p) (cons 10 (polar _p 0. (vlax-curve-getdistatpoint o (vlax-curve-getendpoint o)))))
         )
       )
     (mapcar
       '(lambda (d)
          (entmake (append
                     (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1))
                     (mapcar '(lambda (a p) (cons 10 (polar p a 100.)))
                             (list (* pi 0.5) (* pi 0.5) (* pi 1.5) (* pi 1.5))
                             (list _p (polar _p 0. d) (polar _p 0. d) _p)
                      )
              )
            )
          (setq _p (polar _p 0. d))
          )
       (reverse lng)
       )
     )
   )
 (princ)
 ) (vl-load-com)

Dear Tharwat,

Thank you very much. However, you can help me to step 04 (view file attach). You write to step 03 (not object in frames).

Thank Tharwat very much!

I want result this same:

 

04.jpg

 

03.jpg

Posted
Dear Tharwat,

Thank you very much. However, you can help me to step 04 (view file attach). You write to step 03 (not object in frames).

Thank Tharwat very much!

I want result this same:

 

You are welcome .

 

Actually I wrote the program as per your first post and regarding to your second request , I am don't know how you did adjust these plots into a straight rectangle to allow me to see if that could be possible by codes.

Posted
You are welcome .

 

Actually I wrote the program as per your first post and regarding to your second request , I am don't know how you did adjust these plots into a straight rectangle to allow me to see if that could be possible by codes.

 

Dear Tharwat,

At # 1 I also gave final image (I want this same result) I wanted have result this same.

And the figure 03 that was the idea that I think is after cutting out rectangles will merge them so.

And that's what I wanted at that time Figure 04. All roads have been straightened out.

Then because image have not numbered, so you may misunderstand me meaning.

I wish you ignore and please help me.

P / S: In a nutshell: I have a figured 01 I want straightened out the same figured 04.

Thank Tharwat very much!

Please help me!

Posted (edited)

MY $0.02 better off looking at using layouts mview and orientated along the alignment line, creating plan sections. This is a standard feature in add ons (CIV3D) to civil works. The Software we use Adavanced roads really has a good handle on this.

Edited by BIGAL
Posted
MY $0.02 better off looking at using layouts mview and orientated along the alignment line, creating plan sections. This is a standard feature in add ons (CIV3D)

to civil works. The Software we use Adavanced roads really has a good handle on this.

Dear, BIGAL

I do not really understand much of Biggal. You can talk a little detail? I described the problems mentioned above:

I have one in route to the 01 drawings, now I want to straighten out as drawings route 04.

Look forward to your help and Tharwat.

Help me write a lisp to do so.

P/S: I'm using autocad 2007; I don't use Civil 3D.

File dwg:

XDM L474.dwg

Posted

I do understand you want to straighten out a curvy road to make plotting easier, we do it every day. As I said we use a layout and rotate the underlying survey to best suit the page, we use UCS when doing it manually per page to set view. I have a project 12 roads as a grid 15 degrees off vertical, all appear on the sheet as horizontal.

 

Ok start with your model space Then UCS OB either pick an object you want to make align to horizontly or draw a temporary line then use it you can then erase it , then UCS S "Road1" repeat for sections "road2" etc Then go to a layout set up your title block do a mview and do UCS R "road1" Plan, zoom in to correct area and at desired scale all done. Go to layout 2 UCS R "road2" plan Z E then scale etc just keep going. No programming required.

Posted
I do understand you want to straighten out a curvy road to make plotting easier, we do it every day. As I said we use a layout and rotate the underlying survey to best suit the page, we use UCS when doing it manually per page to set view. I have a project 12 roads as a grid 15 degrees off vertical, all appear on the sheet as horizontal.

 

Ok start with your model space Then UCS OB either pick an object you want to make align to horizontly or draw a temporary line then use it you can then erase it , then UCS S "Road1" repeat for sections "road2" etc Then go to a layout set up your title block do a mview and do UCS R "road1" Plan, zoom in to correct area and at desired scale all done. Go to layout 2 UCS R "road2" plan Z E then scale etc just keep going. No programming required.

Dear, BIGAL

The purpose of stretching is to me put on longitudinal section (see attachment - yellow frame).

Although I did as instructed but when put into the layout I did not know how to do it again (see attached video).

I think, to put is in longitudinal section so it is necessary to use lisp or craft to straighten out. As for the method proposed BIGAL I think is not feasible.

We wish the help of BIGAL and Tharwat.

Thank you very much!

Longitudinal section:

1.MC_G1-G11.dwg

Video:

https://www.youtube.com/watch?v=6W3Qa4GKp3E

Posted
You are welcome .

 

Actually I wrote the program as per your first post and regarding to your second request , I am don't know how you did adjust these plots into a straight rectangle to allow me to see if that could be possible by codes.

Dear Tharwat

The purpose of stretching is to me put on longitudinal section (see attachment - yellow frame).

In article # 1 I have stated clearly not the issue. I wish Tharwat sympathy and help me write a lisp so that I can do this!

Please help me.

Sincerely thank Tharwat!

Good luck for you!

File:

1.MC_G1-G11.dwg

Posted

This is a bit like redoing again what has been asked before and you are really trying as you now say to produce long and cross sections a standard road design function. There is lots of free stuff out there to do just this. Search here for posts by ymg3 he has some nice routines and I am pretty sure he has now added long section to his collection, I am sure he will comment.

Posted

minhphuong_humg,

 

I really do not understand your purpose in straightening your alignment.

 

Only reason would be for presentation purpose as BIGAL mentionned.

 

To extract long section all you need is a triangulation of your corridor

then extract a profile out of it.

 

Or maybe you want to show profile along with a developped plan view

of the parcels where the alignment passes.

 

If it is the case, Tharwat's routine gives you the windows for each

segment. Armed with that you need a cookie cutter routine that

will return a copy of all the entities inside the windows trimmed to

that window.

 

You then need to rotate each of the trimmed window to 0 degree

and place them end to end.

 

I do have a long profile extraction from a Triangulation in my Triang

program.

 

In one of the version (Not the last one) I had a routine OSD which

could trim all entities to an external contour. But II do not have a

routine that will do what you want.

 

If you search this site or the web for cookie cutter or trim to external

contour you will find many.

 

ymg

Posted
minhphuong_humg,

 

I really do not understand your purpose in straightening your alignment.

 

Only reason would be for presentation purpose as BIGAL mentionned.

 

To extract long section all you need is a triangulation of your corridor

then extract a profile out of it.

 

Or maybe you want to show profile along with a developped plan view

of the parcels where the alignment passes.

 

If it is the case, Tharwat's routine gives you the windows for each

segment. Armed with that you need a cookie cutter routine that

will return a copy of all the entities inside the windows trimmed to

that window.

 

You then need to rotate each of the trimmed window to 0 degree

and place them end to end.

 

I do have a long profile extraction from a Triangulation in my Triang

program.

 

In one of the version (Not the last one) I had a routine OSD which

could trim all entities to an external contour. But II do not have a

routine that will do what you want.

 

If you search this site or the web for cookie cutter or trim to external

contour you will find many.

 

ymg

 

Dear ymg3,

Thank you for your interest in this issue.

The purpose of straightening out I was presented as at # 10 that I put on the description of longitudinal section (yellow frame in longitudinal section - attachment # 10). Because in longitudinal section should straighten out the corner without leaving the (corresponding to angle = 0).

Please help me to do that without having to manually cut each rectangle and fit together.

Thank you very much!

Posted

minhphuong_humg I have been doing civil design for over 30 years and we would never do what you want, if a alignment has curves we would rotate the way we produce the plan so as to maximise the view on the plotted sheet, but it would show the curved road. I did 4.5km of road and we just set up a UCS for different sections of road so the plotted sheet was always along the route direction it had lots of turns in it. I have a team of 8 designers and we never do what your asking for.

 

Please post a dwg so I can show you what I am talking about.

Posted
minhphuong_humg I have been doing civil design for over 30 years and we would never do what you want, if a alignment has curves we would rotate the way we produce the plan so as to maximise the view on the plotted sheet, but it would show the curved road. I did 4.5km of road and we just set up a UCS for different sections of road so the plotted sheet was always along the route direction it had lots of turns in it. I have a team of 8 designers and we never do what your asking for.

 

Please post a dwg so I can show you what I am talking about.

Dear BIGAL,

Dear ymg3,

Dear Tharwat,

Dear Everybody,

Let me once again say the problems that I need help.

I surveyed the route then draw longitudinal section.

Because on the longitudinal section presents the fashion show as 0 degrees so I have to straighten out.

To do that, I do crafts is very long.

Now we hope to receive your help so that I can perform the job more quickly.

English is not my mother tongue. So sometimes I describe its improper intent. I'm looking for sympathy and help.

See drawings detailing the steps taken my job.

Thank you very much! Good luck for you!

 

File attachment:

all.dwg

 

 

Image:

1a.jpg

2a.jpg

3a.jpg

Posted

minhphuong_humg, I do think that everyone is trying to help you.

 

But, speaking personally, I have never seen a drawing such as yours in 50 years.

 

Usually, roads have curves which join up the straights. Perhaps this is not a road for vehicles?

 

How would you suggest showing the background mapping if you were to straighten out a curve?

 

The longitudinal section is, by its own definition, a straightened out centre-line, and is usually referenced to the plan view by the chainage markers.

 

Your wish is for a lisp to do what has never been done before, and will not be useful to anyone else, and it might take time for someone to write.

Posted

minhphuong_humg,

 

To add my voice to BIGAL's and Eldon's, this is not a proper way to present a

long profile.

 

You would normally show a rotated plan view of the alignment and below

add a profile on a grid.

 

Road_Sheet2.jpg

Posted
minhphuong_humg, I do think that everyone is trying to help you.

 

But, speaking personally, I have never seen a drawing such as yours in 50 years.

 

Usually, roads have curves which join up the straights. Perhaps this is not a road for vehicles?

 

How would you suggest showing the background mapping if you were to straighten out a curve?

 

The longitudinal section is, by its own definition, a straightened out centre-line, and is usually referenced to the plan view by the chainage markers.

 

Your wish is for a lisp to do what has never been done before, and will not be useful to anyone else, and it might take time for someone to write.

The problem is that my company profile is required to do so before the design. I am the staff can not do otherwise. The only other thing that could do something to be able to make faster only.

Thank you for your interest in my problem.

If you can look forward to receiving your help!

Sincere thanks to all of you!

Posted
minhphuong_humg,

 

To add my voice to BIGAL's and Eldon's, this is not a proper way to present a

long profile.

 

You would normally show a rotated plan view of the alignment and below

add a profile on a grid.

 

Road_Sheet2.jpg

Dear ymg3,

The problem is that my company profile is required to do so before the design. I am the staff can not do otherwise. The only other thing that could do something to be able to make faster only.

Thank you for your interest in my problem.

If you can look forward to receiving your help!

Sincere thanks to all of you!

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...