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

Change Polyline3d

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

Change Polyline3d

Hi,

 

i have a program to change the polyline3d. Something like

 

try
{
using (tr)
{
Polyline3d poly3d = (Polyline3d)tr.GetObject(oid, OpenMode.ForWrite); ObjectId[] verts = poly3d.Cast<ObjectId>().ToArray(); for (int i = 0; i < verts.Length; i++) { vt = tr.GetObject(verts[i], OpenMode.ForWrite) as PolylineVertex3d; vt.Position = new Point3d(X, Y, Z); }

tr.Commit();
}
}
catch
{
}
finally
{
tr.Dispose();
}

After that, the polyline3d changes perfectly. On the screen i can see the change. But when i run the command 3dorbit, then i see the polyline3d before the change.

You can see it on the Pictures

When i save the drawing and open it again, everthing is all right.

Can anyone tell me where the error is? 🙂

 

Thanks

3 REPLIES 3
Message 2 of 4
Hallex
in reply to: Anonymous

Remove:
tr.Dispose();
from your code,
me think it's a reason of your problem
you don't need todispose objects, within USING{} code block
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 4
Anonymous
in reply to: Hallex

Hi,

 

thanks for the help. Unfortunately this does not work. I remove tr.Dispose(), then i try this

 

using (tr)
{
  try
  {
  }
}
catch
{
}
finally
{
tr.Dispose();
}

without success.

 

It is interesting, that the problem comes after the second (and each next) call to 3dorbit command. When I change polyline3d and then call to 3dorbit for the first time, everthing is fine. It is a little bit confusing.

Message 4 of 4
fenton.webb
in reply to: Anonymous

We need to see the whole function in order to diagnose the prolem.




Fenton Webb
AutoCAD Engineering
Autodesk

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