Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Placing families on a host with sketchplane

7 REPLIES 7
Reply
Message 1 of 8
R.van.den.Bor
1463 Views, 7 Replies

Placing families on a host with sketchplane

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.

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
7 REPLIES 7
Message 2 of 8
Joe.Ye
in reply to: R.van.den.Bor

I think before you create the family instance, and after create the sketch plane, you can set this sketch plane as the work plane. See more in this devblog post on how to create a sketch plane and set it as the work plane.http://adndevblog.typepad.com/aec/2012/07/creating-active-work-plane-of-the-view-using-revit-api.htm... After set it as the work plane, then create the family instance on it. Hope this can make your family instance associating with the sketch plane.


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 3 of 8
R.van.den.Bor
in reply to: Joe.Ye

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.

 

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 4 of 8
Joe.Ye
in reply to: R.van.den.Bor

Hi Remy, Could you upload this nested family for investigating? If you don't want the family to be public, please upload the family to the ADN support case #09126775. thanks,


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 5 of 8
R.van.den.Bor
in reply to: Joe.Ye

Oh, I'm sorry Joe Ye, I've just made a support request for it (How to align or lock families to a reference plane ).
Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 6 of 8
GeomGym
in reply to: R.van.den.Bor

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.

http://forums.autodesk.com/t5/Revit-API/New-Family-Instance-with-orientation/m-p/4620693/highlight/t...

Message 7 of 8
R.van.den.Bor
in reply to: GeomGym

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 🙂 )

 

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 8 of 8

@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.

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community