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

DeepCloneObjects with dynamic properties

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
486 Views, 3 Replies

DeepCloneObjects with dynamic properties

I am copying a block with dynamic properties using the deepcloneobject method (see code below). What steps am I missing becasue the dynamic properties are not cloning. Help would be much appreciated.

thanks

pat

Dim NewBTR As New BlockTableRecord '= CType(NewBlk, BlockTableRecord)
NewBTR.Name = "COL-JAMB"
Dim NewBlkID As ObjectId = Table.Add(NewBTR)

Trans.AddNewlyCreatedDBObject(NewBTR, True)

Dim objId As Object
Dim idColl As New ObjectIdCollection
For Each objId In Blk
idColl.Add(objId)
Next

Dim idMapp As New IdMapping
DB.DeepCloneObjects(idColl, NewBlkID, idMapp, False)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

If the dynamic block references you're trying to copy are in
model or paper space, then your code is not coping them, it
is copying the contents of the block referenced by your 'Blk'
variable.

To copy objects in model space, the model space block id
should be used as the second parameter to DeepCloneObjects.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5481138@discussion.autodesk.com...
I am copying a block with dynamic properties using the deepcloneobject method (see code below). What steps am I missing becasue the dynamic properties are not cloning. Help would be much appreciated.

thanks

pat

Dim NewBTR As New BlockTableRecord '= CType(NewBlk, BlockTableRecord)
NewBTR.Name = "COL-JAMB"
Dim NewBlkID As ObjectId = Table.Add(NewBTR)

Trans.AddNewlyCreatedDBObject(NewBTR, True)

Dim objId As Object
Dim idColl As New ObjectIdCollection
For Each objId In Blk
idColl.Add(objId)
Next

Dim idMapp As New IdMapping
DB.DeepCloneObjects(idColl, NewBlkID, idMapp, False)
Message 3 of 4
Anonymous
in reply to: Anonymous

Tony, thanks

Apparently you need to create a new database and use wblockcloneobjects to be able to clone the dynamic properties. Did use the block ID also

pat
Message 4 of 4
Anonymous
in reply to: Anonymous

Duh... sorry. The reason the dynamic properties are
not cloned, is because the properties are the same
in the source and copies. The way dynamic blocks
work is that the properties that control the insertion's
appearance are stored on the proxy anonymous block
that holds the unique geometry.

So, copying a dynamic block reference does not result
in a copy of the anonymous block definition and the
dynamic properties, it just results in another reference
to the same anonymous block def. If you modify a
property of a copy, then a new anonymous block def
and dynamic properties are created for the modified
dynamic block reference.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5481832@discussion.autodesk.com...
Tony, thanks

Apparently you need to create a new database and use wblockcloneobjects to be able to clone the dynamic properties. Did use the block ID also

pat

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