How to calculate road widths between a given distance?

How to calculate road widths between a given distance?

vaughan.giles7AGEV
Advocate Advocate
3,361 Views
13 Replies
Message 1 of 14

How to calculate road widths between a given distance?

vaughan.giles7AGEV
Advocate
Advocate

Hi everyone,

 

I have ~15km of road where I need to calculate the width of the existing road every 10m from a survey.

I then need to take this information and put it into a table (Excel for example).

 

So far I've found a lisp routine that creates dimension lines between two objects at a given interval, but as you can imagine it doesn't provide me with the desired result for inputting into a table.

 

Have you faced a similar problem?

 

Thanks in advance,
Vaughan.

0 Likes
Accepted solutions (3)
3,362 Views
13 Replies
Replies (13)
Message 2 of 14

devitg
Advisor
Advisor

@vaughan.giles7AGEV 

 

For better understanding, and to get further help, please upload such sample.dwg

0 Likes
Message 3 of 14

john.uhden
Mentor
Mentor

That's way too technical.  Just eyeball the thing and select a width that meets with traffic standards.  Sounds like a road reconstruction project anyway.

John F. Uhden

0 Likes
Message 4 of 14

CodeDing
Advisor
Advisor

@vaughan.giles7AGEV ,

 

Are you using Civil 3D? I'm SURE that has a tool for something like this. And yes, in this case a sample dwg would help us very much.

 

Best,

~DD

0 Likes
Message 5 of 14

vaughan.giles7AGEV
Advocate
Advocate

Not that I am aware of. Also, the objects concerned have been created from a survey and consist of 3D polylines - so there are no Civil 3D objects to base measurements off of, not that I would know how to.

0 Likes
Message 6 of 14

Sea-Haven
Mentor
Mentor

A couple of solutions come to mind, Peg and shift report is what you want, its in Civil Site Design, CIV3D add on dumps lots of details setout etc.

 

The other way is 2 plines the Peg and the Shift. You walk along the peg and get closestpointto the other shift pline using visual lisp. Very easy. There is also the function Getpointatdist so you use this on the peg pline to work out each point. Curves are fine.

 

If you have a Chainage.lsp all the code is inside it as a start. 

 

If you want a left and a right then add an extra shift pline for each chainage.

 

(setq ptpeg (vlax-curve-getpointatdist obj1 len))
(setq ptshift (vlax-curve-getclosestpointto obj2 ptpeg))

 

You would make a list as its normal practice to do all the TP's and even chainages, do a sort on the list based on chainage, its easier to get vertices 1st then add chainages. Can do smart stuff like get points of either peg or shift. Sub arc large curves 1/4 1/2  3/4 etc.

 

Message 7 of 14

vaughan.giles7AGEV
Advocate
Advocate
Accepted solution

Thank you for your suggestions.

The best solution I found was a in-built C3D solution.

 

I created a Corridor, using the pavement extents as the edge of my corridor. I created the corridor using 10m intervals and then proceeded to produce a report that gave me the road width values for each side.

 

From there, I copied the information into Excel, took the "left" and "right" values, combined them via simple formula, then applied a filter on the data to isolate 1 line per chainage (ie. 1 line every 10m).

 

 

0 Likes
Message 8 of 14

john.uhden
Mentor
Mentor

That's good news!

I think you ought give "Accept as Solutions" to both @CodeDing and @Sea-Haven .

John F. Uhden

0 Likes
Message 9 of 14

Sea-Haven
Mentor
Mentor

As part of "Accept" it would be good to add the details where the CIV3d option is.

Message 10 of 14

vaughan.giles7AGEV
Advocate
Advocate
Accepted solution

Per your request, here is how I did it.

Civil 3D

1. Create an Assembly:  Home Tab > Create Design > Assembly (create assembly) > Assembly Type: Basic.

 

2. In your Tool Pallet (ctrl+3) go to > Lanes > and select the LaneSuperelevationAOR subassembly. Apply this subassembly to either side of the assembly you created in step 1.


3. Create a Corridor: Home Tab > Create Design > Corridor (Note that you need to first have an Alignment, Surface and Surface Profile created.).

 

4. In the Create Corridor pop-up, set the corridor Baseline type to Alignment and Profile and set the corridor to read from the Alignment and Profile, and point the corridor to read from the assembly and target surface. Have "Set baseline and region parameters ticked".

 

5. In the Baseline and Region Parameters menu, set the frequency to 10m intervals at every given baseline measurement and turn off the additional geometry options (from yes to no).

 

6. Set the Target and under Object Name for "Width or Offset Targets" select the Widths for the left and right sides, using objects and selecting from the drawing, the edges of your pavement (road width).

 

7. Once completed, you can hit ok and then apply and wait while the corridor is being generated.

 

8. Toolspace > Toolbox > Reports Manager > Corridor > Section Points Report > Right-click > Execute.

 

9. Select the appropriate "Filter by link code" (in this instance Pave 1). > set the Station Interval to 10m. > Select an appropriate location to save the report then hit "Create Report".


