Revit API

Active Contributor
Posts: 32
Registered: ‎10-06-2009
Message 1 of 2 (448 Views)

How to Create Arrow Types?

448 Views, 1 Replies
10-13-2012 06:39 PM

I want to create a new Arrow Type "22 Degree Filled Arrow" and "22 Degree Filled Arrow"

Arrow Style: Arrow

Fill Tick: = ON

Arrow Closed : OFF

Arrow Width Factor = 22deg

Tick Size = 3/32"


I'm looking for a sample or tutoiral that can be used to create new arrow types using the duplicate type.

I'm using the Built In Parameter Checker to get Parameter Names which I can use to change the parameter values above.


For TextNotes I used:

 ICollection<ElementId> textNotes
                  = collectorUsed.OfClass(typeof(TextNote))


But I'm not sure what to replace "TextNote".



using System;
using System.Collections.Generic;
using System.Collections;
using System.Windows.Forms;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System.Text;
using System.Linq;

namespace CreateTextType

    /// <summary>
    /// Revit Create Revit Arrow Head Style
    /// Created by. Matt Fleming C.E.T.
    /// </summary>
    /// <remarks></remarks>

    public class cmdArrowType : IExternalCommand
        /// <summary>
        /// Command Entry Point
        /// </summary>
        /// <param name="commandData">Input argument providing access to the Revit application and documents</param>
        /// <param name="message">Return message to the user in case of error or cancel</param>
        /// <param name="elements">Return argument to highlight elements on the graphics screen if Result is not Succeeded.</param>
        /// <returns>Cancelled, Failed or Succeeded</returns>
        public Result Execute(ExternalCommandData commandData,
                                ref string message,
                                ElementSet elements)
                // Action Code Starts Here
                List<Element> ret = new List<Element>();

                Document doc = commandData.Application.ActiveUIDocument.Document;

                /// Retrieve access to all arrowType Elements
                FilteredElementCollector collectorUsed

                  = new FilteredElementCollector(doc);

                ICollection<ElementId> arrowTypes
                  = collectorUsed.OfClass(typeof(ArrowType))//ArrowType is Wrong

                foreach (ElementId arrowTypeId in arrowTypes)
                    ArrowType arrownote = doc.GetElement(//ArrowType is Wrong
                      arrowTypeid) as ArrowType;//ArrowType is Wrong

                    Transaction trans = new Transaction(doc);

                        // Create a duplicate
                    Element ele = arrownote.arrowType.Duplicate(newArrowType);
                    arrowTypeType arrowType = ele as arrowTypeType;//arrowTypeType is Wrong

                        // Change font parameter
                    if (null != arrowType)
                            // Arrow Filled 1 = ON 0 = OFF
                            // Arrow Size Double
                            // Arrow Type Integer
                            // Arrow Leader Width Double Degrees
                            // Arrow Closed 1 = ON 0 = OFF
                // Return Success
                return Result.Succeeded;

            catch (Exception ex)

                // Failure Message
                message = ex.Message;
                return Result.Failed;





Posts: 185
Registered: ‎08-16-2007
Message 2 of 2 (406 Views)

Re: How to Create Arrow Types?

10-25-2012 01:43 PM in reply to: mfleming.stantec

Hi Matt


I would insert an instance of the arrow in the current Revit model and then use the Revit Lookup tool after selecting the instance and dig out the category, type, etc information and plug those in the code.


If you need further help with this, can you please specify which specific family can I use to create an instance of this in a Revit model. Or if you want to include the arrow family file as an attachment, I could take a further look if you need me to. Please do ensure that any of your attachments do not include any confidential information.


hope this helps.

Saikat Bhattacharya

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.