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: 

Cannot get the sweep profile from the family instance

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1046 Views, 3 Replies

Cannot get the sweep profile from the family instance

Hello experts:

I created a family with a ceiling and a sweep, then load this family to project, I try to get sweep profile with the API as fellow:

FamilyInstance fi = ele as FamilyInstance;
Autodesk.Revit.DB.SweptProfile sweptProfile = fi.GetSweptProfile();

 

but failed. Could you tell me how to get the sweep profile from this familyinstance? Thank you. The attachment is the testing project.

 

Image 6.pngImage 7.png

 

 

Labels (3)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

add missed attachment

Message 3 of 4
architect.bim
in reply to: Anonymous

Hi!

Methods you've speciafied are actually not for you case. To get profile curves follow these steps:

  1. select your family instance in the project
  2. open it as a family document
  3. collect object of Sweep class
  4. get its profile family symbol
  5. open it as a family document
  6. collect objects of class CurveElement
  7. exctract curve from each instance of CurveElement class

In Python it looks like this:

generic_model_doc = doc.EditFamily(
    family_instance.Symbol.Family
)
sweep = FEC(generic_model_doc).OfClass(DB.Sweep).FirstElement()
profile_document = generic_model_doc.EditFamily(
    sweep.ProfileSymbol.Profile.Family
)
curves = [
    curve.GeometryCurve
    for curve in FEC(profile_document).OfClass(DB.CurveElement)
]

I hope you'll be able to adapt it to C#


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 4 of 4
Anonymous
in reply to: architect.bim

It works. Thank you.

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

Post to forums  

Autodesk Customer Advisory Groups


Rail Community