Improving Section.SectionPoints() in API.

Improving Section.SectionPoints() in API.

joantopo
Mentor Mentor
2,758 Views
10 Replies
Message 1 of 11

Improving Section.SectionPoints() in API.

joantopo
Mentor
Mentor

Hi.

I don´t like how Section.SectionPoints( ) works.

 

If I have sample lines with, for example,  a width =50 meters in each side, I always get a SectionPoint in offset -50 meters and 50 meters, it means, in the extrems of the sample line, although  my surface boundary was narrower. Those SectionPoints, in offset -50 and 50 will have elevation 0.

Ok.

I have a method to erase all SectionPoints with elevation=0.

 

Second trouble.

 

If I create a new surface and copy another TinSurface, If we add a boundary within this new surface, and I get Section.SectionPoint(), I get Sectionpoints(converted to coordinates x,y in plant) outside the surface outer boundary!

 

So, I think this method should be overloaded like :  Section.SectionPoints (bool IncludeInvisible).

 

TinSurfaces objects have TinSurface.GetTriangles(bool IncludeInvisible).

 

To avoid this scenario, I have to check every SectionPoint if it is inside the surface but is a process very very slow. It takes a long time.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
2,759 Views
10 Replies
Replies (10)
Message 2 of 11

joantopo
Mentor
Mentor

Look at this sample:

 

I have surface A.

I create surface B and copy surface A to surface B.

I add a boundary surface in surface B.

 

Sources added in Sample Line Group: only surface B.

 

Sample lines with width= 35 meters in left side and right side.

 

If I get all section Points of Station 0.000

 

I get this:

 

(station  offset elevation):

 

0.000 -35.000 442.055
0.000 -28.414 441.935
0.000 -25.619 441.988
0.000 -25.573 441.989
0.000 -25.535 441.990
0.000 -25.471 441.991
0.000 -25.345 441.994
0.000 -24.986 442.000
0.000 -23.023 442.038
0.000 -15.209 441.805
0.000 -4.200 441.477
0.000 -4.200 441.477
0.000 -3.600 441.459
0.000 0.000 441.351
0.000 3.600 441.244
0.000 4.200 441.226
0.000 4.200 441.226
0.000 16.517 440.859
0.000 35.000 440.307

 and now, look at this section in the SectionView:

 

section.jpg 

 

The  properly SectionPoints (like the section in drawing) must be only the numbers in bold of the list.

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 3 of 11

joantopo
Mentor
Mentor

If I select the selection and later y use "List" command prompt, look at the command line:

 

img2.jpg

 

Note: I changed the elevations (though the offsets are the same).

 

In the list are showed properly. It ignores the external points in the sample line.

It says: total vertex= 11, although we only want 9 vertex.

 

However, in the list always appears the intemediate points (intermediate points with the same grade  between to vertex).

For example, the section drawing only is 2 vertex, the rest of them (7 vertex) are intermediate points.

 

I think the SectionPoints() method should have 2 parameters:  SectionPoints (bool IncludeVertexOutSection , bool IncludeIntermediateVertex)

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 4 of 11

Anonymous
Not applicable

Hello (Hola?) Joantopo,

 

I have some samplelinegroups with several samplelines with some sections (some TIN surfaces) and now I am trying to create a txt (or excel) file with all sections vertex.

Programmatically I managed to get the sampleline groups, samplelines and sections. But I can’t get the section surface name in th Autodesk.Civil.DatabaseServices.Section properties.

Basically, I can get the section.sectionpoints but I still don’t know from what surface they are.

 

How can I solve it?

 

Thanks!

0 Likes
Message 5 of 11

Anonymous
Not applicable

Solved!

 

I found your older post:

http://forums.autodesk.com/t5/autocad-civil-3d-customization/sourceid-or-source-name-from-section/m-...

 

and modified:

 

For Each oSectionID As ObjectId In oSampleLine.GetSectionIds
  Dim oSection As Autodesk.Civil.DatabaseServices.Section = oTrans.GetObject(oSectionID, OpenMode.ForRead)
  Dim oSectionObject As Object = oSection.AcadObject
  Dim oSurfaceObject As Object = oSectionObject.GetType().InvokeMember("Surface", Reflection.BindingFlags.GetProperty, Nothing, oSectionObject, Nothing)
  Dim oSurface As Autodesk.Civil.DatabaseServices.Surface = Autodesk.Civil.DatabaseServices.DBObject.FromAcadObject(oSurfaceObject).GetObject(OpenMode.ForRead)
