Plot lines by station offset Script

Plot lines by station offset Script

Joe-Bouza
Mentor Mentor
643 Views
9 Replies
Message 1 of 10

Plot lines by station offset Script

Joe-Bouza
Mentor
Mentor

I have several sanitary house connections that need to be added to the drawing.

I know all the stations and how long I want them.

 

How can I script this: this is a sample line station offset station offset should draw a 25' long line at station 4355.29

4355.29 0 4355.29 -25

 

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

EESignature

0 Likes
Accepted solutions (1)
644 Views
9 Replies
Replies (9)
Message 2 of 10

tcorey
Mentor
Mentor

Do you have those data in a text file? Post it.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 3 of 10

Joe-Bouza
Mentor
Mentor

Hi Tim

this is raw. The station values are from record plans but my alignment stations differ slightly between manholes that I can adjust but hadn't a chance to do so yet.

 

Eventually they will become pipes

 

4569 0 4569 50
4566 0 4566 -50
4523 0 4523 -50
4521 0 4521 50
4485 0 4485 -50
4483 0 4483 50
4442 0 4442 50
4341 0 4341 -50
4339 0 4339 50
4300 0 4300 -50
4298 0 4298 50
4258 0 4258 -50
4256 0 4256 50
4213 0 4213 -50
4211 0 4211 50
4174 0 4174 -50
4172 0 4172 50
4104 0 4104 -50
4102 0 4102 50
4066 0 4066 50
4064 0 4064 -50
4025 0 4025 50
4023 0 4023 -50
3969 0 3969 50
3967 0 3967 -50
3924 0 3924 50
3922 0 3922 -50
3875 0 3875 -50
3835 0 3835 -50
3833 0 3833 50
3800 0 3800 -50
3798 0 3798 50
3756 0 3756 -50
3754 0 3754 50
3718 0 3718 -50
3716 0 3716 50
3678 0 3678 -50
3676 0 3676 50
3647 0 3647 -50
3576 0 3576 50
3511 0 3511 50
3509 0 3509 -50
3464 0 3464 50
3462 0 3462 -50
3444 0 3444 -50
3442 0 3442 50
3387 0 3387 -50
3362 0 3362 -50
3342 0 3342 50
3328 0 3328 -50
3306 0 3306 -50
3304 0 3304 50
3282 0 3282 -50
3267 0 3267 -50
3265 0 3265 50
3217 0 3217 50
3215 0 3215 -50
3172 0 3172 -50
3170 0 3170 50
3075.5 0 3075.5 -50
3038 0 3038 -50
3036 0 3036 50
3007 0 3007 -50
3005 0 3005 50
2979 0 2979 50
2977 0 2977 -50
2952 0 2952 -50
2950 0 2950 -50
2914 0 2914 -50
2912 0 2912 50
2895 0 2895 50
2866 0 2866 -50
2864 0 2864 50
2815 0 2815 -50
2813 0 2813 50
2757 0 2757 -50
2755 0 2755 50
2714 0 2714 -50
2711 0 2711 50
2625 0 2625 -50
2623 0 2623 50
2588 0 2588 50
2563 0 2563 -50
2550 0 2550 -50
2548 0 2548 50
2525 0 2525 -50
2510 0 2510 50
2508 0 2508 -50
2475 0 2475 50
2473 0 2473 -50
2444 0 2444 -50
2442 0 2442 50
2409 0 2409 -50
2407 0 2407 50
2363 0 2363 -50
2361 0 2361 50
2324 0 2324 50
2322 0 2322 -50
2290 0 2290 -50
2288 0 2288 50
2267 0 2267 50
2265 0 2265 -50
2177 0 2177 -50
2175 0 2175 50
2144 0 2144 -50
2142 0 2142 50
2113 0 2113 -50
2111 0 2111 50
2079 0 2079 -50
2077 0 2077 50
2043 0 2043 -50
2041 0 2041 50
2012 0 2012 50
2010 0 2010 -50
1972 0 1972 50
1969 0 1969 -50
1942 0 1942 -50
1939 0 1939 50
1917 0 1917 50
1914 0 1914 -50
1887 0 1887 -50
1885 0 1885 50
1868 0 1868 50
1865 0 1865 -50
1815 0 1815 50
1812 0 1812 -50
1729 0 1729 50
1726 0 1726 -50
1691 0 1691 50
1688 0 1688 -50
1642 0 1642 50
1636 0 1636 -50
1618 0 1618 -50
1597 0 1597 50
1594 0 1594 -50
1540 0 1540 -50
1537 0 1537 50
1507 0 1507 -50
1504 0 1504 50
1472 0 1472 50
1469 0 1469 -50
1438 0 1438 -50
1435 0 1435 50
1377 0 1377 -50
1374 0 1374 50
1355 0 1355 -50
1352 0 1352 50
1332 0 1332 -50
1329 0 1329 50
1320 0 1320 -50
1308 0 1308 -50
1305 0 1305 50
1276 0 1276 -50
1273 0 1273 50
1244 0 1244 -50
1241 0 1241 50
1211 0 1211 -50
1208 0 1208 50
1188 0 1188 -50
1185 0 1185 50
1163 0 1163 -50
1160 0 1160 50
1132 0 1132 -50
1129 0 1129 50
1109 0 1109 50
1106 0 1106 -50
1082.7 0 1082.7 -50
1076 0 1076 -50
1072 0 1072 50
1049 0 1049 50
1039 0 1039 -50

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

