Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi. What is the best way to preview a change on a 3d view without committing a transaction?
I tried using Regenerate() but I faced a bug, When I regenerate I see both the old geometry of the wall and also the new geometry simultaneously:
UIApplication uiapp = commandData.Application;
Document doc = uiapp.ActiveUIDocument.Document;
ElementId elementid = uiapp.ActiveUIDocument.Selection.PickObject(ObjectType.Element, "Select element or ESC to reset the view").ElementId;
var tempObject = doc.GetElement(elementid);
Wall wall = tempObject as Wall;
MessageBox.Show(wall.Category.Name);
Line l = (wall.Location as LocationCurve).Curve as Line;
MessageBox.Show(l.GetEndPoint(0).ToString() + " " + l.GetEndPoint(1).ToString() + " " + (l.GetEndPoint(1) / 2 + l.GetEndPoint(0) / 2).ToString());
using (Transaction trans = new Transaction(doc))
{
trans.Start("Changing wall curve.");
(wall.Location as LocationCurve).Curve =
Line.CreateBound(new XYZ(10, 10, 0), new XYZ(5, 5, 0));
doc.Regenerate();
MessageBox.Show("When this message pops up, I need to see the change");
trans.RollBack();
}
return Result.Succeeded;
If I comment out these two lines of code then it solves the issue, but this doesn't look stable. I want to know if there is a better way.
// I need to comment out the code below:
//MessageBox.Show(wall.Category.Name.ToString());
Line l = (wall.Location as LocationCurve).Curve as Line;
//I need to comment out the code below:
//MessageBox.Show(l.GetEndPoint(0).ToString() + " " + l.GetEndPoint(1).ToString() + " " + (l.GetEndPoint(1) / 2 + l.GetEndPoint(0) / 2).ToString());
Solved! Go to Solution.