How to align a point to a reference Plane

How to align a point to a reference Plane

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

How to align a point to a reference Plane

Anonymous
Not applicable

Hi everybody,

 

By programming, i have created a sweep in the revit family template for ossature. I'm not able to align the start and end points of the curve used for sweeping with the corresponding reference plane.

 

Look at the GIF file to see exactly my problem.

 

Thanks for your answer.

 

0 Likes
1,369 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Look the second GIF. The first is not good.

0 Likes
Message 3 of 3

FAIR59
Advisor
Advisor

You have to find the sketch Line of the path first. This example works with ModelLines:

 

				ModelLine sweepPath = null;
				List<ElementId> deleted = null;
				using (Transaction t = new Transaction(doc,"deleteTemp"))
				{
					t.Start();
					deleted = doc.Delete(sweep.Id).ToList();
					t.RollBack();
				}
				List<ModelLine> pathCurveLoop = new List<ModelLine>();
				bool firstModellineSection = false;
				foreach( ElementId id in deleted)
				{
					ModelLine ml = doc.GetElement(id) as ModelLine;
					if ( ml==null && firstModellineSection) break;
					if (ml == null ) continue;
					pathCurveLoop.Add(ml);
					firstModellineSection = true;
				}
				sweepPath = pathCurveLoop.FirstOrDefault();

  

then you can lock the alignment to the referencePlane: 

 

					bool alignFirstPoint ;
					Reference endPointRef = alignFirstPoint? sweepPath.GeometryCurve.GetEndPointReference(0): sweepPath.GeometryCurve.GetEndPointReference(1);
					doc.FamilyCreate.NewAlignment(doc.ActiveView, refPlane.GetReference(),endPointRef);

the method doc.FamilyCreate.NewAlignment won't work if the endpoint of the referenceLine doesn't lie on the referencePlane.

 

0 Likes