TheSwamp
Code Red => .NET => Topic started by: Steve Hill on July 23, 2020, 09:05:11 PM
-
Has anyone had success in using WBlockCloneObjects() on polylines from an XREF?
Essentially I am copying polylines from an XREF and using WBlockCloneObjects() to place in the host database. This works fine. However, if I then manually explode the polylines, all of the subentities disappear.
If I try to programmatically explode the polylines I get eWrongDatabase.
What am I doing wrong?
I'm basically using the code from the Autodesk link below, just on polyline object.
http://docs.autodesk.com/ACD/2011/ESP/filesMDG/WS1a9193826455f5ff2566ffd511ff6f8c7ca-3f78.htm
I'm using the PromptForNestedEntity which returns properly, then pass into this as newCloneColl
Using docLock As DocumentLock = destDoc.LockDocument
Using tr As Transaction = destDb.TransactionManager.StartTransaction()
Try
tr.TransactionManager.QueueForGraphicsFlush()
destDb.WblockCloneObjects(newCloneColl, destDb.CurrentSpaceId, idMap, DuplicateRecordCloning.Ignore, False)
tr.Commit()
Catch ex As System.Exception
destEd.WriteMessage(vbLf & "Error during NCOPY: " & ex.Message)
End Try
End Using
End Using
Again, this works fine until you explode the polyline object.
-
No takers? Really need some help on this one... not sure what I'm doing wrong.
Posted more code here on forum post.
https://forums.autodesk.com/t5/net/wblockcloneobjects-on-polylines-works-until-polylines-are/m-p/9651862/highlight/false#M66365
-
The polylines are being cloned with the Xref layer name. Since a database resident object cannot be on an Xref layer it gets removed when exploding. An Audit places the pline on the Audit_Bad_Layer and then it can be exploded. The key is to set the layer for the cloned object t a valid layer.
-
Thanks Jeff!
Brilliant. Did not occur to me why that was happening. I find it bizarre as Lines and Arcs, no issue. Polylines worked fine until exploded, or the XREF was detached. Man, thanks a ton! :beer:
-
Steve, note that all objects cloned from an Xref would have the same issue. The Layer needs to be set to a current DB layer, else you will get the eWrongDataBase during an Audit and the layer will be changed to the Audit_Bad_Layer. You only noticed when exploding the polyline because AutoCAD caught the issue.