how to copy a block reference and maintain its original insertion point?

Anonymous

how to copy a block reference and maintain its original insertion point?

Anonymous
Not applicable

I try to deepclone a block reference and append it to a new block. When I append the new block reference to the model space, I found that the insertion point become the new Point3d(0,0,0). But the new block reference is in the same position in the model space  as the original one.

 

IdMapping idMapping = new IdMapping();
db.DeepCloneObjects(objectIdsToBeInsertedToANewBlock,newBlockId, idMapping, false);

BlockReference br = new BlockReference(new Point3d(0,0,0), newBlockId);
modelSpace.AppendEntity(br);

When I try to change the insertion point of the new block reference to the origin, the new block reference is moved to the origin.

I want to keep the insertion point and place in the  model space of the new block reference as the same as the original one.

0 Likes
Reply
Accepted solutions (1)
879 Views
4 Replies
Replies (4)

_gile
Mentor
Mentor

@Anonymous wrote:

I try to deepclone a block reference and append it to a new block.


What about simply insert the block reference in the new block definition?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes

Anonymous
Not applicable

I just want to make sure that the block reference's insertion point is at the origin(0,0,0) of the new block definition. And the block reference of the new block defintion is on the original block reference position.

0 Likes

artc2
Autodesk
Autodesk
It's not clear to me exactly what you are doing and what is actually happening vs. what you want to happen. Perhaps it would help if you could provide a more complete code sample of what you are doing and some screen shots of what happens and what you want to happen.

Anonymous
Not applicable
Accepted solution

I have already solved this problem.

 

Use BlockTableRecord.Origin to control the point (in MCS) to insert the block record.

 

User the 1st parameter of the constructor new BlockReference() to control the insertion point in WCS.

 

And the default value of BlockTableRecord.Origin is (0,0,0) in MCS

0 Likes