Author Topic: Add/Modify BreaklineSet with own description  (Read 2332 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Add/Modify BreaklineSet with own description
« on: October 18, 2015, 05:50:05 AM »
Hello!
Itīs a little confusing in COM-API is it possible to set a name for description
Code: [Select]
' Create the polyline basis for the breakline.
Dim o3DPoly as Acad3DPolyline
Dim dPoints(0 To 8) As Double
dPoints(0) = 1200: dPoints(1) = 1200: dPoints(2) = 150
dPoints(3) = 2000: dPoints(4) = 3000: dPoints(5) = 120
dPoints(6) = 3000: dPoints(7) = 2000: dPoints(8) = 100
Set o3DPoly = oAeccDocument.Database.ModelSpace _
  .Add3DPoly(dPoints)
o3DPoly.Closed = False
Dim oBreakline As AeccSurfaceBreakline
Dim vBLines As Variant
' This has to be an array, even if we only have one entity.
Dim oEntityArray(0) As AcadEntity
Set oEntityArray(0) = oAeccDocument.Database.ModelSpace _
  .Add3DPoly(dPoints)
Set oBreakline = oTinSurface.Breaklines.AddStandardBreakline _
  (oEntityArray, "Sample Standard Break" , 1#)


But not in Civil-API with C#.net
Code: [Select]
Tinsurface.BreaklinesDefinition.AddStandardBreaklines(ObjIdColl, 10, 5, 5, 0);
Is there a way to can manipulate description. I always get a name "Breakline Set..." I donīt like

BlackBox

  • King Gator
  • Posts: 3770
Re: Add/Modify BreaklineSet with own description
« Reply #1 on: October 18, 2015, 11:01:13 AM »
AddStandardBreaklines() Method returns a SurfaceOperationAddBreakline object which provides a Description Property.

For reference:

http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/html/5897aaea-ff18-097a-ffda-25e84385826d.htm

http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/index.html



Cheers
"How we think determines what we do, and what we do determines what we get."

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Add/Modify BreaklineSet with own description
« Reply #2 on: October 19, 2015, 03:59:37 AM »
Thank you, but I didnīt found an option to can set the description for a Breaklineset. In my code I tryed to.
If I read it works, but not if I write in TinSurface ?!
Is it maybe possible to add Breaklines to a defintion Breaklineset or to can modify I have to read all breaklinesets and than create it new with selected lines?

Code: [Select]
        public static IList<BreaklineSet> ReadBreaklineSet()
        {
            IList<BreaklineSet> m_BreaklineList = new List<BreaklineSet>();
            Document acadDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

            using (Transaction tr = acadDoc.TransactionManager.StartTransaction())
            {

                foreach (ObjectId surfId in CivilApplication.ActiveDocument.GetSurfaceIds())
                {
                    TinSurface surf = tr.GetObject(surfId, OpenMode.ForRead) as TinSurface;
                    if (surf != null)
                    {
                        SurfaceDefinitionBreaklines brkdefs = surf.BreaklinesDefinition;
                        for (int i = 0; i < brkdefs.Count; i++)
                        {
                            SurfaceOperationAddBreakline brklines = brkdefs[i];
                            for (int j = 0; j < brklines.Count; j++)
                            {
                                SurfaceBreakline brkline = brklines[j];
                                m_BreaklineList.Add(new BreaklineSet
                                {
                                    SurfOperAddBreaklDescr = brklines[j].Description,
                                    SurfDefBreaklDescr = brkdefs[i].Description,
                                    SurfBreakl = brkline
                                });
                           }
                        }
                    }
                }
                tr.Commit();
            }
            return m_BreaklineList;
        }

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Add/Modify BreaklineSet with own description
« Reply #3 on: October 19, 2015, 04:15:33 AM »
Code: [Select]
    [DefaultMember("Item")]
    public class SurfaceOperationAddBreakline : SurfaceOperation, IEnumerable<SurfaceBreakline>
    {
        public SurfaceBreakline this[int index] { get; }

        public SurfaceBreaklineType BreaklineType { get; }
        public int Count { get; }
        public string Description { get; set; }
        public double MaximumDistance { get; }
        public double MidOrdinateDistance { get; }
        public double WeedingAngle { get; }
        public double WeedingDistance { get; }

        public virtual IEnumerator<SurfaceBreakline> GetEnumerator();
        public IEnumerator GetObjectEnumerator();
        public ObjectIdCollection InsertIntoDrawing();
    }

It must be possible to set description for a breaklineset or ?!

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Add/Modify BreaklineSet with own description
« Reply #4 on: October 19, 2015, 04:40:48 AM »
I get it:
Code: [Select]
        public void AddBreaklinesBySset()
        {
            Surface surf = new Surface();
            surf.SelectTinSurface();
            ObjectIdCollection coll = Selection.SsetFilter("Layer1", "LWPOLYLINE");
            surf.Tinsurface.BreaklinesDefinition.AddStandardBreaklines(coll, 10, 5, 5, 0);

            SurfaceDefinitionBreaklines brkdefs = surf.Tinsurface.BreaklinesDefinition;
            SurfaceOperationAddBreakline brklines = brkdefs[0];
            brklines.Description = "Test";

        }

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Add/Modify BreaklineSet with own description
« Reply #5 on: October 19, 2015, 08:25:25 AM »
I get it:
Code: [Select]
        public void AddBreaklinesBySset()
        {
            Surface surf = new Surface();
            surf.SelectTinSurface();
            ObjectIdCollection coll = Selection.SsetFilter("Layer1", "LWPOLYLINE");
            surf.Tinsurface.BreaklinesDefinition.AddStandardBreaklines(coll, 10, 5, 5, 0);

            SurfaceDefinitionBreaklines brkdefs = surf.Tinsurface.BreaklinesDefinition;
            SurfaceOperationAddBreakline brklines = brkdefs[0];
            brklines.Description = "Test";

        }

This way you asume there is only one breakline set. There are multiple breakline sets possible.

The function to add breaklines does not have a parameter for a description. Adding Drawing objects does have a function to add an ObjectIdCollection and a description at once. But breaklines does not. You can create a new breaklineset object, but that object does not have an option to add an ObjectIdCollection.

The best way you can do is adding a breakline set, and then you change the description of the last breakline set.

Code: [Select]
brkdefs[brkdefs.Count - 1].Description = "Test";

Of course inside a Try/catch, to be sure :-)
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Add/Modify BreaklineSet with own description
« Reply #6 on: October 19, 2015, 09:09:50 AM »
Yes thank you works fine for me.
What ar you thinking about manipulate a breaklineset, is it better to delete and create a new or is it possible to add breaklines to a defintion breaklineset?

Maybe you reply at last, so I think I have to read all Breaklinesets , get sort number (BreaklinePosition in Surface) and than create a new Breakline(definition) and move to same position in sorting all breaklinesets in surface
 
The question is, can I delete "one" Breaklineset in a Surface an create a new Breaklineset on same Position as before? Picture shows to remove alle Breaklines in a Surface with metod RemoveAt(0). But I have 2 or 3 SurfaceBreaklineDefinitions and want remove only number 2 for example. And than create a new Breaklineset on second Position
« Last Edit: October 19, 2015, 10:24:30 AM by cadplayer »

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Add/Modify BreaklineSet with own description
« Reply #7 on: October 19, 2015, 01:30:28 PM »
You cannot modify a breakline set so it is better to remove it and add a new one.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Add/Modify BreaklineSet with own description
« Reply #8 on: October 22, 2015, 02:11:16 PM »
Thanks again, I get it.