Next

 

Thanks,

0 Likes
Message 6 of 11

joantopo
Mentor
Mentor

Le tienes que dar las gracias a Jeff.

Yo tengo ese comando en mi programa.

 

https://apps.exchange.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3Avisorne...

 

Al final, he hecho un método sobrecargado de SectionPoints que elimina los puntos intermedios (que tienen la misma pendiente) y también elimina los puntos que quedan fuera de la superficie.

Para eliminar los puntos que quedan fuera de la superficie, lo puedes hacer de 2 maneras.

1) obtener el borde de superficie y crear una región (MPolygon) y comprobar si el punto (x,y) en planta queda dentro de la región.

2) a partir de la superficie, usar un método que es para obtener la elevación de un punto de la superfície, haciendo un (try /catch), si dá error es que no tiene elevación y entonces ignoras ese punto.

 

En mi programa doy a elegir si usar el método 1 o el método 2, puesto que el método 2, de checkear las elevaciones de superficie, se hace muy lento si tiene que hacerlo para muchos puntos... (en realidad, es la queja de este post, porque yo el comando ya lo tengo operativo).

 

Saludos.

 

 

 

We have to thank Jeff.
I have that command in my program.
In the end, I made an overloaded method SectionPoints eliminating intermediate points (which have the same slope) and also eliminates the points that are outside the surface.
To remove the points that are outside the area, you can do it in 2 ways.
1) to obtain the edge and create a surface region (MPolygon) and check if the point (x, y) on the ground is within the region.
2) from the surface, using a method that is for the elevation of a point on the surface, making a (try / catch), if it gives error is that no lifting and then ignore that point.
Greetings.

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 7 of 11

Anonymous
Not applicable

Entonces doy las gracias a los dos 🙂

So, I thank you both.

 

Autodesk should improve (a lot) the sections API, even more when dealing with corridor sections.

 

Saludos,

0 Likes
Message 8 of 11

joantopo
Mentor
Mentor

Take care with this:

 

If your aim is getting the Surface Id from a Section, you will need to check the surface name.

 

There are 3 types of Section.Sources.. (SourceType):

 

* TinSurface.

* CorridorSurface ( corridor surface is also a TINSurface but it is provided from a corridor).

* Corridor  (it will be the Corridor Sections).

 

If you want to calculate the (offset,elevation) points you don´t have to find out the surface id or surface name. (surface name is not the same that "section source name")

 

In general, section source name is the same string value that surface name, except if the SectionType is "CorridorSurface". In that case is a composite word (Corridor Name + Surface Name).

 

I don´t know if we can edit that prefix in the Civil 3D User Interface.

 

Look at this screenshoot:

 

img3.jpg

 

For TinSurface type, the name is equal for "surface name" and "section source name".

 

Regards.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 9 of 11

joantopo
Mentor
Mentor

sorry, I was confused. In SectionSources, for a "CorridorSurface" type, the name is exactly equal that the surface name.

 

 Is only different in the dialog form to add or remove sources.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 10 of 11

joantopo
Mentor
Mentor

Hi.

 

I have just seen that we don´t have to check if the SectionPoint is inside or outside the surface with a particular method.

 

We can check it with Section.LeftOffset and Section.RightOffset properties.

 

if some sectionPoint is bigger than them, then we ignore it.

 

img2.jpg

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 11 of 11

joantopo
Mentor
Mentor
 foreach (SectionPoint point in scpointColl)
             {
               double  offset = point.Location.X;
               double elev = point.Location.Y;

               if (offset >= seccion.LeftOffset && offset <= seccion.RightOffset)  //si el offset está comprendido entre los 2 offsets máximos
               {
                   registro = new toolsC3D.Vertices_desnivelSección();
                   registro.desfase = offset;
                   registro.elevacion = elev;

                   llista.Add(registro);
               }

             }

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes