Place families perpendicular to a curve

Dear all,

I brought this to the attention of the forum before but I have the same ongoing problem.

I am trying to place families perpendicular to a curve at equal distances.

For simple curves, it is OK. However, if the curve gets complicated or if the curve is a 3-dimensional curve, things get awkward. What could be reason for this?

I tried different solutions:

  • Created tangent lines at each point and rotated the families by the Vector.AngleWithVector between the tangent and Vector.XAxis

  • Used Curve.CoordinateSystemAtParameter and rotated the families by Vector.AngleWithVector between CoordinateSystem.XAxis and Vector.XAxis

None of these solutions works for complex curves.

Thanks



Divide.dyn (74.2 KB)

Spline.dwg (937.2 KB)
Spline2.dwg (938.9 KB)


Hi
To have regular spaces
Sincerely
Christian.stan

2 Likes

Thank you.
I used the following code and the result is the same unfortunately.


1 Like

Hi @mtanyer try pull on plane

2 Likes

Try Graham Scan

crv1 = List.FirstItem(Revit.Element.Geometry(crv));

// Points along Curve
pnt1 = crv1.PointAtParameter(0..1..#(crv1.Length/spacing));

// Normal at Points
nrm1 = crv1.NormalAtParameter(0..1..#(crv1.Length/spacing));

// Graham's scan
// If (x2-x1)(y3-y1)-(y2-y1)(x3-x1) is
// 0 : Collinear
// >0 : Counter-clockwise orientation
// <0 : Clockwise orientation

pnt2 = List.Flatten([List.FirstItem(pnt1),pnt1,List.LastItem(pnt1)],-1);
pnt3 = List.DropItems(List.Sublists(pnt2, 0..2, 1),-2);

p1 = List.GetItemAtIndex(pnt3<1>,0);
p2 = List.GetItemAtIndex(pnt3<1>,1);
p3 = List.GetItemAtIndex(pnt3<1>,2);

gsn0 = (p2.X-p1.X)*(p3.Y-p1.Y)-(p2.Y-p1.Y)*(p3.X-p1.X);
gsn1 = (p2.X-p1.X)*(p3.Y-p1.Y)-(p2.Y-p1.Y)*(p3.X-p1.X)<=0;

nrm2 = gsn1 ? nrm1 : nrm1.Reverse();

lin1 = Line.ByStartPointDirectionLength(pnt1,nrm2,1000);
2 Likes

Hola amigos buenas. Amigo @mtanyer When you use Curve.CoordinateSystem or Point At Parameter or Segment, it will place the CS or the Point at the CS of the Curve that means that the placed element will be perpendicular to the curve itself at that intersection, this is easy to see if you use planes, not sure what are you triyng to achive here, perpendicular to what? i found super easy to work with CS At segments or parameter because then i only use transform to CS, but with planes you have visual help, and other properties easy to get and use, i let you an example and i hope it helps you!


1 Like

Hi,
we have the same problem when we model bridge and tunnel
When modeling linear structures like bridges and tunnels, the process is typically divided into two main steps:

1. Determine Placement Locations and Coordinate Systems

First, extract the placement points and corresponding coordinate systems along the alignment curve.
You can use the appropriate Dynamo node to achieve this — it will give you both the location and the local orientation (coordinate system) at each point along the curve.


use BriMoahreb_XXX pak

Single_point_adaptive.rfa (700 KB)

2. Place the Family Instances

Create an adaptive family or a regular component family. Use the following approach (or reference the provided Dynamo script) to place the family instances in the project:

  • Insert each family instance at the computed location.
  • Orient the family by assigning the rotation in the XY plane rot_XY_A, calculated from the local coordinate system. and othe rotation if you need.


Single_point_adaptive.rfa (700 KB)

Note: The family should not be hosted on the curve directly. Instead, it should be placed based on point coordinates and orientation extracted from the curve logic.

2 Likes