.NET

Reply
Mentor
conormccartney3897
Posts: 186
Registered: ‎08-18-2010
Message 1 of 3 (223 Views)
Accepted Solution

Modfiy Profile View Direction

223 Views, 2 Replies
05-17-2013 09:54 AM

For Civil 3d 2013, im looking for a method to change the Profile View Direction of a Profile View Style in VB.NET.

*Expert Elite*
Jeff_M
Posts: 4,293
Registered: ‎07-22-2003
Message 2 of 3 (218 Views)

Re: Modfiy Profile View Direction

05-17-2013 10:46 AM in reply to: conormccartney3897

In case you weren't aware, there is a forum specifically for C3D Customization:

http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/bd-p/190

 

The GraphStyle property of the PVStyle sets the direction

 

oProfileViewStyle.GraphStyle.Direction = GraphDirectionType.RightToLeft

Jeff_M, also a frequent Swamper
Mentor
conormccartney3897
Posts: 186
Registered: ‎08-18-2010
Message 3 of 3 (201 Views)

Re: Modfiy Profile View Direction

05-17-2013 03:00 PM in reply to: Jeff_M

ah yes, i had forgotten about that forum. ah well that was pretty easy, i was missing an import so i never saw teh "ProfileViewStyle", thanks for the help! heres what i did with it:

Imports System
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.Civil
Imports Autodesk.Civil.ApplicationServices
Imports Autodesk.Civil.DatabaseServices.Styles
Imports Autodesk.Civil.Settings

' This line is not mandatory, but improves loading performances
<Assembly: CommandClass(GetType(ProfileLabelSettings.MyCommands))> 
Namespace ProfileLabelSettings
    Public Class MyCommands
        <CommandMethod("profilelabelsettingsbottom")>
        Public Sub proflabbot()
            Dim cdoc As CivilDocument = CivilApplication.ActiveDocument
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
            Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
            Dim proflabplace As SettingsCmdAddNetworkProfLabels = cdoc.Settings.GetSettings(Of SettingsCmdAddNetworkProfLabels)()
            Dim profviewstyle As ProfileViewStyle = Nothing
            Dim structbot As String
            Using tr As Transaction = db.TransactionManager.StartTransaction()
                If profviewstyle.GraphStyle.Direction = GraphDirectionType.LeftToRight Then
                    structbot = "MKA - Profile Structure Bottom Up Stream(L) to Down Stream(R)"
                Else
                    structbot = "MKA - Profile Structure Bottom Down Stream(L) to Up Stream(R)"
                End If
                Dim pipebot As String = "MKA - None"
                proflabplace.ProfileLabelPlacement.StructureLabelPlacement.Value = StructureProfileLabelPlacementType.AtStructureBottom
                proflabplace.Styles.StructureProfileLabel.Value = structbot
                proflabplace.ProfileLabelPlacement.DimensionAnchorOptionForStructures.Value = DimensionAnchorOptionType.Below
                proflabplace.ProfileLabelPlacement.DimensionAnchorPlotHeightValueForStructures.Value = 2 / 12
                proflabplace.Styles.PipeProfileLabel.Value = pipebot
                tr.Commit()
            End Using
            ed.WriteMessage(vbCrLf + "Structure Label Placement is: " + proflabplace.ProfileLabelPlacement.StructureLabelPlacement.Value.ToString())
            ed.WriteMessage(vbCrLf + "Structure Label is: " + proflabplace.Styles.StructureProfileLabel.Value.ToString())
            ed.WriteMessage(vbCrLf + "Pipe Label is: " + proflabplace.Styles.PipeProfileLabel.Value.ToString())
        End Sub
        <CommandMethod("profilelabelsettingstop")>
        Public Sub proflabtop()
            Dim cdoc As CivilDocument = CivilApplication.ActiveDocument
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
            Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
            Dim proflabplace As SettingsCmdAddNetworkProfLabels = cdoc.Settings.GetSettings(Of SettingsCmdAddNetworkProfLabels)()
            Dim structop As String = "MKA - Profile Structure Top"
            Dim pipetop As String = "MKA - Size Slope Profile"
            Using tr As Transaction = db.TransactionManager.StartTransaction()
                proflabplace.ProfileLabelPlacement.StructureLabelPlacement.Value = StructureProfileLabelPlacementType.AtStructureTop
                proflabplace.Styles.StructureProfileLabel.Value = structop
                proflabplace.ProfileLabelPlacement.DimensionAnchorOptionForStructures.Value = DimensionAnchorOptionType.Above
                proflabplace.ProfileLabelPlacement.DimensionAnchorPlotHeightValueForStructures.Value = 1 / 12
                proflabplace.Styles.PipeProfileLabel.Value = pipetop
                tr.Commit()
            End Using
            ed.WriteMessage(vbCrLf + "Structure Label Placement is: " + proflabplace.ProfileLabelPlacement.StructureLabelPlacement.Value.ToString())
            ed.WriteMessage(vbCrLf + "Structure Label is: " + proflabplace.Styles.StructureProfileLabel.Value.ToString())
            ed.WriteMessage(vbCrLf + "Pipe Label is: " + proflabplace.Styles.PipeProfileLabel.Value.ToString())
        End Sub
    End Class
End Namespace

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.