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: 

Extracting sweep from mass

1 REPLY 1
Reply
Message 1 of 2
GeomGym
398 Views, 1 Reply

Extracting sweep from mass

Hi All,

 

I'd like to be able to extract the sweep path of the mass (to detect the interpolated points on the spline) in the this revit project.  I can't find many details on how to do this, I was starting with the code below.

 

Any assistance greatly appreciated, happy to clarify as needed.

 

Jon

 


public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
Document doc = commandData.Application.ActiveUIDocument.Document;
Application app = commandData.Application.Application;
ElementSet selection = commandData.Application.ActiveUIDocument.Selection.Elements;
if (selection.Size <= 0)
{
message = "Must have Mass preselected!";
return Result.Failed;
}
Transaction trans = new Transaction(doc, "ExtractGeometry");
FailureHandlingOptions fho = trans.GetFailureHandlingOptions();
fho.SetFailuresPreprocessor(new WarningSwallower());
trans.SetFailureHandlingOptions(fho);
trans.Start();
foreach (Element e in selection)
{
FamilyInstance familyComponent = e as FamilyInstance;
if (familyComponent != null)
{
Options o = new Options();

GeometryElement ge = familyComponent.get_Geometry(o);
foreach (GeometryObject geomObj in ge)
{
GeometryInstance gi = geomObj as GeometryInstance;
if (gi != null)
{
string s = geomObj.GetType().ToString();

Tags (3)
1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: GeomGym

Dear Jon,

Thank you for your query.

I looked at your sample model and see the mass element.

You can explore it and its geometry using RevitLookup.

I do not see any possibility to access the underlying sweep path at all.

All you have access to is the solid, its faces and edges.

Since in this case the solid is a long, thin extrusion, it would be possible to analyse it and deduce the sweep line, more or less, but that is a non-trivial task, I would assume, and I do not see any support for such an undertaking in the Revit API.

How was this shape generated?

Could you access the sweep line earlier on in the process?

I hope this helps.

Best regards,

 

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 Design & Make Report