« My First Revit Plug-in | Main | Extensible Storage of a Map »

May 25, 2011

Comments

Dear Sir,
How can i get family information (symbols, instances) without loading family?

Thanks & Regards,
Nitin J.

Dear Nitin,

That is explained above, in the last paragraph: open the family file as a background document and use element filtering as normal.

Cheers, Jeremy.

Dear Sir,
Its working perfectly but when the family already present in revit its showing the dialog to overwrite family.
Do u have an idea how to skip or by default select overwrite programmatically?

Thanks Again!!!
- Nitin J.

Dear Nitin,

There are lots of posts here on The Building Coder explaining how to handle or suppress dialogues, including automatically selecting a specific option and then dismissing the dialogue.

Good luck!

Cheers, Jeremy.

Hello Jeremy,

I would like to delete family types with opening the family file as a separate background document. Is there any way to get ICollection of Familytype? I would like to collect elementid to use document.delete(ICollection);

When I try it using ElementClassFilter, it gives me an error.
ElementClassFilter filter=new ElementClassFilter(typeof(FamilyType));

Please let me know if you have any ideas.
Thanks,

Dear Jinsol Kim,

Yes, I would say that filtering for FamilyType objects will only work in the project environment. Within the family context, the family types are not represented using individually accessible elements at all. Instead, they are more like entries in a table managed by the FamilyManager class. The family manager class manages the family types and parameters in a family document. One of its member methods is DeleteCurrentType, which removes the current family type.

Cheers, Jeremy.

Hi Jeremy,
I am trying to create a command button to bring the family instead dragging from the family tree.
If the family not in the document load it or run it.
But the below code load it all the time.
If the family is not in the document use doc.LoadFamilySymbol to load it and how can i come back to loadFamily
Not sure what is wrong. help please

public void activeFamily(Document doc, UIDocument uiDoc, string familyName, string fileName)
{
FilteredElementCollector familyCollector = new FilteredElementCollector(doc);
familyCollector.OfClass(typeof(FamilySymbol));
FamilySymbol familySymbolToFind = null;
foreach (FamilySymbol familySymbol in familyCollector)
{
if (familySymbol.Name == familyName)
{
familySymbolToFind = familySymbol;
uiDoc.PromptForFamilyInstancePlacement(familySymbolToFind);
}
else
{
loadFamily(doc, fileName, familyName);
}
}
}
private void loadFamily(Document doc, string fileName, string familyName)
{
Transaction transNew = new Transaction(doc, "RealLoading");
transNew.Start();
if (doc.LoadFamilySymbol(fileName, familyName))
transNew.Commit();
}

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