I'm new in Revit Api and i need help. I have some ModelLine. How do o know the starting or ending point of the ModelLine?
Selection mySelection = rvtUIDoc.Selection;
ICollection<ElementId> selectedIds = rvtUIDoc.Selection.GetElementIds();
ICollection<ElementId> selectedlinesIds = new List<ElementId>();
foreach (ElementId id in selectedIds)
{
Element elements = rvtUIDoc.Document.GetElement(id);
if (elements is ModelLine)
{
selectedlinesIds.Add(id);
}
}
//Проверяем есть ли выделенные объекты
if (0 == selectedlinesIds.Count)
{
TaskDialog.Show("Revit","Вы не выделили ни одной линии");
}
else
{
ModelLine(rvtUIDoc, m_rvtDoc, selectedlinesIds);
}
what i must do next?
As a newbie to the Revit API, I would suggest you work through the Revit API getting started material first of all, especially the DevTV and My First Revit Plugin tutorials:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
That actually answers this question and many more.
The direct answer to your question is: the ModelCurve start and end points are controlled by the underlying geometry curve.
It can be accessed via the
GeometryCurve
property.It provides the
GetEndPoint
method that returns the 3D point at its start or end.That answers your question.
To define a new start or end point, i.e., modify the existing one, you might need to create an entirely new curve.
Here is an example of doing exactly that:
http://thebuildingcoder.typepad.com/blog/2013/08/generating-a-midcurve-between-two-curve-elements.html