Hallo guys i have problem that i can't extract the ground points section from civil 3d , i have searched the report section a lot of times and i couldn't extract them to model or file like land help me...
Solved! Go to Solution.
Solved by hosneyalaa. Go to Solution.
Solved by hosneyalaa. Go to Solution.
Solved by TerryDotson. Go to Solution.
i need to extract the ground points which view in sample sections every 25 meters.
Try the attached points (DWG & XLSx files).
I do know that order from future line but it's very difficult to arrange it in Excel.
as well as some stations there is no 0m offset for them.
I hope Autodesk solve this issue soon.
I am v thankful for your help .
I will check the points with the ground section and i will back to tell you if they are correct.
Maybe
Use this code And arrange it as you like
https://forums.autodesk.com/t5/civil-3d-customization/get-section-points-problem/m-p/6000784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using aGi = Autodesk.AutoCAD.GraphicsInterface;
using Autodesk.AutoCAD.Runtime;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
using CivDb = Autodesk.Civil.DatabaseServices;
namespace Extensions_Section
{
public class Extensions_Section
{
[CommandMethod("testExtensions_Section")]
public void stExtensions_SectiondA()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
CivilDocument civdoc = CivilApplication.ActiveDocument;
Editor ed = doc.Editor;
PromptEntityOptions entOpts = new PromptEntityOptions("Select section:");
entOpts.SetRejectMessage("...not a section, try again.");
entOpts.AddAllowedClass(typeof(CivDb.Section), true);
PromptEntityResult entRes = ed.GetEntity(entOpts);
if (entRes.Status != PromptStatus.OK)
return;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
CivDb.Section sec = (CivDb.Section)entRes.ObjectId.GetObject(OpenMode.ForRead);
var LL = sec.GetSectionLinks();
var LLPOINT = sec.GetValidSectionPoints();
tr.Commit();
}
}
}
public static class ExtensionsSection
{
public static IEnumerable<SectionPoint> GetValidSectionPoints(this CivDb.Section section)
{
var valid = new HashSet<Point3d>();
dynamic comSec = section.AcadObject; // AeccSection
dynamic comLinks = comSec.Links; // AeccSectionLinks
for (int i = 0; i < comLinks.Count; i++)
{
dynamic comLink = comLinks.Item(i); // AeccSectionLink
if (comLink.Type != 1)
{
valid.Add(new Point3d(comLink.StartPointX, comLink.StartPointY, comLink.StartPointZ));
valid.Add(new Point3d(comLink.EndPointX, comLink.EndPointY, comLink.EndPointZ));
}
}
return (from sp in section.SectionPoints
where valid.Contains(sp.Location)
select sp);
}
public static IEnumerable<Section.SectionLink> GetSectionLinks(this CivDb.Section section)
{
dynamic comSec = section.AcadObject; // AeccSection
dynamic comLinks = comSec.Links; // AeccSectionLinks
for (int i = 0; i < comLinks.Count; i++)
{
dynamic comLink = comLinks.Item(i); // AeccSectionLink
var start = (from sp in section.SectionPoints
where sp.Location.IsEqualTo(new Point3d(comLink.StartPointX, comLink.StartPointY, comLink.StartPointZ))
select sp).First();
var end = (from sp in section.SectionPoints
where sp.Location.IsEqualTo(new Point3d(comLink.EndPointX, comLink.EndPointY, comLink.EndPointZ))
select sp).First();
if (start != null && end != null)
{
yield return new Section.SectionLink(start, end, i, comLink.Type);
}
}
}
public static IEnumerable<Section.SectionLink> GetValidSectionLinks(this CivDb.Section section)
{
return (from sl in section.GetSectionLinks()
where sl.Type != SectionLinkType.NoDraw
select sl);
}
}
public static partial class Section
{
public class SectionLink
{
public SectionPoint StartPoint;
public SectionPoint EndPoint;
public readonly int Index;
public readonly SectionLinkType Type;
public SectionLink(SectionPoint startPoint, SectionPoint endPoint, int index, SectionLinkType type)
{
StartPoint = startPoint;
EndPoint = endPoint;
Index = index;
Type = type;
}
}
}
public enum SectionLinkType
{
None = 0, // aeccSectionLinkNone
NoDraw = 1, // aeccSectionLinkNoDraw
All = 2 // aeccSectionLinkAll
}
}
Wow that is code to solve it. really amazing.
Where i can paste this code in lisp or visualbasic?
you need Microsoft Visual Studio
https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=GUID-DE3A46DA-508E-43A0-8538-C77D978D06B2
Can't find what you're looking for? Ask the community or share your knowledge.