Create Points along Element location curve @ specified Distance

Create Points along Element location curve @ specified Distance

zrodgersTSSSU
Advocate Advocate
1,262 Views
3 Replies
Message 1 of 4

Create Points along Element location curve @ specified Distance

zrodgersTSSSU
Advocate
Advocate

Hey Everyone, Im trying to put points along a location curve @ a set distance. I need the points to place a family. Can anyone help me with this??

 

 

                                        LocationCurve eleCurve = elem.Location as LocationCurve;
                                        

                                        //start and end points of pipe
                                        XYZ startPoint = eleCurve.Curve.GetEndPoint(0);
                                        XYZ endPoint = eleCurve.Curve.GetEndPoint(1);

                                        //get length of curve
                                        double pipeLength = startPoint.DistanceTo(endPoint);

                                        //new points list
                                        List<XYZ> pts = new List<XYZ>(1);

                                        //place points along curve (need help here)





                                        //sets family @ points
                                        FamilyInstance placedInst = doc.Create.NewFamilyInstance(startPoint, hangerFamily, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

 

0 Likes
Accepted solutions (1)
1,263 Views
3 Replies
Replies (3)
Message 2 of 4

3dimdev
Enthusiast
Enthusiast
Accepted solution

Hello @zrodgersTSSSU,

The Curve.Evaluate() method will return a point at a specific location, location being a number between 0 and 1, on your curve.  For instance this will return an XYZ point 1/3rd the length of a bound curve from the start point.  

 

var oneThird = 1.0 / 3.0;
var pointOnCurve = eleCurve.Curve.Evaluate(oneThird , true);

 

3rd Dimension Developer
YouTube.com/@3DimDev
0 Likes
Message 3 of 4

zrodgersTSSSU
Advocate
Advocate

thank you that worked!! 

0 Likes
Message 4 of 4

3dimdev
Enthusiast
Enthusiast

You are welcome.  Glad this one didn't throw you too much of a curve!

 

OK, I'll go sit in my corner now.

3rd Dimension Developer
YouTube.com/@3DimDev