.NET

Reply
Contributor
cbutler1
Posts: 25
Registered: ‎11-13-2006
Message 1 of 1 (96 Views)

Copy Displayset

96 Views, 0 Replies
05-23-2012 02:23 PM

We're trying to copy the Displayset but having trouble. Has anyone been able to get this to work?  Here's a snippet of one attempt:

 

    Public Shared Sub CopyMEPDisplaySet2(ByVal FileDB As Database, ByVal SourceDB As Database)
        Using acTrans As Transaction = FileDB.TransactionManager.StartTransaction()
            Dim dds1 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(FileDB, True)
            Dim dds2 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(SourceDB, True)
            For Each OID As ObjectId In dds1.Records
                Dim ds As Autodesk.Aec.DatabaseServices.DisplaySet = TryCast(acTrans.GetObject(OID, OpenMode.ForRead, True, True), Autodesk.Aec.DatabaseServices.DisplaySet)
                If ds IsNot Nothing Then
                    Dim dssID As ObjectId = dds2.GetAt(ds.Name)
                    If dssID.IsNull = False Then
                        Dim dss As Autodesk.Aec.DatabaseServices.DisplaySet = TryCast(dssID.GetObject(OpenMode.ForRead, True, True), Autodesk.Aec.DatabaseServices.DisplaySet)
                        ds.UpgradeOpen()
                        ds.CopyFrom(dss)
                        ds.DowngradeOpen()
                    End If
                End If
            Next

            acTrans.Commit()
        End Using
    End Sub

 This fails to successfully copy.  Here's a couple other attempts:

 

    Public Shared Sub CopyMEPDisplaySet1(ByVal FileDB As Database, ByVal SourceDB As Database)
        Using acTrans As Transaction = FileDB.TransactionManager.StartTransaction()
            Dim dds1 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(FileDB, True)
            Dim dds2 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(SourceDB, True)

            dds1.CopyFrom(dds2)

            acTrans.Commit()
        End Using
    End Sub


    Public Shared Sub CopyMEPDisplaySet3(ByVal FileDB As Database, ByVal SourceDB As Database)
        Dim objColIDS As New ObjectIdCollection()
        Using acTrans As Transaction = FileDB.TransactionManager.StartTransaction()
            Dim dds1 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(FileDB, True)
            Dim dds2 As New Autodesk.Aec.DatabaseServices.DictionaryDisplaySet(SourceDB, True)
            For Each OID As ObjectId In dds2.Records
                objColIDS.Add(OID)
            Next

            Dim helpme As New Autodesk.Aec.ApplicationServices.Utility.CloningHelper
            '  uncomment one of these if you want to have a behavior other than default (i.e., overwrite). 
            'helpme.MergeType = Autodesk.Aec.OmfSamples.DictionaryRecordMergeBehavior.Unique; // rename 
            helpme.MergeType = Autodesk.Aec.ApplicationServices.Utility.DictionaryRecordMergeBehavior.Overwrite
            ' no overrite + add overlapping ones as anonymous name (probably internal use only.)  
            'helpme.MergeType = Autodesk.Aec.OmfSamples.DictionaryRecordMergeBehavior.Normal; // no overrite.  
            '  finally call clone. 
            helpme.UseTransactions = True
            helpme.IncludeDefaultDisplaySystem = True
            helpme.OverwriteDependentAutoCADObjects = True

            helpme.Clone(SourceDB, FileDB, objColIDS, dds1.GetRXClass, True)

            acTrans.Commit()
        End Using
    End Sub

 

Craig

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

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 to get help installing your software.

Ask the Community