Jump to content

Problem with DeepCloneObjects and DBText insertion point


Recommended Posts

Posted (edited)

Forget all the DeepCloning, I've whittled it down to the DBText.Position point doesn't seem to work as advertised: The text doesn't move to 0,0,0.

 
[CommandMethod("copyEnt")]
public void copyEnt()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Database db = doc.Database;
  Editor ed = doc.Editor;
  PromptEntityOptions options =
  new PromptEntityOptions("\nSelect entity to copy");
  PromptEntityResult acSSPrompt = ed.GetEntity(options);
  if (acSSPrompt.Status != PromptStatus.OK)
     return;
   using (Transaction Tx = db.TransactionManager.StartTransaction())
   {
     DBText oldText = Tx.GetObject(acSSPrompt.ObjectId, OpenMode.ForWrite) as DBText;
     oldText.Position = new Point3d(0,0,0);
     oldText.TextString = "BLAH BLAH";
     Tx.Commit();
}
}

Edited by dallion
changing code to runnable example of problem
Posted

Never mind, I have figured it out using the GetVectorTo() method. Not sure why just changing the writable property doesn't work?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...