Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to modify the geometry of a FlexDuct and move the endpoints. It does work with line based families by simply assigning a new Line instance to the LocationCurve.Curve.
However, for flex ducts the same action throws an exception
Here is the sample code to reproduce the issue in Revit 2020:
using var tx = new Transaction(doc, "Change Flex");
tx.Start();
var flx = selection.OfType<FlexDuct>().FirstOrDefault();
var flexCurve = flx.Location as LocationCurve;
var flexSpline = flexCurve.Curve as HermiteSpline;
var clone = flexSpline.Clone();
flexCurve.Curve = clone;
tx.Commit();
The exception is thrown on the last line before committing the transaction. It won't even work if assigning the same hermite spline back to the .Curve property.
Exception's message is empty and there is no inner exception. Exception's function ID points to this file:
"d:\\ship\\2020_px64\\source\\api\\revitapi\\objects\\location\\apilocationcurve.cpp"
Again, this works with line based families such as Conduit. Is there a workaround for Flex ?
Thanks!
@Anonymous @Revitalizer
Solved! Go to Solution.