EndPointReference()

EndPointReference()

Anonymous
Not applicable
1,582 Views
2 Replies
Message 1 of 3

EndPointReference()

Anonymous
Not applicable
I am strugglying with a problem that is to access the reference of the end point of a pipe curve to then create a dimension in the model, by the method doc.Create.Dimension().I already tried to use the Curve.EndPointReference(int index) method but it returns only null value. Can anyone help how acess this information ?
0 Likes
Accepted solutions (1)
1,583 Views
2 Replies
Replies (2)
Message 2 of 3

FAIR59
Advisor
Advisor
Accepted solution

You probably are using the LocationCurve to find the reference. You need to use the "reference" Curve/Line that is part of the Element.Geometry.

 

			        Selection sel = this.ActiveUIDocument.Selection;
				Element elem = doc.GetElement(sel.GetElementIds().FirstOrDefault());
				Options opt = new Options();
				opt.ComputeReferences = true;
				opt.IncludeNonVisibleObjects = true;
				opt.View = doc.ActiveView;
				Reference ptRef =null;
				foreach( var geoObj in elem.get_Geometry(opt) )
				{
					Curve cv = geoObj as Curve;
					if (cv==null) continue;
					ptRef = cv.GetEndPointReference(0);
				}
				if (ptRef!=null)
				{
					TaskDialog.Show("debug",ptRef.ConvertToStableRepresentation(doc));
				}

 

Message 3 of 3

Anonymous
Not applicable

Thank you very much. Now was possible take the reference point. 

 

0 Likes