Hi there,
I've searched the net but can't find what I'm lloking for.
I want to place a nested family on a reference plane.
I have a frontview and perpendicular on that view I have made a reference plane named "TheRef".
So when I use :
SketchPlane sk = view.SketchPlane;
FamilyInstance instance = doc.FamilyCreate.NewFamilyInstance(startPoint, familySymbol, sk, stNon);
It will place the family and set the workplane on Interior. So although I have set the frontview on the workplane "TheRef", view.SketchPlane returns the refplane "Interior".
So, I tried :
SketchPlane sk = SketchPlane.Create(doc, TheRef.Plane);
Now my family is placed on the correct reference plane, but the parameter workplane reads "not associated". Which I can understand since I made a new sketchplane.
(when I by hand use the "Edit workplane" command and choose TheRef, my family reacts how I want to).
So I tried using the refplane TheRef as host:
FamilyInstance instance = doc.FamilyCreate.NewFamilyInstance(startPoint, familySymbol, TheRef, stNon);
Still not associated.
So my question is: How can I use an excisting reference plane for sketchplane ?
something like :
SketchPlane sk = TheRef as SketchPlane;
The ultimate goal is the have a nested family placed on a plane, lock it to the reference plane, so that I later on when I move the reference plane, I move the family.
(Place the family by hand automatically locks it to the reference plane TheRef, so I know revit can do it. Not sure about the API).
Anyone an Idea ?
Remy.
Hello Joe,
I already saw this post but it doesn't give me the solution I'm searching for. I don't want to make a new sketchplane, I allready have a reference plane which I want to use.
When I use the code from the site, It will show a workplane with reference "not associated".
So the question remains
- I have a workplane based family called "wpb"
- I load it into an other family called "mother".
- The frontview of "mother" has the workplane "WP" linked to the refplane "familyrefplane".
How can I place the loaded family "wpb" in such a way that it is linked to the workplane "WP".
I'm using :
doc.FamilyCreate.NewFamilyInstance(location, familysumbol, reference direction, element host, structural type)
I use view.sketchplane as host.
If you manage to succede, would be great to post here. I'm certainly interested and I think there's a few similar posted questions here on the forum.
Update so for,
Thanks to Gopinaths help we established the following:
It seems the only way you can associate a family with a reference plane, is by making the family workplane based. The neat trick you can do by hand to use the "align tool" to manually lock the family to a reference plane, can't be done in the API.
So I followed the instructions in this post :
http://thebuildingcoder.typepad.com/blog/2012/02/hosting-a-light-fitting-on-a-reference-plane.html
Unfortunately I still can't get it to work since all my attempts turn out in the same error "Reference direction is parallel to the normal at insertion point". Since I have drawn the reference plane directly behind the center (front/back) reference plane, it is logical my reference plane is parallel, so I don't understand why revit has troubles with it. The only thing I noticed is when I do it manually, I can only select my reference plane when I'm in front view. In floorplan, my references plane isn't available.But I also tried to set the front view active fisrt before placing the family with the same result "Reference direction is parallel to the normal at insertion point".... grrrrr...
To be continued (positively I hope 🙂 )
@GeoGym: So like I wrote before, the only way to host a family to a reference plane, is by making the nested family workplane based. In the template (or host family) I made sure the frontview had the workplane set to my reference plane. (I tried this with the api, but it failed, because all I've got was the family being placed on my reference plane, but not linked to it. So host would show "not associated" instead of "Reference Plane:my refplane".
So I bypassed this by manually set the workplane of the frontview to the reference plane "My refplane".
By selection I've got the correct view, so View vw = the frontview
FamilySymbol symbol = the workplane based family I want to place
beg = new XYZ(2, 0, 0);
rot = new XYZ(0, 0, 0);
fdoc.FamilyCreate.NewFamilyInstance(beg, symbol, rot, vw.SketchPlane, StructuralType.NonStructural);
Now the family is hosted on "My refplane" and moves along with it.