Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Everyone, I made a script a while ago that took wall geometry and recreated it on the slab for when doing tilt wall layout plans. Looks something like this...
it allows us to easily create layout plans for our total stations.
but there is an issue when i have a round penetration going though the wall. Like this....
Here is my code:
foreach (ElementId elemId in selectedIds)
{
Element elem = uidoc.Document.GetElement(elemId);
double wVolume = 0;
double wArea = 0;
if ((BuiltInCategory)elem.Category.Id.IntegerValue == BuiltInCategory.OST_Walls)
{
//get wall area and volume
wVolume = elem.LookupParameter("Volume").AsDouble();
wArea = elem.LookupParameter("Area").AsDouble();
Options opts = new Options();
opts.ComputeReferences = true;
opts.IncludeNonVisibleObjects = false;
//geometry element
GeometryElement geoEle = elem.get_Geometry(opts);
DirectShape ds = null;
TessellatedShapeBuilder builder = new TessellatedShapeBuilder();
builder.OpenConnectedFaceSet(true);
//get wall solids
foreach (GeometryObject geomObj in geoEle)
{
Solid geomSolid = geomObj as Solid;
if (null != geomSolid && 0 < geomSolid.Faces.Size)
{
int count = geomSolid.Faces.Size;
foreach (Face face in geomSolid.Faces)
{
List<CurveLoop> cL = new List<CurveLoop>();
cL = (List<CurveLoop>)face.GetEdgesAsCurveLoops();
int countCl = cL.Count;
foreach(CurveLoop curveLoop in cL)
{
List<XYZ> args = new List<XYZ>();
foreach (Curve curve in curveLoop)
{
XYZ pt = curve.GetEndPoint(0);
args.Add(pt);
}
builder.AddFace(new TessellatedFace(args, ElementId.InvalidElementId));
args.Clear();
}
}
}
}
builder.CloseConnectedFaceSet();
builder.Build();
TessellatedShapeBuilderResult result = builder.GetBuildResult();
//create direct shape
ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_Walls));
ds.ApplicationId = "Application id";
ds.ApplicationDataId = "Geometry object id";
ds.SetShape(result.GetGeometricalObjects());
any idea how i can make this work with a cylindrical penetration?
heres the error im getting.
Solved! Go to Solution.