.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Copy object inside same drawing... problems
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I've been using this method for "copying" objects from one point to another..
Dim EntityCopy As Entity = EntitySource.GetTransformedCopy(Matrix3d.Displacem
But have run into a few glitches, not program stopping glitches just annoying ones..
With polylines, not all the properties are copied, one for example is the "global width". it gets re-set to 0.
Problem is with dynamic blocks.. the above method creates a "dumb" version of the block rather than a functional dynamic version of the block..
Can anyone show me a way to fix this, or an alternate method for copying objects from point a to point b?
Solved! Go to Solution.
Re: Copy object inside same drawing... problems
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
In that case as for Tony Tanzillo's recomendation I wouldt use
DeepCloneObjects method of DataBase instead
Try this quicky
No error trapping in there, do it by yourself
<CommandMethod("como")> _
Public Shared Sub CopyMove()
Dim doc As Document = acApp.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Dim peo As New PromptEntityOptions(vbLf & "Select object:")
Dim per As PromptEntityResult = ed.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
Dim startPT As Point3d = ed.GetPoint(vbCr & "Pick a point from: ").Value
Dim EndPT As Point3d = ed.GetPoint(vbCr & "Pick a point to: ").Value
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
Dim sourceId As ObjectId = per.ObjectId
Dim EntitySource As Entity = CType(tr.GetObject(sourceId, OpenMode.ForRead), Entity)
Dim ids As New ObjectIdCollection()
ids.Add(sourceId)
db.DeepCloneObjects(ids, db.CurrentSpaceId, New IdMapping, False)
Dim EntityCopy As Entity = CType(tr.GetObject(ids(0), OpenMode.ForRead), Entity)
EntityCopy.UpgradeOpen()
EntityCopy.TransformBy(Matrix3d.Displacement(start PT.GetVectorTo(EndPT)))
EntityCopy.ColorIndex = 2
tr.Commit()
End Using
C6309D9E0751D165D0934D0621DFF27919
Re: Copy object inside same drawing... problems
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you, that is perfect. ![]()
Re: Copy object inside same drawing... problems
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You're welcome ![]()
Glad to help
Regards,
Oleg
~'J'~
C6309D9E0751D165D0934D0621DFF27919
Re: Copy object inside same drawing... problems
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Working with making blocks from existing entities in a file. I've run into problems with iterating through the entities within a selection set and writing them to my new blocktablerecord. How do I take those items from my selection set and add them to this new block? All thoughts and help are appreciated.
