Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simple question on Smooth Surface Code

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
betocamelini
367 Views, 4 Replies

Simple question on Smooth Surface Code

Hello there!

 

I'm trying to create a smooth surface routine, based on the Edge Midpoints, using essentially this code:

 

Dim oSurface As TinSurface = CType(surfaceId.GetObject(OpenMode.ForWrite), TinSurface)

Dim output As SurfacePointOutputOptions = New SurfacePointOutputOptions
output.OutputLocations = SurfacePointOutputLocationsType.EdgeMidPoints

output.Edges = ????

 

How can I fill the Edges parameter with all triangle edges of my surface?

 

Thanks!

 

 

4 REPLIES 4
Message 2 of 5
Jeff_M
in reply to: betocamelini

Normally the smoothing operations are for small areas. But, you need to pass a collection of edges that you get from the triangles and/or the FindEdgeAtXY() method of the surface. You can get the XY by using a polyline to define the area you want to smooth, then use the SampleElevations() method of the surface, this will return 3dPoints wherever the polyline crosses the TIN.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 5
betocamelini
in reply to: Jeff_M

Hi Jeff,

I appreciate your help, but perhaps finding intersection points will result
only in the intersected edges, however I really need to apply this
operation over all edges. Do you know if there is a method to obtain all
triangle edges in the surface?

Thanks a lot!
Message 4 of 5
Jeff_M
in reply to: betocamelini

You can use the GetTriangles() method, then iterate that to get the Edge1, Edge2, & Edge3 properties, adding each one to a new TinSurfaceEdgeCollection (making sure not to add duplicates). 

 

Note that I have not tested any of this, just going by the Object model.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 5
betocamelini
in reply to: Jeff_M

Ok Jeff, this solves my problem. This is the code I've used:

Dim triangles As TinSurfaceTriangle()
Dim edges As New List(Of TinSurfaceEdge)
triangles = oSurface.GetTriangles(True).ToArray
Dim count As Integer = triangles.Count
Dim i As Integer = 0
Do While (i < count)
edges.Add(triangles(i).Edge1)
edges.Add(triangles(i).Edge2)
edges.Add(triangles(i).Edge3)
i = (i + 1)
Loop
output.Edges = edges

Thank you very much for your support!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report