« No Multithreading in Revit | Main | Get Transformed Family Instance Geometry »

June 27, 2011

Comments

Hi Jeremy, let me first say that I enjoy reading your blog and it has helped me, as I am just getting started programming in revit.

I have a (non revit) line class I use and I want to use something like this in my code :

For Each rfi As RoofFaceInfo In RoofFaceList.GetList
Dim testface As PlanarFace = rfi.Face
Dim results As New IntersectionResultArray


testface.Intersect(line, results)

however I get an error in the last part (line, results). stating the value cannot be converted from line to revit.db.curve.

Do you hjave any ideas I could use

Dear Revit Newbie,

If the line instance that you are supplying is your own class, and not a Revit API class, then obviously it is not derived from Revit.DB.Curve, and thus does not fulfill the expectations of the PlanarFace Intersect method.

Yes, I have a suggestion: convert your non Revit line data to a Revit Line, e.g. using one of the Autodesk.Revit.Creation.Application.NewLine, NewLineBound or NewLineUnbound methods.

Cheers, Jeremy.

Dear Jeremy Sir,

Pls suggest how to set Family Parameter value (Retrieve from extensible storage) in Project Editor.

Thanks & Regards
Namit Jain

Dear Namit,

I do not completely understand your question.

Are you thinking of reading data from estorage in a family definition and using that to populate the family instance parameter value in the project when it is inserted?

That sounds like a useful thing to want to do. Please confirm, and I'll look into it.

Cheers, Jeremy.

Hello, Jeremy.
I need your help again:)
I want to store some data in Family and Family Symbols using Extensible Storage. Then I want to save this family to file and use this family in other projects.
There are no problem to set some data in the Family and its Symbols:

....
Entity entity = family.GetEntity(schema);
if (entity == null || !entity.IsValid())
{
entity = new Entity(schema);
}
entity.Set(field, "Family some value");
family.SetEntity(entity);
....
foreach (FamilySymbol symbol in family.Symbols)
{
Entity symbolEntity = symbol.GetEntity(schema);
if (symbolEntity == null || !symbolEntity.IsValid())
{
symbolEntity = new Entity(schema);
}

symbolEntity.Set(field, string.Format("FamylySymbol value: {0}", symbol.Name));
symbol.SetEntity(entity);
}
...

Next I save family. (Edit family - Save)

But then I load saved family into other project my data in FamilySymbol is absent.:(

....
Entity entity = family.GetEntity(schema);
if (entity == null || !entity.IsValid())
{
return Result.Failed;
}
var str = entity.Get(field);
//here everithing ok. str = "Family some value"
....
but
....
foreach (FamilySymbol symbol in family.Symbols)
{
Entity symbolEntity = symbol.GetEntity(schema);
//here entity is always not valid.
}
....

Is there way to keep data in Family file for each FamilySymbols?
I tried shared parameters, but they also doesn't save in Family file.

Best regards, Victor

Dear Victor,

I would say that your question is demonstrating a basic misunderstanding of families and symbols.

Think of it like this: a family is a database table. The family parameters are the database table fields, and each type in the family is a record. The family types in the family definition are not represented as individual Revit elements and thus do not really exist.

When a family is loaded into a project, the family types are converted into family symbols, or rather cause them to be generated. The family symbols exist as individual Revit elements, but only within the project into which the family was loaded.

If you attach extensible storage data to the family symbols, it likewise only exists within the project into which the family was loaded.

The family file remains unaffected.

I hope you understand what I mean and see the error of your ways :-)

I trust you will find an efficient alternative approach to fulfill your requirements.

Merry Christmas and Happy New Year!

Cheers, Jeremy.

Hi Jeremy. Thanks for your response.
Now I understand how families and symbols works.
I made same suggestion then I tried get Symbols of Family when document.IsFamilyDocument. In this case Symbols is empty.

I can see two ways to achieve my requirements:
1) use BuiltInParameters of FamilySymbols (it saves in files). But I don't like this approach
2) Use ExtensibleStorage for Family and save needed Symbols info in it.

I've chosen second way.
I've created two schemes: one for family and one for symbol. In symbol schemes I save needed information for each Symbol.
For example, http://pastebin.com/M1XhkZg0

Family schema contains only one MAP field where key is Symbol.Name and value is SymbolEntity: http://pastebin.com/CetyXhh2

