Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66746

Re: HostObjectUtils

$
0
0

One thing is that it seems you're variable names may not be helping:

 

faces = HostObjectUtils.GetBottomFaces(element)
face = doc.GetElement(faces[0])

Might help if it looked more like this:

//Because GetBottomFaces returns a list of References, not elements or faces
IList<Reference> bottomFaceReferences = HostObjectUtils.GetBottomFaces(element);

//GetElement Returns an element, (the element which contains the referenced geometry if you pass it a reference)) //hence this is from the department of redundancy department:
Element hostElement = doc.GetElement(bottomFaceReferences[0]);

//You could get the face from the reference you have and the element from which it came: Face face = hostElement.GetGeometryObjectFromReference(bottomFaceReferences[0]);

//Then you can get the normal XYZ FaceNormal = face.FaceNormal;

Element elementWhichContainsFaceReference = doc.GetElemetn(faces[0]);

because GetElement(Reference) returns an element (the element which owns the face reference you passed it).  I wouldn't expect GetElement to ever return a face so your question is a bit confusing:  are you actually getting a face from GetElement()?  In the future, try to not paraphrase your code because it makes it hard to follow.  Also, I would suggest that, in the case you're using "var" for these, use explicit typing so you can follow exactly what's going on.

 

As for the more elegant solution, if you're dealing with a footprint roof, each sketch line can have a different slope and is controlled by a parameter "defines slope".  Have a look at FootPrintRoof.SlopeAngle and FootPrintRoof.DefinesSlope parameters.  You can get the model curves of the footprint with FootPrintRoof.GetProfies().

 

Not sure If I answered your question but I hope I made it a little clearer

 

 

 


Viewing all articles
Browse latest Browse all 66746

Trending Articles