Active Contributor
35 Posts
0 Kudos
Registered: ‎11-17-2003
Post 1 of 1

replace with blocks in a drawing with the blocks from another drawing

148 Views, 0 Replies
06-23-2009 07:11 AM
Ok, im struggling a little here, I think I have all the right functions under my hat but cant seem to string them together, what im trying to achieve is replacing all the blocks in one drawing with all the blocks of the same name in another drawing.

so the process im going through is:

1. Open up the 2 drawings and match up the block names - done
2. Create a new database and add the blocks from the source drawing that matched the final drawing - stuck
3. copy the blocks from the new database into the final drawing - this should be easy once ive got part 2 done.

Any help please?

Below is the example of where I got to but I get an error stating the block is already in the database

Dim ThisDrawing As Document = Application.DocumentManager.Open(SourceLoca.Text, True)
Dim ThisDB As Database = ThisDrawing.Database
Dim Trans As Transaction = ThisDB.TransactionManager.StartTransaction
Dim BT As BlockTable = Trans.GetObject(ThisDB.BlockTableId, OpenMode.ForRead)
Dim BTenum As SymbolTableEnumerator = BT.GetEnumerator
Dim TempDB As Database = New Database(True, True)

Do While BTenum.MoveNext = True
Dim BTR As BlockTableRecord = BTenum.Current.GetObject(OpenMode.ForRead)
MsgBox("new database done")
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!