.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

0 REPLIES 0
Reply
Message 1 of 1
dheselwood
281 Views, 0 Replies

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

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)
TempDB.AddDBObject(BTR)
Loop
Trans.Commit()
Trans.Dispose()
MsgBox("new database done")
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost