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: 

load profile for NewSweep command

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
tobiazambon
1919 Views, 7 Replies

load profile for NewSweep command

I'm creating a Revit 2014 plugin that wraps the Sweep command, in particular I need to load a profile that I've created as a family (starting from Metric Profile.rft) into a project, then ask to the user to pick the lines that will become the extrusion path and finally do the sweep. I've read tons of tutorials of how to programmatically create a sweep but all of them creates the SweepProfile by adding new Curves into a CurveArray; no one of them explains how to load a profile from a family and give it to the NewSweep(...) command. I'm quite sure that this can be done and maybe I just can't see the elephant in the room..can someone give me a hit on how to load a profile from a family file? Thank you!
Tags (1)
7 REPLIES 7
Message 2 of 8
jeremytammik
in reply to: tobiazambon

Dear Tobia,

 

Thank you for submitting this query to the discussion forum and sorry for the delay in answering.

 

You can certainly retrieve a profile for a sweep operation from a family file.

 

However, the family file does not provide any provision for storing a profile per se, so you will have to make use of the other geometrical options available in that context to define some kind of geometry specifying the sweep profile.

 

You can then parse that geometry, extract the profile information, and put together the required curve array in your add-in.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 8
tobiazambon
in reply to: jeremytammik

Hi Jeremy, Thank you for your effort to help us! I will try to do what you are suggesting (I don't know where to start from but I'm positive I will find the path)

 

Tobia

Message 4 of 8
Joe.Ye
in reply to: tobiazambon

 

Hi Tobia,

 

NewSweep method has the override to accept a profile family as argument to create a sweep.

 

public Sweep NewSweep(
bool isSolid,
ReferenceArray path,
SweepProfile profile,
int profileLocationCurveIndex,
ProfilePlaneLocation profilePlaneLocation
)

 

The SweepProfile has two derived classes: 

    FamilySymbolProfile 

    CurveLoopsProfile

 

FamilySymbolProfile maps to a family symbol of a profile family. It can be retrieved by the following Application class's member method.

 

public FamilySymbolProfile NewFamilySymbolProfile(
FamilySymbol familySymbol
)

 

Hope I my understanding to your question is right.

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 5 of 8
tobiazambon
in reply to: Joe.Ye

Hi Joe, thank you for your reply! Yes this is a solution, I didn't see it because I was using always Deocument.Create instead of Document.FamilyCreate..

This is because I need to model an in-place family. Do you know if there is a way to create an in-place component using the API?

 

Thank you again

Tobia

Message 6 of 8
Dale.Bartlett
in reply to: tobiazambon

Hi Joe, I know this is old, but I have not been able to find a clear example of how to use this to pass a Profile Family parameter as a SweepProfile.

NewSweep(
bool isSolid,
ReferenceArray path,
SweepProfile profile,
int profileLocationCurveIndex,
ProfilePlaneLocation profilePlaneLocation

As the original poster said, there are countless examples to create a profile but I have found none to use a loaded Profile Family.

SweepProfile NewSweepProfile(Document doc, string FamilyName)

{

// what goes in here, given the family can have multiple types?

}

 

Dale




______________
Yes, I'm Satoshi.
Message 7 of 8

Hi Joe, any chance you could expand with a code example to select a profile? I have not been able to crack this one. Admittedly, I put it away for a while... Thanks, Dale




______________
Yes, I'm Satoshi.
Message 8 of 8
jeremytammik
in reply to: tobiazambon

I published a complete NewFamilySymbolProfile sample add-in to demonstrate the steps:

 

http://thebuildingcoder.typepad.com/blog/2018/02/newfamilysymbolprofile-sample-add-in.html

 

https://github.com/jeremytammik/NewFamilySymbolProfile

 

Enjoy!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community