« The Revit Family API | Main | DWG Export Filename »

August 12, 2009

Comments

Hi Jeremy,

this is a very usueful code if you want to create a new instance and pick a host for it.
however, i am not finding a way to re-host a given fixture through code.
Is there is a way to call the command "Pick new host" (Vertical face, reference plane..)via API?
Please advise as soon as possible on the way to rehost a fixture through code. (to nearest element that intersects it)

Regards

Dear Mira,

Thank you, glad you like it.

Unfortunately, I do not see a direct way to programmatically rehost a family instance such as an electrical fixture to a given host, e.g. a wall element.

The only workaround I can think of would be to note the location and family symbol of the family instance, delete it, and create a new one by calling the NewFamilyInstance method with the overload taking the host element argument, using the location and the symbol information extracted from the existing instance before its deletion.

This will create an identical fixture with the host information included.

Cheers, Jeremy.

Hi Jeremy,
I tried this workaround & it works great if the host element is in the same file as the lighting fixture.
On the other hand, if the host element which is a wall in my case, is in a linked revit document, then am not able to host the new family instance on the wall's face.
I tried to retrieve the wall's faces, but the faces array returned zero elements as the wall is in a linked file.
Please can you advise on how to create a new family instance hosted on the face of a wall found in a linked document..
Thanks a lot.

Dear Mona,

Oh dear, with linked files it is a lot trickier. I don't even know if you can host the fixture at all on a wall in a linked file. Is that possible even through the user interface? If not, then it will probably not be possible through the API either.

Cheers, Jeremy.

Hi Jeremy,

In Revit, you can host a fixture on the face of a wall in a Revit architectural linked file. Kindly note that I was able to get the side face of the wall where the fixture will be hosted using "HostObjectUtils.GetSideFaces(wall element, ShellLayerType.Exterior)".
Yet, when using the method "NewFamilyInstance(wall element side face as FACE, wall element location curve as Line, fixture symbol as FamilySymbol)" to host the new fixture on the face of the wall element, I get the following error "The Reference of the input face is null.If the face was obtained from Element.Geometry, make sure to turn on the option ComputeReferences". I have checked the reference object in the code & it was not null & the ComputeReferences was set to true.

Please advise..
Best Regards,

Dear Mona,

I am sorry to say I cannot do much more off-hand since this will probably require some research to answer. Please submit an ADN DevHelp Online case for this. Thank you!

Cheers, Jeremy.

Hi Jeremy,

Thanks a lot, I submitted my case to DevHelp.
An aside question, any idea why the retrieved Face object might have a null Reference, taking into consideration that the face is a side-face of a wall found in a linked file.
Thanks in advance,
Best Regards,

Dear Mona,

Thank you for submitting the case!

I would say that the problem may be that it is in a linked file :-)

Sorry.

Cheers, Jeremy.

hi jeremy i tried this code and i can't seem
to make it work

can u send it to me in c# project format

thanks


[email protected]

Autodesk.Revit.Creation.Filter

is not recognized by vc#

?????????????

sorry for too many posts but i noticed
that some of this functions are not in revit
2010 api can't you update the example to revit 2011 api

thanks

after some work i realized this is not exactly
what i want my project was to copy
an ( already loaded lighting fixture) by selecting it
and then selecting the point where it will
be copied and develop it later to lighting distribution plugin
the problem is i can't find a function of copy or anything similar and i don't know if i must provide a host programatically or not but your code for selecting ceiling will work i guess n

now if u can help i'll greatly appreciate it

thanx a lot


[email protected]

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource