Create a stiffener element on face.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am testing out creating a stiffener element on a face. There is a example code for placing new instance families by face reference, line and symbol that I was following and it always returns the same error: cannot be placed because line is outside of face.
I am pretty sure that line that I am creating is inside of the face, or at least two points are that I am creating the line from because when queried for Face.IsInside(pt) it return True for all of them.
Now, if I am creating a line from those points, is it possible that the line doesn't lie on the surface?
Here's how I get my face:
def getFace(element): #create geometry options/compute references geoOptions = Options() geoOptions.ComputeReferences = True #extract geometry geoElement = element.get_Geometry(geoOptions) geoSet = List[GeometryInstance]() elemIter = geoElement.GetEnumerator() elemIter.Reset() while elemIter.MoveNext(): curElem = elemIter.Current geoSet.Add(curElem) #extract faces from solids for i in geoSet: solids = i.SymbolGeometry for i in solids: faces = i.Faces return faces[0]
Here's my stiffener:
stiffeners = FilteredElementCollector(doc).OfClass(FamilySymbol).OfCategory(BuiltInCategory.OST_StructuralStiffener) symbol = [] for i in stiffeners: symbol.append(i)
and here's where it fails:
#"Start" the transaction TransactionManager.Instance.EnsureInTransaction(doc) pts = [] for i in points: famSymbol = symbol[0] faceRef = getFace(faces[0]).Reference face = getFace(faces[0]) uv1 = Autodesk.Revit.DB.UV(i[0].X, i[0].Y) uv2 = Autodesk.Revit.DB.UV(i[1].X, i[1].Y) line = Autodesk.Revit.DB.Line.CreateBound(face.Evaluate(uv1),face.Evaluate(uv2)) pts.append(face.IsInside(uv1)) pts.append(face.IsInside(uv2)) pts.append(line) #doc.Create.NewFamilyInstance(faceRef,line,famSymbol) # "End" the transaction TransactionManager.Instance.TransactionTaskDone()
Keep in mind that points input is really a list of UV points in the domain of 0-1 so assuming that this surface is normalized (and when asked for BoundingBox.min and max it returns 0 and 1 so it is) those points will fall on it.
pts output is just for me to see if points are inside of surface. They are.
Is it possible that when I do face.Evaluate(uv1) it returns a point that is not within surface anymore?