http://thebuildingcoder.typepad.com/blog/2010/01/spot-elevation-creation-on-top-of-beam.html
CmdNewSpotElevation in The Building Coder samples:
Dear Jeremy!
Your code don't work.
Error message translated to english is mean :
"One or more point coordinates are not correct. The coordinates of a point as a whole can refer only to those occurrences that have the correct coordinates on the view."
This is screenshot
http://piccy.info/view3/11527140/6a4eca43a95eb71c731f7d81c940da0f/orig/
I want create spot elevation in the intersection point wall and toposurface. What i do wrong?
Private Function CalculateLineAboveFloor(doc As Document, wWall As Wall) As Line ' Find a 3D view to use for the ReferenceIntersector constructor Dim collector As New FilteredElementCollector(doc) Dim isNotTemplate As Func(Of View3D, Boolean) = Function(v3) Not (v3.IsTemplate) Dim view3D As View3D = collector.OfClass(GetType(View3D)).Cast(Of View3D)().First(isNotTemplate) ' Use the center of the skylight bounding box as the start point. Dim box As BoundingBoxXYZ = wWall.BoundingBox(view3D) Dim center As XYZ = box.Min.Add(box.Max).Multiply(0.5) ' Project in the negative Z direction down to the floor. Dim rayDirection As New XYZ(0, 0, -1) 'Dim filter As New ElementClassFilter(GetType(Floor)) ' Dim filter As New ElementClassFilter(GetType(TopographySurface)) Dim filter As New ElementClassFilter(GetType(TopographySurface)) 'Dim refIntersector As New ReferenceIntersector(filter, FindReferenceTarget.Face, view3D) Dim refIntersector As New ReferenceIntersector(filter, FindReferenceTarget.Mesh, view3D) Dim referenceWithContext As ReferenceWithContext = refIntersector.FindNearest(center, rayDirection) Dim reference As Reference = referenceWithContext.GetReference() Dim intersection As XYZ = reference.GlobalPoint ' Create line segment from the start point and intersection point. Dim result As Line = Line.CreateBound(center, intersection) 'Create spot elevation Dim p As XYZ = result.GetEndPoint(1) Dim bEnd As XYZ = p.Add(New XYZ(0, 1, 4)) Dim EndPnt As XYZ = p.Add(New XYZ(0, 2, 4)) Dim curView As DB.View = doc.ActiveView Dim rp As New Reference(curView) Dim sd As SpotDimension = doc.Create.NewSpotElevation(curView, reference, p, bEnd, EndPnt, p, True) Return result End Function
Please fix the code and submit a pull request for the correction to be included in future versions.
To explore what might be going wrong, you might want to perform the operation manually in the user interface first, then explore the results and how to achieve the same via API.
The error message in your screen snapshot is in Russian. Please submit the text, so we can plug it into a translation tool.
Thank you!