Message 1 of 1
Error to create FabricSheet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've encountered an issue with creating FabricSheets in certain walls in my Revit project. Despite being able to create the same FabricSheet in multiple walls, I'm receiving an error when attempting to do so in specific walls.
However, after manually inserting a FabricSheet into one of these problematic walls:
I'm able to run the same code successfully without any errors.
I've tried examining the wall properties in Revit DB Explorer, but I haven't been able to identify any differences that might be causing the issue.
This is my code:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
Document doc = commandData.Application.ActiveUIDocument.Document;
var openingWindow = doc.GetElement(new ElementId(6855434)) as FamilyInstance;
var wall = openingWindow.Host as Wall;
var lengthWindow = openingWindow.Symbol.GetParameters("Comprimento")[0].AsDouble();
var locationPointOpening = ((LocationPoint)openingWindow.Location).Point;
var orientationOpening = openingWindow.HandOrientation.Normalize();
var pointToInsertFabricSheet = Transform.CreateTranslation(-orientationOpening.Multiply(lengthWindow / 2)).OfPoint(locationPointOpening);
using (Transaction t = new Transaction(doc, "Create Fabric Sheet"))
{
try
{
t.Start();
var fabricSheetType = doc.GetElement(new ElementId(7082324));
double width = fabricSheetType.get_Parameter(BuiltInParameter.FABRIC_SHEET_OVERALL_WIDTH).AsDouble();
double length = fabricSheetType.get_Parameter(BuiltInParameter.FABRIC_SHEET_OVERALL_LENGTH).AsDouble();
var pointAux = Transform.CreateTranslation(orientationOpening.Multiply(length / 2)).OfPoint(pointToInsertFabricSheet);
Transform transform = Transform.Identity;
transform.BasisY = XYZ.BasisZ;
transform.BasisZ = wall.Orientation;
transform.BasisX = -orientationOpening;
transform.Origin = Transform.CreateTranslation(-XYZ.BasisZ.Multiply(width / 2)).OfPoint(pointAux);
var fabricSheetCreated = FabricSheet.Create(doc, wall, fabricSheetType.Id);
fabricSheetCreated.CoverOffset = wall.Width / 2;
fabricSheetCreated.PlaceInHost(wall, transform);
t.Commit();
}
catch (Exception e)
{
if (t.HasStarted())
t.RollBack();
throw e;
}
}
TaskDialog.Show("Dialog", "FabricSheet created successfully.");
return Result.Succeeded;
}
Does anyone have some idea?
Thanks in advance.