Solved! Go to Solution.
Solved by Joe.Ye. Go to Solution.
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
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
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.
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
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
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
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