.NET

.NET

Reply
Distinguished Contributor
229 Posts
1 Kudo
Registered: ‎04-26-2005
Post 1 of 4

DeepCloneObjects with dynamic properties

241 Views, 3 Replies
02-09-2007 06:36 AM
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)
*Tony Tanzillo
Post 2 of 4

Re: DeepCloneObjects with dynamic properties

02-09-2007 09:29 AM in reply to: Patrick Johnson
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)
Distinguished Contributor
229 Posts
1 Kudo
Registered: ‎04-26-2005
Post 3 of 4

Re: DeepCloneObjects with dynamic properties

02-09-2007 11:49 AM in reply to: Patrick Johnson
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
*Tony Tanzillo
Post 4 of 4

Re: DeepCloneObjects with dynamic properties

02-09-2007 05:31 PM in reply to: Patrick Johnson
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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post