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: 

Creating / Editing family

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
EfremenkoDO
673 Views, 2 Replies

Creating / Editing family

Hello,

 

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.

Tags (1)
2 REPLIES 2
Message 2 of 3
EfremenkoDO
in reply to: EfremenkoDO

I found how to add text to family from command

            Transaction trans2 = new Transaction(doc);
            trans2.Start("ChangeParam");
            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,
              baseVec,
              upVec,
              lineWidth,
              TextAlignFlags.TEF_ALIGN_CENTER |
              TextAlignFlags.TEF_ALIGN_MIDDLE, strText);
            text.Width = 20; // set the width of the text
            trans2.Commit();

 

I'm looking for how to add lines and rectangles

 

Message 3 of 3
EfremenkoDO
in reply to: EfremenkoDO

Adding line to family

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

 

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community