Autodesk.Revit.DB.Plumbing.Pipe pipe = Autodesk.Revit.DB.Plumbing.Pipe.Create(doc, pipeTypeId, levelId, startConnector, downstreamConnector);//whatever pipe you want the plane on
ConnectorSet pipeConnectorSet = pipe.MEPSystem.ConnectorManager.Connectors;
List<Connector> pipeConnectorList = new List<Connector>();
foreach(Connector connector in pipeConnectorSet)
{
pipeConnectorList.Add(connector);
}
Plane plane = Plane.CreateByThreePoints(pipeConnectorList[0].Origin, pipeConnectorList[1].Origin, new XYZ(pipeConnectorList[0].Origin.X, pipeConnectorList[0].Origin.Y + 10, pipeConnectorList[0].Origin.Z));
Maybe, I'm not sure what your exact requirements are. I was just giving you something to get started working the problem yourself.
horizontal pipe:
connector.Origin.Y + 10
vertical pipe:
connector.Origin.X + 10
Others:
I can't find the third point
The pipe has two connectors, one at each end, which I'm accessing with
pipeConnectorList[0].Origin, pipeConnectorList[1].Origin,
The third point can be something off of that, as you said in the x, y, or z direction.
Hi,
why not
Plane plane = Plane.CreateByNormalAndOrigin(pipeConnectorList[0].CoordinateSystem.BasisY, pipeConnectorList[0].CoordinateSystem.Origin);
Revitalizer
Finally, I find this solution.
Dim pipeDirection As XYZ = conn0.Origin - conn1.Origin
Dim normal As XYZ = XYZ.BasisZ.CrossProduct(pipeDirection).Normalize
Dim translation As XYZ = normal.Multiply(10)
Dim thirdPoint As XYZ = conn1.Origin.Add(translation)
Hi,
if the Pipe is vertical and pipeDirection equals XYZ.BasisZ (or minus XYZ.BasisZ), the cross product doesn't make sense.
You solution doesn't cover all possible cases.
Revitalizer
Hi,
no need to implement different case scenarios.
All vectors you need are already present in the connector's CoordinateSystem property:
https://thebuildingcoder.typepad.com/blog/2012/05/connector-orientation.html
So, the Pipe's orientation doesn't matter at all.
Just see my previous answer.
Revitalizer