« Adding a Shared Parameter to an RFA File | Main | Creating a Slanted Column »

June 09, 2009

Comments

Hello Jeremy,
I couldn't find an appropriate place to contact you so I'll post here.

I'm having trouble updating the revit options for library paths, below is my code. I'm not sure what I'm missing to updating back to the database.

public class AddLibraryPaths : IExternalCommand
{
public CmdResult Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements )
{
try
{
Application app = commandData.Application;
Document doc = app.ActiveDocument;
// string LibraryPaths = "";
string strLibPaths = "";
int count = 0;
foreach (String path in app.Options.LibraryPaths)
{
strLibPaths += path + "\n";
count +=count;
//strLibPaths = path.Substring(1);
}
count ++;

string MetricLibraryKey = "";

MetricLibraryKey = app.Options.LibraryPaths.get_Item("Metric Library");

app.Options.LibraryPaths.Insert("ImperialTestCreate", "C:\'Documents and Settings\'All Users\'Application Data\'Autodesk\'RAC 2010\'Imperial Library\'Detail Components");

app.Options.LibraryPaths.set_Item("ImperialTestCreate","C:\'Temp");

// app.Options.LibraryPaths.Equals(app.Options.LibraryPaths);

// app.Options.LibraryPaths.IsReadOnly;
Util.InfoMsg( string.Format(strLibPaths+MetricLibraryKey));
return CmdResult.Succeeded;
}
catch( Exception ex )
{
message = ex.Message;
return CmdResult.Failed;
}
}
}

Any advice would be greatly appreciated!


Dear Edgar,

Thank you for your interesting question. Posting a comment here on the blog is a fine way to contact me. I have created a draft for a new blog post to answer your question and mailed it to you directly for reviewing.

Cheers, Jeremy.

Dear Edgar,

The post is published now:

http://thebuildingcoder.typepad.com/blog/2009/08/library-paths.html

Thank you again for your question, review and feedback.

Cheers, Jeremy.

Hi Jeremy,
I've looked around and haven't found a way to do this yet. As we've been creating content for Revit, we've been saving our Symbols/Types into a txt file. LoadFamilySymbol works great if the Revit Types are built into the rfa file but when they are separated out into a txt file, it doesn't work. Is there a way to load a single family when they are separated out into a txt file?
Thanks for time/assistance!!
Matt

Dear Matt,

Please pardon my ignorance, but I thought a TXT file was always just associated with an RFA file, and all it did was define a list of additional combinations of parameters to define specialised types?

I have heard of cases where people wanted to load a specific symbol that was defined in such a pair of RFA plus TXT file and used LoadFamilySymbol successfully, so I don't quite understand what is not working for you?

One way to circumvent any possible problems with the TX file would be to just define one single type in the RFA file, load that, and then use the Duplicate method to create any other types that you need, as explained in

http://thebuildingcoder.typepad.com/blog/2008/11/creating-a-new-family-symbol.html

The technique is used to create new column and beam types in

http://thebuildingcoder.typepad.com/blog/2009/02/inserting-a-column.html

http://thebuildingcoder.typepad.com/blog/2009/02/inserting-a-beam.html

Cheers, Jeremy.

Dear Jeremy,
I have been trying to load a family type and then create an instance of that family type but I can't get pass of the FamilySymbol issue. How do I get this object? I want to insert isolated foundations "M_Pile Cap-Rectangular : 1400 x 1300 x 350mm". How do I get the FamilySymbol for this? I have been going through your blog, API Labs and the Developer Guide and I can't find an answer.
Thank you.

Best regards,
Vasco Granadeiro

Dear Vasco,

You will definitely need to hone up your searching skills a bit.

How about using the GetFirstFamilySymbol method in this recent post as a starting point:

http://thebuildingcoder.typepad.com/blog/2010/06/set-tag-type.html

If you need to search for the symbol by name, there are several previous posts which show exactly how to do this.

Cheers, Jeremy.

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