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: 

breakFeatures automatically

37 REPLIES 37
SOLVED
Reply
Message 1 of 38
joantopo
906 Views, 37 Replies

breakFeatures automatically

Hi.

Civil 3D has command: BreakFeatures.

 

I want to do the same but automatically.

I have a point3dcollection and feature line Id.

 

I want to create a new break for each point3d position.

 

Are there any ways to do this?

 

Perhaps I could use breakfeatures with "SendToExecute" but how can I do it  without any requests to user?

 

Thank you.

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
37 REPLIES 37
Message 21 of 38
Jeff_M
in reply to: joantopo

I think you are out of luck with the SurveyFigures. These are created using the Survey database and cannot be directly created by the user (or developer). We can glean information from them, but not much else.

Jeff_M, also a frequent Swamper
EESignature
Message 22 of 38
joantopo
in reply to: Jeff_M

OK.

Then, I will ask to user by prompt(line command) if he want to convert all survey figures to feature lines.

 

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 23 of 38
joantopo
in reply to: joantopo

Hi Jeff.

 

Have you been able to improve the GetSplitFeaturelines() method?

 

 

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 24 of 38
Jeff_M
in reply to: joantopo

Not yet, Joan. Hope to have it working properly soon.
Jeff_M, also a frequent Swamper
EESignature
Message 25 of 38
Jeff_M
in reply to: Jeff_M

