Author Topic: vb.NET Civil3D Label Styles - Child Styles  (Read 1612 times)

0 Members and 1 Guest are viewing this topic.

stevenh0616

  • Guest
vb.NET Civil3D Label Styles - Child Styles
« on: November 12, 2012, 09:52:15 AM »
Hi all,

Working on a little app that will insert Surface Elevation Labels. I'm working on getting a combo box to fill with all of the surface elevation label styles and have the whole app working other than child styles. We have some standard styles that are children of other styles and the following code will get the parent style, but will not get the children.

Code - vb.net: [Select]
  1. For Each Style As ObjectId In CivilDoc.Styles.LabelStyles.SurfaceLabelStyles.SpotElevationLabelStyles
  2.        Dim oStyle As Styles.LabelStyle = TryCast(Style.GetObject(OpenMode.ForRead), Styles.LabelStyle)
  3.        mycombo.items.add = oStyle.Name
  4. Next

I've looked at the oStyle thinking that the children would belong to that to see if there was a way to get the children but only a few items list for children... they are:
Code - vb.net: [Select]
  1. Dim oStyle As Styles.LabelStyle = TryCast(Style.GetObject(OpenMode.ForRead), Styles.LabelStyle)
  2.        oStyle.AddChild("Test")
  3.        oStyle.ChildrenCount
  4.        oStyle.RemoveChild(1)

So it appears to me that you can Add a child style, remove a child style and get the number of children, but I don't see a GetChildStyles or something to that effect. Anyone have any ideas?

Thanks.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: vb.NET Civil3D Label Styles - Child Styles
« Reply #1 on: November 12, 2012, 12:00:47 PM »
I'm pretty sure the Item property of the Style will yield the Child Styles. There are 2 overloads, Item(Int32) & Item(String), so you can either get them by the Index or Name.