.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Copy Displayset
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
57 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 SubThis 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.CloningHe lper
' uncomment one of these if you want to have a behavior other than default (i.e., overwrite).
'helpme.MergeType = Autodesk.Aec.OmfSamples.DictionaryRecordMergeBehav ior.Unique; // rename
helpme.MergeType = Autodesk.Aec.ApplicationServices.Utility.Dictionar yRecordMergeBehavior.Overwrite
' no overrite + add overlapping ones as anonymous name (probably internal use only.)
'helpme.MergeType = Autodesk.Aec.OmfSamples.DictionaryRecordMergeBehav ior.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