EESignature

0 Likes
Message 4 of 10

brian.strandberg
Advisor
Advisor

removed.

Check out my Civil 3d blog at: http://c3dk.com/
Favorite Posts: Use Dynamo For Surface Analysis: https://youtu.be/eJNdX6guMP8
Fast Track your site grading with the new Corridor Workflow: https://youtu.be/Gg7u9-LgIL0
0 Likes
Message 5 of 10

TerryDotson
Mentor
Mentor

Use Excel or an ASCII editor to create a SCRipt file.  The built in 'SO (Transparent Station Offset) command will translate the station/offset values to coordinates within the LINE (or whatever) command.  Be aware that any tool (like _AeccCreateNetworkFromObject) that shows a dialog will bring a script file to a halt.

 

Looks like a good area for some well applied automation.

0 Likes
Message 6 of 10

Joe-Bouza
Mentor
Mentor

Hi Terry

I did try that to no success

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

EESignature

0 Likes
Message 7 of 10

tcorey
Mentor
Mentor
Accepted solution

 reformatted the file to make a csv. This code reads a csv and draws lines. It's not pretty, but it get lines on the page for you. I don't know what those two that drawing parallel to the alignment are. Anyway, this might help you move the project along.

(defun c:go ( / aln fl ln sta1 off1 sta2 off2)
(vl-load-com)
;select existing alignment
(setq aln (vlax-ename->vla-object (car (entsel "\nSelect Alignment: "))))  
(setq fl (open "E:\\_Support\\_Usenet\\231212 LISP to draw at StaOff\\pipes.csv" "r"))
(setq ln (read-line fl))
	(while (and ln)
		
		(setq sta1 (substr ln 1 4)
		      off1 (substr ln 6 1)
			  sta2 (substr ln 8 4)
			  off2 (substr ln 13 3)
			  )
			  (vlax-invoke-method aln 'PointLocation sta1 off1 'x1 'y1)
			  (vlax-invoke-method aln 'PointLocation sta2 off2 'x2 'y2)
			  (vl-cmdf "LINE" (list x1 y1) (list x2 y2) "")
			  
			  
			 (setq ln (read-line fl))
	);end while
			  
	(close fl)
	(princ)
)


Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 8 of 10

tcorey
Mentor
Mentor

Hi @Joe-Bouza ,There's an error in my code. I didn't look closely-enough at your data. It initially appeared that all the stations were four digits, no decimals, but I found the source of the horizontal lines. There are a couple stations that go to a tenth. If you need this lisp to process those two lines correctly in the routine, I will have to change how I read each line of data. I was just telling it start at character x and go for y characters. It works to capture 4 characters for the station, except for those two points.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 9 of 10

Joe-Bouza
Mentor
Mentor

Much appreciated Tim @tcorey 

 

excellent.

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

EESignature

0 Likes
Message 10 of 10

Joe-Bouza
Mentor
Mentor

Hi Tim @tcorey 

 

the data I gave is raw and I have been reformatting and we go to two decimals. I done want to burden you but If you could read two decimals that would be great. I am guessing I would tweak the file path and name?

Should I make it a <>.lsp file or can I paste to command line?

Thanks

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

EESignature

0 Likes