I am using VS 2010 and AutoCAD Map 3D 2012.
I am opening a dwg say A.dwg and selecting few entities on it. I am trying to copy it to another dwg say B.dwg.
For this, I have used WblockCloneObjects function.
The objects are copied to B.dwg as such, but without any reference to A.dwg coordinates.
The objects should be automatically copied to B.dwg at the same location/place/coordinates as in A.dwg.
Could you please let me know how should I modify the code to take the coordinates automatically from A.dwg and paste the objects at the same location in B.dwg?
Here is the code I am using for WblockCloneObjects. myObjs is a ObjectIDCollection which contains the entities/objects from A.dwg to be cloned/copied to B.dwg.
Using acLckDoc As DocumentLock = acSDoc.LockDocument
Using acTransNew As Transaction = acSDoc.Database.TransactionManager.StartTransactio
Dim acBlkTbl As BlockTable = acSDoc.Database.BlockTableId.GetObject(OpenMode.Fo
Dim acBlkTblRecord As BlockTableRecord = acTransNew.GetObject(acBlkTbl(BlockTableRecord.Mod
Dim acIdMap As IdMapping = New IdMapping()
acSDoc.Database.WblockCloneObjects(myObjs, acBlkTblRecord.ObjectId, acIdMap, DuplicateRecordCloning.Replace, False)
acSDocMgr.MdiActiveDocument = acSDoc
you don't need to take care of the coordinates as this function creates the new entities on exactly that position of the original drawing. Can you show us the source drawing and the destination drawing (after you let the code do it's things) so we see what is different?
Just a thought: you know that AutoCAD uses just WorldCoordinates for that deep functions. So be sure you don't have a user defined cs in any of these drawings when you compare the coordinate-values.
Also take care of the sysvar INSBASE, it might influence this situation too, but have not tried it now.
- alfred -
Access a broad range of knowledge to help get the most out of your products and services.