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: 

Issue when I create a direct shape instance based on a family instance.

9 REPLIES 9
Reply
Message 1 of 10
juanquis_avila
996 Views, 9 Replies

Issue when I create a direct shape instance based on a family instance.

Hello everyone,

 

I have create a bunch of direct shape instances for a multiple family instaces located in my project. Everything seems to work perfeclty but for some instances, structural framing category to be more accurate, their direct shape instaces are being created at the project's origin point. I've being doing some debugging and found that some FamilyInstance object do not have a spatial poing which means that its location poing is null. I need the direct shape instance to be created exactly at the same point of my original element. This need to be an exactly copy.

 

Do you have any kind of solution for this issue?

 

thank you very much for your attention.

 

Juan Avila.

@Anonymous

9 REPLIES 9
Message 2 of 10

Are you using the element's instance geometry to create the direct shape?

 

Also, if the element doesn't have a location point, it might have a Location Curve. If so, you can get the first end point of that curve.

Message 3 of 10

Hey 😄 thanks for replying.

 

Yeah. I've tried already using LocationCurve and the thing is that i cannot fit the direct shape position and rotation just exactly the original instance. I'm going to take a screenshot in order to show you 😄

Message 4 of 10

Without code we can only guess:

 

Are you creating the direct shape from symbol geometry of the family instance? Meaning it is located in the symbol position and hasn't been transformed to an instance position? No DirectShape has a location as far as I'm aware.

Message 5 of 10

Dear Thomas,

 

yeah Ive create the DirectShape using de Solid from the SymbolGeometry of my family instance. Let me show you with pictures what is the issue I'm facing.

 

DirectShapes are supossed to appear right where the family instances are (that's what i expect) but they are being relocated at the project origin point.

juanquis_avila_0-1598660717931.png

 

Message 6 of 10

DirectShapes appear where you create them.

 

The way Revit works with geometry means that it creates the geometry in a symbol position (this is near the origin) and then for each instance it copies and transforms that to an instance position (similar to blocks in AutoCAD) . This is to save space in defining the same geometry over and over again. So to rectify your problem you can use the Transform that is part of GeometryInstance to relocate where the geometry is created.

 

If you look at the RevitAPI.chm there is an example under the Element.Geometry property that uses GeometryInstance.GetInstanceGeometry(Transform).

 

Note also that if you are creating a direct shape in every instance position you are inevitably going to bulk up the file size since you are breaking the Symbol/Instance relationship. Use of DirectTypeShape may help slightly in this respect.

 

Note also that a GeometryInstance only exists where the Instance has not be modified but cuts/joins (where it is not unique).

 

 

Message 7 of 10

Hi! Thanks for your reply.

 

What you are saying makes a lot of sense. I'm definitely going to try it out and will let you know immediately. Thank you very much for your help.

 

Just for your interest, this is the code im using in order to create the direct shape bases on an element/familyinstance.

I've used de same code to create directshapes from spaces geometry and i hadn't had any issue at all. Those shapes were located just exactly as their space. an exact copy.

 

 

 

 

Message 8 of 10

Yes, system families generally have solids rather than GeometryInstance objects at top level and FamilyInstances also have top level solids rather than GeometryInstances if they've been modified by cuts etc. So you have to cater for both eventualities.

Message 9 of 10

Well in my case I would need to relocate the directshape right where the familyinstance is.

Message 10 of 10

Hey,

 

I've finally worked it out how to solve this issue. I've used GeomtryObject insted of Solid in order to create the direct shapes and all of them are being created just exactly where the family instance is not near the origin point as we discussed before.

I would really like to undertand though why this happens and what is the difference between using the geometryobject or a Solid.

 

Thank you very much for your time

 

Cheers ;D 

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

Post to forums  

Autodesk Customer Advisory Groups


Rail Community