Trying something like this to maybe change the block properties to all zeros? oidc2 will always only have one block objectid in it.
Dim destData As New Database(True, False)
Using transNewDb As Transaction = destData.TransactionManager.StartTransaction()
Dim bt As BlockTable = TryCast(transNewDb.GetObject(destData.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btrMs2 As BlockTableRecord = TryCast(bt(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForRead), BlockTableRecord)
Dim idmap As New IdMapping
'destData.WblockCloneObjects(oidc2, bt(BlockTableRecord.ModelSpace), idmap, DuplicateRecordCloning.Replace, False)
database.Wblock(destData, oidc2, New Point3d(0, 0, 0), DuplicateRecordCloning.Ignore)
'go through each object in the block table record
For Each entID2 As ObjectId In btrMs2
'create variable used to determine is it is a block reference
Dim ent2 As Entity = transNewDb.GetObject(entID2, OpenMode.ForRead, False)
'if it is a block then perform code below
If TypeOf ent2 Is BlockReference Then
Dim blkRef2 As BlockReference = TryCast(transNewDb.GetObject(entID2, OpenMode.ForWrite, False), BlockReference)
blkRef2.Position = New Point3d(0, 0, 0)
blkRef2.Rotation = 0
End If
Next
transNewDb.Commit()
destData.SaveAs(strSaveDir & "\" & strFileDir & " - parts\" & strBlockName & ".dwg", DwgVersion.Newest)
ok = True
End Using
This seems to do what I want...
Dim destData As New Database(True, False)
Using transNewDb As Transaction = destData.TransactionManager.StartTransaction()
Dim bt As BlockTable = TryCast(transNewDb.GetObject(destData.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btrMs2 As BlockTableRecord = TryCast(bt(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForRead), BlockTableRecord)
Dim idmap As New IdMapping
'destData.WblockCloneObjects(oidc2, bt(BlockTableRecord.ModelSpace), idmap, DuplicateRecordCloning.Replace, False)
database.Wblock(destData, oidc2, New Point3d(0, 0, 0), DuplicateRecordCloning.Ignore)
'go through each object in the block table record
For Each entID2 As ObjectId In btrMs2
'create variable used to determine is it is a block reference
Dim ent2 As Entity = transNewDb.GetObject(entID2, OpenMode.ForRead, False)
'if it is a block then perform code below
If TypeOf ent2 Is BlockReference Then
Dim blkRef2 As BlockReference = TryCast(transNewDb.GetObject(entID2, OpenMode.ForWrite, False), BlockReference)
Dim vec As New Vector3d(0, 0, 1)
blkRef2.Normal = vec
blkRef2.Position = New Point3d(0, 0, 0)
blkRef2.Rotation = 0
blkRef2.ScaleFactors = New Scale3d(0)
End If
Next
transNewDb.Commit()
destData.SaveAs(strSaveDir & "\" & strFileDir & " - parts\" & strBlockName & ".dwg", DwgVersion.Newest)
ok = True
End Using