Creating Pipe or Duct Accesories

Creating Pipe or Duct Accesories

Anonymous
Not applicable
640 Views
2 Replies
Message 1 of 3

Creating Pipe or Duct Accesories

Anonymous
Not applicable

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.

0 Likes
641 Views
2 Replies
Replies (2)
Message 2 of 3

ollikat
Collaborator
Collaborator
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?
0 Likes
Message 3 of 3

Anonymous
Not applicable

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);
}

 

 

0 Likes