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: 

Why are No PipeTypes Loaded in Revit 2013

2 REPLIES 2
Reply
Message 1 of 3
sam.z
835 Views, 2 Replies

Why are No PipeTypes Loaded in Revit 2013

Hello

 

My addin is attempting to create a Pipe. I have run into a problem if the user's Revit Project type is Architectural, Construction or Structural.

 

If I run my Addin when the user has these kinds of projects open, then I cannot create a Pipe because there are no PipeTypes loaded into the project. See my code below that you can run in a Non-MEP Project and it will show no PipeTypes are loaded.

 

Is this normal? Do you know how I can create a Pipe when the user is in a Non-MEP Project?

 

Some relevant information:

 

  • This error occurs in Revit 2013.
  • Using Revit 2014, I can successfully create a Pipe in a Non-MEP Project. This is because there is 1 and only 1 PipeType loaded ("Default")
  • I am using the Student Version of Revit 2013 and 2014 so this might mean that not all PipeTypes are loaded?

Run this code in your own version of Revit to replicate the error (No PipeTypes loaded in Non-MEP Projects):

 

[TransactionAttribute(TransactionMode.Manual)]
[RegenerationAttribute(RegenerationOption.Manual)]
public class Lab1PlaceGroup : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        UIApplication uiApp = commandData.Application;
        Document doc = uiApp.ActiveUIDocument.Document;

        Transaction trans = new Transaction(doc);
        trans.Start("Test");

        #region Determine Pipe Types available in this project
            /*
             * Knowtice that in a MEP Project we can find the Pipe Types: "Standard" & "Plastic"
             * But in any other project (Architectural, Construction, Structural) there are no Pipe Types found
             * 
             * Note: In Revit 2014 we can find the pipe type "Default"
            */

            PipeType pipeType                   = null;
            FilteredElementCollector collector  = new FilteredElementCollector(doc);
            collector.OfCategory(BuiltInCategory.OST_PipeCurves);
            collector.OfClass(typeof(ElementType));

            foreach (Element ptype in collector) {
                TaskDialog.Show("Name: " + ptype.Name, "Notification");
                
                if (string.Compare(ptype.Name, "standard", true) == 0) {
                    pipeType = ptype as PipeType;
                    break;
                }
            }
        #endregion

        Pipe pipe = doc.Create.NewPipe(new XYZ(1, 1, 1), new XYZ(5, 5, 5), pipeType);  //PipeSystemType.DomesticColdWater);
            
        trans.Commit();
        return Result.Succeeded;
    }
}

 

2 REPLIES 2
Message 2 of 3
nitinjambhale
in reply to: sam.z

Dear Sam,

You need atleast one pipe type before creating new ones.

If you dont have any pipe type in template then i suggest change the template, because if you are creating pipe types it is very strenge that template does not have any !!!...

 

Regards,

Nitin.

Message 3 of 3

Dear Sam,

 

You may be able to use the copy and paste API to copy a pipe type from some existing MEP project into a non-MEP one:

 

http://thebuildingcoder.typepad.com/blog/2013/05/copy-and-paste-api-applications-and-modeless-assert...

 

Unfortunately, this is not available in Revit 2013, only from 2014 onwards.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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