How to set/edit a FamilyInstances Geometry

How to set/edit a FamilyInstances Geometry

Anonymous
Not applicable
848 Views
6 Replies
Message 1 of 7

How to set/edit a FamilyInstances Geometry

Anonymous
Not applicable

Hello

 

I am creating a Family Instance of a Pipe. I am able to successfully create the FamilyInstance but I am unable to set the Pipes geometric data. I would like to just set the start point and end point of the pipe but I dont know how?

 

Can you provide advice on how to set a FamilyInstances geometric data (ie, the vertices)?

 

Heres my code that creates the FamilyInstance and attempts to set the geometric data but as you can see I cant find the points/vertices?

 

FamilyInstance pipe = doc.Create.NewFamilyInstance(strt, pipeSymbol, StructuralType.NonStructural);

// Set the pipes start vertex and end vertex
foreach (GeometryObject geomObj in pipe.get_Geometry(null))  {
	// How do I find the first and last vertex???
	
	GeometryInstance geomInst = geomObj as GeometryInstance;
	GeometryElement transformedGeomElem = geomInst.GetInstanceGeometry(geomInst.Transform);

}

 

0 Likes
849 Views
6 Replies
Replies (6)
Message 2 of 7

ollikat
Collaborator
Collaborator
Hi Sam

First of all for me it sounds very strange that you are creating pipe as a family instance? Are you 100% sure what are you trying to do? Because at least in Revit MEP, pipe is not a faily instance. Instead pipe and ducts etc. inherits from MEPCurve. Only common ancestor with family instance is the Element class.

So...if you are using Revit 2014, then there's simply Pipe.Create method. With that you can achieve what you are after I guess.

If you were trying something totally different, I guess you need to explain it in more detail in order us to help you :-).
0 Likes
Message 3 of 7

Anonymous
Not applicable

Thanks for your reply.

 

I have a Family that has a pipe/pipe-like element in it. I am creating this. The reason for creating this and not a system pipe is because in Revit 2013 you cannot create a Pipe of any type using doc.Create.NewPipe() if the user is using a Construction, Architectural or Structural project. A addin/macro can only create a pipe in a MEP project (you will have knowticed my other questions relating to this). I'm aware this doesn't occur in Revit 2014 but I need this to work in 2013.

 

So to overcome this issue I simply load a family that contains a pipe. Thus my need to create a pipe as a FamilyInstance then set its geometry. I guess I am trying to retrieve the FamilyInstance's (pipe's) underlying Line object or just its vertices.

0 Likes
Message 4 of 7

ollikat
Collaborator
Collaborator

OK...

Well I'm not sure whether it's possible to alter the geometry trough Element.Geometry...at least never done it my self.

But instead I would suggest a different kind of approach. Try to parametrize the wanted dimension within the family. Then you could simply set the parameter value in the project and dimension would change accordingly.

 

But in any case your work around sounds a bit challenging. For example how you are goingto connect this kind of family instance pipes? Or is there even need to...

0 Likes
Message 5 of 7

Anonymous
Not applicable

Ok will try to parametise each end of the pipe 🙂 Maybe try to add a point/XYZ to the ends.

 

What do you mean by connect these pipes? Ie, connect one pipe to another? There are Pits (another family instance) that sits at the end of each pipe, they dont actually connect but they just sit at the correct x, y, z (the pipes and pits). Maybe for some pipe analysis it will be crucial that the pipes connect?

0 Likes
Message 6 of 7

ollikat
Collaborator
Collaborator

In MEP pipes/ducts etc. are usually connected together. Then for example if you drag some pipe in the network and others will follow. Also flow calculations and that kind of stuff can be performed by Revit.

But it just depends what you are trying to achieve...

0 Likes
Message 7 of 7

Anonymous
Not applicable

Ok I've followed an example of how to inspect a FamilyInstances geometry but each time I go to retrieve my FamilyInstances GeometryElement object it returns a null object.

 

Does anyone know whats going wrong. Note: the FamilyInstance exists (not null), is a pipe-like (cylinder with start, end, diameter, etc.) element, I am running Revit 2013.

 

Any advice would be extremely helpful.

 

FamilyInstance famInst = doc.Create.NewFamilyInstance(strt, pipeSymbol, StructuralType.NonStructural);

Options opts = activeDoc.Application.Create.NewGeometryOptions(); TaskDialog.Show("Is Options null " + (opts == null).ToString()); // outputs "Is Options null false"
GeometryElement geoEle = famInst.get_Geometry(opts); // error occurs here TaskDialog.Show("Is geoEle null " + (geoEle == null).ToString()); // outputs "Is geoEle null true"

 

0 Likes