Change Polyline3d

Change Polyline3d

Anonymous
Not applicable
727 Views
3 Replies
Message 1 of 4

Change Polyline3d

Anonymous
Not applicable

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

0 Likes
728 Views
3 Replies
Replies (3)
Message 2 of 4

Hallex
Advisor
Advisor
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
0 Likes
Message 3 of 4

Anonymous
Not applicable

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.

0 Likes
Message 4 of 4

fenton_webb
Autodesk
Autodesk

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




Fenton Webb
AutoCAD Engineering
Autodesk

0 Likes