Sorry for the delay, Joan. Here is a working version of the GetSplitFeaturelines() extension method. It works with your test drawing, even when adding elevation points along the featurline. Only accepts Point3dCollection to define where the breaks are to be. Also tested with arc'ed featurelines and appears to be working in all cases.

 

        /// <summary>
        /// Method to split a Featureline using Point3dCollection
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static DBObjectCollection GetSplitFeaturelines(this FeatureLine fline, Point3dCollection pts)
        {
            DBObjectCollection ids = new DBObjectCollection();
            Polyline poly = fline.BaseCurve2d();
            DBObjectCollection splitpolys = poly.GetSplitCurves(pts);
            using (Transaction tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
            {
                AcApp.Document doc = AcApp.Application.DocumentManager.MdiActiveDocument;
                Database db = doc.Database;
                BlockTable bt = (BlockTable)db.BlockTableId.GetObject(OpenMode.ForRead);
                BlockTableRecord btr = (BlockTableRecord)bt[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForWrite);
                Site site = (Site)fline.SiteId.GetObject(OpenMode.ForRead);
                ObjectId siteId = fline.ObjectId;
                FeatureLineStyle style = (FeatureLineStyle)fline.StyleId.GetObject(OpenMode.ForRead);
                double[] elevpts = fline.GetPoints(2);

                fline.Erase(); //temporarily erase the featureline to prevent it from affecting the elevations of the new f/l's
                foreach (Polyline p in splitpolys)
                {
                    btr.AppendEntity(p);
                    tr.AddNewlyCreatedDBObject(p, true);
                    ObjectId newflId = site.AddFeatureFromPoly(p, style);
                    p.Erase();
                    FeatureLine newfl = (FeatureLine)newflId.GetObject(OpenMode.ForWrite);
                    newfl.Layer = fline.Layer;
                    //Set the new PI elevations
                    foreach (Point3d pt3d in pts)
                    {                        
                        try
                        {
                            newfl.SetPointElevation(pt3d);
                        }
                        catch { }
                    }
                    //Add in the elevation points
                    for (int i = 0; i < elevpts.GetLength(0); i = i + 3)
                    {
                        try
                        {
                            Point3d newpt = new Point3d(elevpts[i], elevpts[i + 1], elevpts[i + 2]);
                            newfl.InsertPoint(newpt, 2);
                        }
                        catch { }
                    }
                    ids.Add(newfl);                    
                }
                fline.Erase(false);//now unerase the f/l
                tr.Commit();
            }
            return ids;
        }

 

 

Jeff_M, also a frequent Swamper
EESignature
Message 26 of 38
joantopo
in reply to: Jeff_M

Thank you very much, Jeff. I will try it today.
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 27 of 38
joantopo
in reply to: joantopo

Hi Jeff. Could you try this drawing file with your new method? Sometimes it works fine with arcs and point elevations but with this example doesn´t work fine. Thanks.
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 28 of 38
joantopo
in reply to: joantopo

I can´t edit last message. I wanted to say "check the drawing file".
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 29 of 38
joantopo
in reply to: joantopo

this is the drawing file.
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 30 of 38
Jeff_M
in reply to: joantopo

Looks like the attachments aren't working for your drawing. You can email me direct at jeffm AT quuxsoft DOT com
Jeff_M, also a frequent Swamper
EESignature
Message 31 of 38
joantopo
in reply to: Jeff_M

Hi Jeff. I think that I have found the bug. autoCAD Civil 3D 2014 has a bug with GetSplitCurves You use that method : DBObjectCollection splitpolys = poly.GetSplitCurves(pts); For example, in this drawing file, I have a polyline. If I try to split the polyline I have the same error if I convert it to feature line and then use your method. https://www.mediafire.com/?ihud5gkurrdgn0i In this case, GetSplitCurves should return 13 new segments and only returns 8. I think that your method works fine. The trouble is GetSplitCurves() from autoCAD API.
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 32 of 38
joantopo
in reply to: joantopo

perhaps is this,

 

http://adndevblog.typepad.com/autocad/2012/09/acdbpolylinegetsplitcurves-only-adds-new-vertices-in-s...

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 33 of 38
Jeff_M
in reply to: joantopo

Not sure why you are only getting 8 segments, Joan. I'm getting 13 as expected:

1-18-2014 3-25-27 PM.png

 

How are you getting the Point3dCollection defining the intersection points? This is what I used after converting the long polyline to a featureline:

                Point3dCollection points = new Point3dCollection();
                Plane planeXY = new Plane(new Point3d(0, 0, 0), Vector3d.ZAxis);
                fl.IntersectWith(pline, Intersect.OnBothOperands, planeXY, points, IntPtr.Zero, IntPtr.Zero);
                try
                {
                    points.Remove(fl.StartPoint);
                }
                catch
                { }
                try
                {
                    points.Remove(fl.EndPoint);
                }
                catch { }

                DBObjectCollection dbc = fl.GetSplitFeaturelines(points);

 

Jeff_M, also a frequent Swamper
EESignature
Message 34 of 38
joantopo
in reply to: joantopo

Is strange because I do IntersectWith() also. Perhaps is this: "The behavior of getSplitCurves() is affected by the order of the points in the AcGePoint3dArray. If the points are appended to the AcGePoint3dArray in the order that they would be if they were measured from the start point of the polyline then the expected behavior occurs. (two polylines are returned). The following code snippet uses this approach. It finds the distance on the curve from the start of the curve to the point, and then add the points to the array in the order of their distance from the start of the curve. " I´m going to check the order of the returned points with IntersectWith().
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 35 of 38
joantopo
in reply to: joantopo

This is my point3dcollection that i get using IntersectWith() {(22253.6286721642,10175.6595364167,0)} {(22565.5511610607,10154.521986322,0)} {(21697.5303172888,10213.343760069,0)} {(21899.4227926654,10199.6624370996,0)} {(20970.2442938738,10493.6080228632,0)} {(20797.9019969427,10711.031953553,0)} {(21348.4907711799,11700.0371465383,0)} {(21074.7143128375,11345.3010261631,0)} {(22326.4630667873,11807.985975522,0)} {(23738.1939874421,11577.9079377702,0)} {(23693.4108665027,10560.7814278764,0)} {(23839.0633251464,10867.7008067035,0)} They are disordered.
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 36 of 38
Jeff_M
in reply to: joantopo

Can you share some code, Joan? No matter how I use IntersectWith() I get 12 points, all in correct order.

Jeff_M, also a frequent Swamper
EESignature
Message 37 of 38
joantopo
in reply to: Jeff_M

I have you sent an email.
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 38 of 38
Jeff_M
in reply to: joantopo

OK, looks like we cannot expect the IntersectWith() method to return the Points in any particular order. Must sort them in order to properly use GetSplitCurves(). Must go check my own code now....
Jeff_M, also a frequent Swamper
EESignature

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

Post to forums  

Rail Community


Autodesk Design & Make Report