Revit API

Active Member
Posts: 6
Registered: ‎07-30-2012
Message 1 of 3 (281 Views)
Accepted Solution

Creating / Editing family

281 Views, 2 Replies
01-29-2013 01:09 AM



I try create new family from my command. But I don't now how it's made. I know that I need open template and edit it. But I don't know how to create lines, rectangles and text. Please give me a few samples.

Active Member
Posts: 6
Registered: ‎07-30-2012
Message 2 of 3 (273 Views)

Re: Creating / Editing family

01-29-2013 02:37 AM in reply to: EfremenkoDO

I found how to add text to family from command

            Transaction trans2 = new Transaction(doc);
            UIDocument uiDoc = commandData.Application.ActiveUIDocument;
            Document doc = uiDoc.Document;
            View view = uiDoc.ActiveView;
            XYZ origin = XYZ.Zero;
            XYZ baseVec = XYZ.BasisX;
            XYZ upVec = XYZ.BasisZ;
            double textSize = 200;
            double lineWidth = 50;
            string strText = "Test";
            // Create the text
            TextNote text = doc.FamilyCreate.NewTextNote(view, origin,
              TextAlignFlags.TEF_ALIGN_CENTER |
              TextAlignFlags.TEF_ALIGN_MIDDLE, strText);
            text.Width = 20; // set the width of the text


I'm looking for how to add lines and rectangles


Active Member
Posts: 6
Registered: ‎07-30-2012
Message 3 of 3 (259 Views)

Re: Creating / Editing family

01-30-2013 12:06 AM in reply to: EfremenkoDO

Adding line to family

            using (Transaction trans = new Transaction(doc,"test"))
                Line line = app.Application.Create.NewLineBound(new XYZ(0, 0, 0), new XYZ(10, 10, 0));
                doc.FamilyCreate.NewDetailCurve(doc.ActiveView, line);



You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit