Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a reference line in revit API

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
2378 Views, 1 Reply

How to create a reference line in revit API

I'm trying to create a reference line (not a reference plane) between two points on a plane. I couldn't find any method except for one method that changes the type of a model curve to a reference line. How can I do that through API?

 

for instance, please assume these two points:

 

XYZ point1 = new XYZ(30, 12, 0);

XYZ point2 = new XYZ(10, 30, 0);

 

Thanks a lot in advance!

1 REPLY 1
Message 2 of 2
naveen.kumar.t
in reply to: Anonymous

Hi @Anonymous ,

Try using the below code

 Plane P = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ(0, 0, 0));
            SketchPlane sp = SketchPlane.Create(doc, P);
            XYZ startPoint;
            XYZ endPoint;
            Line l1 = Line.CreateBound(startPoint,endPoint);
            ModelLine mLine = doc.FamilyCreate.NewModelCurve(l1,sp) as ModelLine;           
            if (mLine!=null)
            {
                mLine.ChangeToReferenceLine();
            }            

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community