Get Point of the Pipe on the profile View

Hi Everyone!
I want to get the Points of the Start.Pipe and End.Pipe on the profie view, I need your help!
Thanks in advance…
image

Hi @lebinhx3c2012,

Is this what you’re looking for?

3 Likes

Great! Can you give me the file .dyn.

Here is what I came up with to roughly place mtext invert labels. I highly suggest using what Zachri has made though as he is much more experienced. But perhaps you can scrub something out of my novice late night stream of conscious coding! Cheers.Invert Labels.dyn (42.6 KB)

2 Likes

Here’s the Python script.
IN[0] = Profile View object
IN[1] = station (or list of stations)
IN[2] = elevation (or list of elevations)

The number of stations should match the number of elevations.

import sys
import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

from Autodesk.Civil.DatabaseServices import *

adoc = Application.DocumentManager.MdiActiveDocument

from Autodesk.DesignScript.Geometry import *

def get_profile_view_points(profileView, station, elevation):
	
	global adoc
	
	output = []
	
	if not isinstance(station, list) and not isinstance(elevation, list):
		station = [station]
		elevation = [elevation]

	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
				for i in range(0, len(station)):
					oid = profileView.InternalObjectId
					obj = t.GetObject(oid, OpenMode.ForRead)
					if isinstance(obj, ProfileView):
						flag, x, y = obj.FindXYAtStationAndElevation(station[i], elevation[i], 0, 0)
						output.append(Point.ByCoordinates(x, y, 0))
				t.Commit()
	return output		

OUT = get_profile_view_points(IN[0], IN[1], IN[2])
3 Likes

Hi @mzjensen ,
Why list of station Pipe All equal to zero.

Tao point duong ong.dyn (53.8 KB) Drawing1.dwg (1.3 MB)

Do the pipes have a reference alignment set?

2 Likes

Great, Thanks for your answer.
I was successful

1 Like