Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66805

Re: Matchlines - Access gemotry/length/coordinates?

$
0
0

As so often with elements defined by sketchlines, you can't get the sketch direcly, but you have to use the Temporary Transaction Trick to get access to the sketchlines.

StringBuilder sb = new StringBuilder();
Element elem; // MatchLine - element
List<ElementId> deleted = new List<ElementId>();
using (Transaction t = new Transaction(doc,"dummy"))
{
	t.Start();
	deleted = doc.Delete(elem.Id).ToList();
	t.RollBack();
}
List<ModelCurve> sketchLines = new List<ModelCurve>(); foreach(ElementId id in deleted) { Element e = doc.GetElement(id); if (!(e is ModelCurve)) continue;
sketchLines.Add( e as ModelCurve); sb.AppendLine(string.Format("<{0}> {1} {2}",id,e.Name, e.GetType())); } TaskDialog.Show("debug",sb.ToString());

Viewing all articles
Browse latest Browse all 66805

Trending Articles