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.
Also refer this discussion: http://forums.autodesk.com/t5/Revit-API/Change-the
I think the desired solution is to be able to create work plane hosted instances as you can from the user interface.
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.
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?
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 (http://geometrygym.blogspot.com/2013/11/ifc-exchan
If I can explain further, I'm more than happy to do so.
Thanks in advance for any further assistance,
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?
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.
uidoc.Document.Create.NewFamilyInstance( 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).
Search the Autodesk Knowledge Network for more content.
New: Get an Activation Code
Mac OS X 10.12 Support
Windows 10 Support
Autodesk Online Store Help
Serial Numbers & Product Keys
Installation & Licensing
Online Activation & Registration
Network License Administration
Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.