I'm already applied this approach in my solution and it works well. Now when I save family and open it in other project I can retrieve data that I saved in Family.

Happy New Year!

Best regards, Victor.

Dear Victor,

Wow, that was quick!

Congratulations on solving this!

I would have chosen the same solution as you did :-)

Happy New Year!

Cheers, Jeremy.

Hi, Jeremy.
Extensible storage is a great feature but I have a problem again using it.
I have a simple test project. I SetEntity to the Family in this project. Save file. Then I delete schema which belongs to this entity and save project again and close it. But then I reopen this project I get error: "Element XXXXXX became corrupt at some time before this session. To continue with this project, save a recovery file, this element will be deleted to fix the problem."

The XXXXXX element - is the element which I SetEntity before.
But if I close this message project doesn't loaded and Revit close with error.

in journal I see next logs:
http://pastebin.com/APwMp5N8

So, it is very bad. How can I avoid this behavior? I'm afraid if I install my add-in that use Extensible storage and designers will get this error and cannot open file they kill me:)
May be exists some utility from Autodesk that can recover corrupted file?

Is this a bug?

Regards, Victor

Dear Victor,

You really are diving in deep with the extensible storage.

Congratulations again on discovering this issue. Your testing is good and important!

I hope very strongly that you are running on the initial release of Revit 2012, or only the first update release. Some issues with extensible storage were fixed in Revit 2012 Update Release 2:

http://thebuildingcoder.typepad.com/blog/2011/10/product-and-add-in-wizard-updates.html#2

You should ensure that you and your customers are running on that version or higher to avoid the issue.

Happy New Year!

Cheers, Jeremy.

Good afternoon, Jeremy.
I don't know good it or bad but I use last version of Revit Architecture. I've read Enhancements list of update 1 and 2 and I hope that there are no errors in ExStorage after update but I was wrong:(

I've already got this issue:(

P.S. I really doesn't remember when I installed Update 2. May be installation was not correct. What do you think if I'll send you this file and you'll test it in your computer?

Thanks, Victor

Dear Victor,

Sounds pretty bad to me if there is any such issue still in there.

If you really are using the most recent version and your ADN membership has come through by now, then please submit an ADN DevHelp Online case for it. I am on holiday tight now.

Thank you!

Cheers, Jeremy.

Hello, Jeremy.
You write about strong advantage of EStorage when store ElementId there because entity ElementId value mapped with real Element. I fully agree with you.
But now I've found if I rollback transaction ElementId doesn't remapped to entity.

That I mean.
I have a schema with ElementId field. I store Level.Id there but it is not important in this case. Then I create an entity and set it to some element. Next I delete level. So, if get my entity and extract field value, I'll get ElementId.InvalidElementId because I've deleted element before. But if I rollback transaction I also get ElementId.InvalidElementId field value. So the ElementId does remapped with entity.

How do you think, is it a bug?

Best regards, Victor.

Dear Victor,

Thank you very much for noticing and reporting this.

It definitely sounds to me like something the development team should have a closer look at.

Could you please provide a reproducible case and submit an ADN issue for further investigation of this?

Thant would be a great help!

Thank you!

Cheers, Jeremy.

Hello, Jeremy.
Yes, sure. Case #07060034.

In my opinion Extensible storage use DMU for updating ElementId in entities that doesn't support transaction rollback. But maybe I was wrong.

Best regards, Victor.

Hi..Jeremy

I am creating "Group" through API and setting some entities to the grouptype. When I save the group locally and reuse in some other document(using Load as Group option) new group instance doesn't contain any schema information. But i need to retrive that entities?

please advise me..How can i acheive this?

Thanks

Dear Sangsen,

Yes, indeed, schema information is not automatically copied by Revit. That is left up to the add-in to handle as it wishes, e.g. using a dynamic model updater DMU.

Cheers, Jeremy.

+1 for a filter for retrieving elements with a specific schema entity. It would be very useful. It's my second project where this kind of filter could have helped me.

Dear Maxence,

I get the gist of what you mean, i.e. the importance of being able to retrieve elements with extensible data for a specific schema. You will be happy to hear that we are working on that.

I don't know exactly what you mean by "+1 for ..."

Does that refer to 'top priority', or 'one more request for', or what?

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