Author Topic: Add alignment station offset labels  (Read 3605 times)

0 Members and 1 Guest are viewing this topic.

krkec

  • Guest
Add alignment station offset labels
« on: October 07, 2013, 07:14:53 AM »
Hi

Can someone tell me how to add alignment station offset labels with vb.net.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Add alignment station offset labels
« Reply #1 on: October 07, 2013, 08:58:24 AM »
Dim StaOffId As ObjectId = StationOffsetLabel.Create(alignmentId, labelStyleId, markerStyleId, location)

Location is given as a 2d point

krkec

  • Guest
Re: Add alignment station offset labels
« Reply #2 on: October 07, 2013, 04:02:19 PM »
Thanks

but where can I learn Civil3d api.
For example I have another problem  - how to change LableSyle layer and a searched internet and developers guide  and I cant find anything.


Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Add alignment station offset labels
« Reply #3 on: October 07, 2013, 04:21:21 PM »
You have to examine the API documentation. http://docs.autodesk.com/CIV3D/2013/ENU/API_Reference_Guide/index.html

The Layer Property of a labelstyle is buried in the style here, where styl is a LabelStyle object opened for Read:
styl.Properties.Label.Layer.Value

This returns the Name of the layer as a string.

krkec

  • Guest
Re: Add alignment station offset labels
« Reply #4 on: October 07, 2013, 04:36:27 PM »
But how i change it

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Add alignment station offset labels
« Reply #5 on: October 07, 2013, 04:38:55 PM »
Give it a new value after changing the OpenMode....

styl.UpgradeOpen()
styl.Properties.Label.Layer.Value = "NewLayerName"
styl.DowngradeOpen()

krkec

  • Guest
Re: Add alignment station offset labels
« Reply #6 on: October 07, 2013, 04:53:07 PM »
But  layer is still read only

here is my code:
            Dim opt As PromptEntityOptions = New PromptEntityOptions("\nOdaberite apligment:")
            opt.SetRejectMessage("\nObjekt mora biti aligment")
            opt.AddAllowedClass(GetType(Alignment), False)
            Dim alignid As ObjectId = ed.GetEntity(opt).ObjectId
            Dim align As Alignment = TryCast(tr.GetObject(alignid, OpenMode.ForRead), Alignment)
            Dim StacOff As ObjectId = doc.Styles.LabelStyles.AlignmentLabelStyles.StationOffsetLabelStyles.Add("Ceste")
            Dim last As Autodesk.Civil.DatabaseServices.Styles.LabelStyle = StacOff.GetObject(OpenMode.ForWrite)
            Dim StacOff1 As ObjectId = last.CopyAsSibling("Ceste2")
         Dim last1 As Autodesk.Civil.DatabaseServices.Styles.LabelStyle = StacOff1.GetObject(OpenMode.ForWrite)
         last1.UpgradeOpen()
            last1.Properties.Label.Layer = "0"
            last1.DowngradeOpen()

my app goal is to simpy copy Labelsstyle and hange its layer

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Add alignment station offset labels
« Reply #7 on: October 07, 2013, 05:13:49 PM »
        Dim last1 As Autodesk.Civil.DatabaseServices.Styles.LabelStyle = StacOff1.GetObject(OpenMode.ForWrite)
         ''last1.UpgradeOpen() ''not needed since you opened it for Write already
            last1.Properties.Label.Layer.Value = "0" ''you omitted the Value portion
           '' last1.DowngradeOpen() ''remove since UpgradeOpen isn't used

krkec

  • Guest
Re: Add alignment station offset labels
« Reply #8 on: October 07, 2013, 05:19:58 PM »
Biiiig thanks Jeff