Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.

Revit API Forum

Post 1 of 10

New Family Instance with orientation

1623 Views, 9 Replies
11-14-2013 12:47 AM

ItemFactoryBase..::..NewFamilyInstance Method (XYZ, FamilySymbol, XYZ, Element, StructuralType)


I'm testing to use this method to create a generic model with an extrusion to give nominated orientations (non- vertical or horizontal).  The sample code for this method in the "Revit API.chm" in 2014 SDK to create beds I tested.

But you can see the vertical faces of the extrusion remain vertical, where I would like to keep them in the direction of the orienation.  I don't want the original shape to be deformed.  I did test this in 2013 (not 2014).  I tried setting some parameters of the family but couldn't get the desired effect (such as Always Vertical).


Image attached.  Any suggestions greatly appreciated.  Thanks in advance.






Post 2 of 10

Re: New Family Instance with orientation

11-14-2013 10:58 PM in reply to: GeomGym

Also refer this discussion:

I think the desired solution is to be able to create work plane hosted instances as you can from the user interface.

Post 3 of 10

Re: New Family Instance with orientation

11-20-2013 10:33 PM in reply to: GeomGym
Post 4 of 10

Re: New Family Instance with orientation

11-21-2013 05:35 AM in reply to: gopinath.taget

Hi Gopinath,


Thanks for the reply.  But I can't get this to work.  Revit throws an exeption that the reference direction is parrallel to face normal (I tried a few variations with vectors that are not).


I've attached some sample code and a test project if you have a chance to test.





Post 5 of 10

Re: New Family Instance with orientation

11-21-2013 11:58 AM in reply to: GeomGym

Hi Jon,


I looked at your code and tested it. Everything looks OK until the point where you call document.Create.NewFamilyInstance. In it, you specify the normal as "new XYZ(rp.Normal.Z, rp.Normal.X, rp.Normal.Y)". Can I ask you what made you choose this direction? I ask because I was under the impression that you want the direction of your family instance to be the normal of the plane you want to place it in.


Were you just experimenting with different directions? If so, can I ask you what your ultimate goal would be? What direction would you need for the family instance with respect to the reference plane?




Post 6 of 10

Re: New Family Instance with orientation

11-21-2013 12:10 PM in reply to: gopinath.taget

Hi Gopinath,


Yes, that was the last vector I tried.  This was taken from Jeremy's blog post that you posted the link for.  The user suggested this worked for them.  I initially tried vectors such as free end point to bubble end of the referernce plane.


The end goal here is to create a set of work plane based generic model family symbols that will each represent a unique curtain panel shape.  The api will be used to create instances of this panel at transformed locations (with varying orientations).  I assumed just creating a reference plane for each panel and creating an instance at it's origin.  Part of the trouble here is that surfaces can't be created in a generic model template based family, so I suspect an extrusion with thickness is needed.  This then suffers from distortion if not hosted on a reference plane (another suggestion was nesting the familys on RFO).  Surfaces can be created in conceptual mass families, but I can't then categorize as a curtain panel (unless I'm mistaken).  This blog post might help explain ( ) although in this example all panels are in a plane (which won't be the case for real models I'm testing).  


If I can explain further, I'm more than happy to do so.


Thanks in advance for any further assistance,



Post 7 of 10

Re: New Family Instance with orientation

11-22-2013 11:09 AM in reply to: GeomGym

Hi Jon,


I did a little bit of research and I think you are using the NewFamilyInstance method wrong. For the particular overload you are using, the documentations says the first parameter reference refers to a face (like that of a wall) and not a plane.


The other overloads used a face instance directly, a point, a line or a curve. I could not find anything that will use a plane as a reference.


I believe your best bet now would be to create a temporary elements like walls (or if you could use other elements like line or point) on your reference plane and add your symbol relative to that.


Is this something you can do?




Post 8 of 10

Re: New Family Instance with orientation

11-22-2013 11:23 AM in reply to: gopinath.taget

Well thanks for trying to help.


The code I posted is based on the Jeremy's blog post that you referred me to unless I'm mistakenly calling an incorrect overload.

    mReferencePlane.Reference, pt, refDir,
    mFamilySymbol );


I think the problem here is that it works for horizontal planes, and not for other inclinations.  Hosting this family onto reference planes using the user interface works fine, it's a pity the API isn't as capable and I can only restate my wish that this would be implemented as quickly as possible.


I'm already worried about Revit performance to create 1000s of reference planes and panels, creating walls to create panels sounds like an inefficient means and I'm sure performance would suffer (let alone the time to generate).  

Post 9 of 10

Re: New Family Instance with orientation

11-21-2016 06:23 AM in reply to: GeomGym

Hi  Jon:

   I’m suffering the problem you have suffered.I want to learn the method you deal with this problem.




Post 10 of 10

Re: New Family Instance with orientation

01-08-2017 05:51 AM in reply to: 358149732




make sure to disselect the Always Vertical option in FamilyEditor before placing the instances.



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post

Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.