10. From here, copy the report information into Excel, create a simple addition formula to combine both sides of the road. Remove the negative symbol from road widths and remove the "m" annotation. Then your formula will provide you with the correct result.

 

11. Filter your information till you're left with 1 line per chainage, quoting you the finished product of road widths for every 10 meters.

 

Job complete.

Message 11 of 14

hak_vz
Advisor
Advisor
Accepted solution

@vaughan.giles7AGEV This is good solution from a perspective of CIV 3d user. Since you posted your request

to AUTOLISP forum here is autolisp solution to your request. You didn't provided sample

file, and details how you would like it to be solved. Specify what you assume under term "road width " i.e is it a width of a perpendicular section between two 2d or 3d points, how sections are created (from a center line or from one of road sides).

 

Anyway, here is my attempt to solve your request.

I assume you have two lwpolylones with same zero elevation (created through 2d points).

Start and end of each road side is created in such way that line is drawn from one side perpendicular to other and

if needed other side is extended or trimmed to assure start at center line station 0. Other solutions are applicable.

 

Code asks for step value between two sections and output CSV file. It creates perpendicular sections to recreated center line at step distance and writes in file stations and widths of each section. Code needs some final touches but it works ok. Changes possible after and if  you provide some more details.

 

(defun c:roadwidths (/ *error* ent1 ent2 i len pt p1 ptlst getintersections step f file1 co len dist pt1 pt2 pt3 lo )
; modified from Lee Macs solution to create centerline to two lwpolylines
 (vl-load-com)
 (defun *error* ()
 (setvar 'cmdecho 1)
 (close file1)
 (princ)
 )
 (defun getintersections ( obj1 obj2 / var )
    (setq var (vlax-variant-value (vla-intersectwith obj1 obj2 acExtendThisEntity)))
    (if (< 0 (vlax-safearray-get-u-bound var 1))
        (vlax-safearray->list var)
    )
)
(setq step (getreal "\n Step >"))
(setq f (getfiled "Output file name:" (getvar "dwgprefix") "csv" 3))
(setq file1 (open f "w"))

(setvar 'cmdecho 0)
 (if (and (setq ent1 (car (entsel "\nSelect First Polyline: ")))
          (wcmatch (cdr (assoc 0 (entget ent1))) "*POLYLINE"))
   (if (and (setq ent2 (car (entsel "\nSelect Second Polyline: ")))
            (wcmatch (cdr (assoc 0 (entget ent2))) "*POLYLINE"))
     (progn
       (setq i -1 len (/ (vla-get-Length
                           (vlax-ename->vla-object ent1)) 100.))
       (while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
         (setq p1 (vlax-curve-getClosestPointto ent2 pt t)
               ptlst (cons (polar pt (angle pt p1) (/ (distance pt p1) 2.)) ptlst)))
       (setq ptlst (apply 'append
                     (mapcar
                       (function
                         (lambda (x)
                           (list (car x) (cadr x)))) ptlst)))
       (vla-AddLightWeightPolyline
         (vla-get-ModelSpace
           (vla-get-ActiveDocument
             (vlax-get-acad-object)))
         (vlax-make-variant
           (vlax-safearray-fill
             (vlax-make-safearray
               vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))
		(command "reverse" (entlast) "")
		(setq 
			co (vlax-ename->vla-object (entlast))
			len (vlax-get co 'Length)
			i 0
		)
		
		(while (<= (setq dist (* i step)) len)
			(setq 
				pt1 (vlax-curve-getPointAtDist co dist)
				pt2 (vlax-curve-getPointAtDist co (+ dist 0.01))
				pt3 (polar pt1 (+(angle pt1 pt2) (/ PI 2.0)) 0.5)
				lo (vla-addline (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point pt1)(vlax-3d-point pt3))
				pt1  (getintersections lo (vlax-ename->vla-object ent1))
				pt2  (getintersections lo (vlax-ename->vla-object ent2))
			)
			(vla-delete lo)
			(cond
				((and pt1 pt2)			
					(command "line" "none" pt1 "none" pt2 "")
					(write-line (strcat (rtos dist 2 1) ";" (rtos (vlax-get (vlax-ename->vla-object (entlast)) 'Length ) 2 3)) file1)
				)
			)
			(setq i (+ i 1))
		)
 (close file1)	
 (setvar 'cmdecho 1)
 (princ)
)

 

 

 

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 12 of 14

doaiena
Collaborator
Collaborator

I think you have missed a post there. Post 5 isn't marked as a solution.

0 Likes
Message 13 of 14

CodeDing
Advisor
Advisor

I can see that OP is getting a bit of a rough time for marking his own posts as solutions. Although I do personally feel that OP did not give us enough insight to help him as much as we would have liked, I agree with him marking his posts as the solutions to his question. They answer the question he inquired on so that if any random person were to stumble across this post from perhaps google, then the answer that OP provided would be the best answers for that person.

 

Best,

~DD

0 Likes
Message 14 of 14

vaughan.giles7AGEV
Advocate
Advocate

Thank you for all of your inputs - I am glad that we found multiple solutions.

It was my mistake to list this in a lisp part of the forum, a mistake I wasn't aware of so I apologise on that front!

0 Likes