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 Pipe or Duct Accesories

2 REPLIES 2
Reply
Message 1 of 3
SinghManish
396 Views, 2 Replies

Creating Pipe or Duct Accesories

Dear All,

 

 

I am really stuck that, i am not able to create Pipe or Duct-Accesories Like Normal,End Cap, Valves using Code. Using Method Like

 

Doc.Create.NewUnionFitting(Connector1, Connector 2)

Doc.Create.NewElbowFitting(Connector1, Connector 2)

 

etc. I do not want ot use NewFamilyInstance() Method because this give rotation issue in offset drawing.

 

 

Please help me, if any one know how to resolve this.

Manish Singh
2 REPLIES 2
Message 2 of 3
ollikat
in reply to: SinghManish

As far as I know there's no other way of creating such a family instances than with method you mentioned. Maybe you should try to solve your "rotation issue", or is there some kind of bug in API confirmed by ADSK so that you cannot over come it?
Message 3 of 3
sam.z
in reply to: SinghManish

Creating pipes was extremely difficult for myself also. But I figured out how to do it. But there are some caveats depending on what version of Revit you are using and what type of project you have open.

 

For Revit 2014:

- If you are not in a MEP project: you can only create standard pipes AFAIK. AFAIK it has to do with the fact that the System Families (for pipes) are not loaded in non-MEP projects

 

For Revit 2013:

- You can only create a pipe inside a MEP project

 

Heres my code I use:

public void createPipe(Document doc, XYZ strt, XYZ end)
{
	#region Get Standard Pit Type
	PipeType pipeType = null;
	FilteredElementCollector collector = new FilteredElementCollector(doc);
	collector.OfCategory(BuiltInCategory.OST_PipeCurves);
	collector.OfClass(typeof(ElementType));

	foreach (Element ptype in collector)
	{
		// DEBUG
		// Just use first type found
		//pipeType = ptype as PipeType; EXDSMessage("Type: " + ptype.Name);
		// END DEBUG

		System.Windows.MessageBox.Show("Name: " + ptype.Name);
		if (string.Compare(ptype.Name, "standard", true) == 0) {
			System.Windows.MessageBox.Show("Name: " + ptype.Name);
			pipeType = ptype as PipeType;
			break;
		}
	}
	#endregion

	//Pipe pipe = Pipe.Create(doc, pipeType.Id, pipeType.Id, levelType.Id, strt, end);
	Pipe pipe = doc.Create.NewPipe(strt, end, pipeType);
}

 

 

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