Author Topic: Set Plot Sheet in layout  (Read 1966 times)

0 Members and 1 Guest are viewing this topic.


  • Newt
  • Posts: 64
Set Plot Sheet in layout
« on: May 18, 2023, 09:56:01 AM »
the code does what I want but when I run the publisher it uses the old settings not the new one.

Public Sub SetPlotSheet(ByVal plotStyleToSet As String)
            Dim ReturnValue As Boolean = True
            Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
            Dim acCurDb As Database = acDoc.Database

            Using acLckDocCur As DocumentLock = acDoc.LockDocument
                Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
                    Dim AcLayouts As DBDictionary = TryCast(acTrans.GetObject(acCurDb.LayoutDictionaryId, OpenMode.ForRead), DBDictionary)

                    For Each item As DBDictionaryEntry In AcLayouts
                        Dim layoutId As ObjectId = item.Value

                        Dim acLayout As Layout = TryCast(acTrans.GetObject(layoutId, OpenMode.ForWrite), Layout)
                        Dim sPlotSettingName As String = acLayout.PlotSettingsName

                        Dim acPlSet As DBDictionary = acTrans.GetObject(acCurDb.PlotSettingsDictionaryId, OpenMode.ForRead)
                        Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
                        Dim sheetList2 As System.Collections.Specialized.StringCollection = acPlSetVdr.GetPlotStyleSheetList

                        'If acPlSet.Contains(sPlotSettingName) = True Then
                        '    Dim plSet As PlotSettings = acPlSet.GetAt(sPlotSettingName).GetObject(OpenMode.ForWrite)
                        '    acPlSetVdr.RefreshLists(plSet)

                        '    If sheetList2.Contains(plotStyleToSet) Then
                        '        acPlSetVdr.SetCurrentStyleSheet(plSet, plotStyleToSet)
                        '        acLayout.CopyFrom(plSet)
                        '    End If
                        'End If

                        If acPlSet.Contains(sPlotSettingName) = True Then
                            If sheetList2.Contains(plotStyleToSet) Then
                                acPlSetVdr.SetCurrentStyleSheet(acLayout, plotStyleToSet)
                            End If
                        End If

                End Using
            End Using
        End Sub


  • Newt
  • Posts: 64
Re: Set Plot Sheet in layout
« Reply #1 on: May 18, 2023, 01:51:45 PM »
fixed it.
forgot to set PlotPlotStyles = True