Hi Dale, I haven't found a complete solution to this, but enough to do what I needed, which was a temporary view to find the centroid of a family via it's bounding box. I have attached a solution Jeremy provided. Best regards Peter _____ Peter L Mann RIBA FIAP CodeBook International Ltd. St Clere, 15 Deepdene Wood, Dorking, RH5 4BG, UK
www.CodeBookInternational.com tel: +44 1306 877 513 mobile: +44 7979 805 609 _____Description: Autodesk, Inc.Developer Network Dear Peter, Thank you for your query. I have not updated the blog post you mention yet, nor explored in detail how to do so. Just looking at the description and sample provided with the CreateIsometric method by the Revit API help file RevitAPI.chm, though, it looks as if it should be pretty straightforward. Please look at the description of the View3D class in the help file. It includes some sample code implementing a Getinfo_View3D method, which points to some useful methods on the class. Oops, I was just going to suggest using the EyePosition property to define the camera position, only to notice that that is marked obsolete as well. Well, that leaves the ViewDirection and Origin properties returning the direction towards the viewer and the origin of the screen... oops, both read-only. Ah, interestinger and interestinger ... look at the new View3D methods * SetOrientation: Sets the temporary orientation of the View3D. The new orientation is not saved in the document. * SaveOrientation: Converts the temporary orientation of the View3D into its saved orientation. They both make us of the new ViewOrientation3D class. Oh no, you should know this, and so should I: for every single migration question you ever have, please first of all take a look at the Revit API help file What's New section. It clearly and succinctly states: View API View Creation 1. Plan Views can now be created with the new ViewPlan.Create(document, viewFamilyTypeId, levelId) method. For example, a ceiling plan can be created as follows: Level level = null; ElementId viewFamily3d = ElementId.InvalidElementId; IEnumerable viewFamilyTypes = from elem in new FilteredElementCollector( doc ) .OfClass( typeof( ViewFamilyType ) ) let type = elem as ViewFamilyType where type.ViewFamily == ViewFamily.CeilingPlan select type; ViewPlan ceilingPlan = ViewPlan.Create( doc, viewFamilyTypes.First().Id, level.Id ); ceilingPlan.Name = "New Ceiling Plan for " + level.Name; ceilingPlan.DetailLevel = ViewDetailLevel.Fine; // 3D views can be created with // View3D.CreateIsometric and // View3D.CreatePerspective. // The new ViewOrientation3D object is used to // get or set the orientation of 3D views. View3D view = View3D.CreateIsometric( doc, viewFamily3d ); XYZ eyePosition = new XYZ( 10, 10, 10 ); XYZ upDirection = new XYZ( -1, 0, 1 ); XYZ forwardDirection = new XYZ( 1, 0, 1 ); view.SetOrientation( new ViewOrientation3D( eyePosition, upDirection, forwardDirection ) ); 2. The ViewSection class now has methods that support the creation of Callout, Reference Callout, and Reference Section views. 3. Rendering views containing images imported from disk can be created using the new ImageView class and the ImageView.Create method. The most interesting part of this for your case is the second part of the comment in the sample code. I hope this helps. Please let me know what you end up with, and I might have a look at migrating The Building Coder sample code as well. Thank you! Best regards, Jeremy Tammik Developer Technical Services
http://adn.autodesk.com _____ Come to DevCamps this Summer; AEC DevCamp, June 6-7 and/or MFG DevCamp, June 13-14 where beginner and expert software developers learn face to face from Autodesk software engineers. New this year Cloud and Mobile app development classes! View detailed agenda and register here _____ At anytime, you may add information to your Case by simply replying to this email. Be sure to include this email in your reply, so that your comments are automatically updated in your Case. _____ If this is urgent, you have any questions or need further assistance, please contact one of the managers below: * Americas - Mikako Harada * Europe - Gary Wassell * South Asia - Virupaksha Aithal * China - Joe Ye * Japan - Katsuaki Takamizawa * Media & Entertainment - Cyrille Fauvel * Worldwide - Stephen Preston CaseNo:07269677. Case Description NewView3D is now obselete and the suggestion is to use CreateIsometric, but the arguments for this are document and view type, there isn't an option to specify a direction. How can I create a 3D view of a specified direction? I need this for a function based on one of Jeremy's tips. Public Function FindElemCentreXYZ(elem As Revit.DB.Element, ByRef max As Revit.DB.XYZ, ByRef min As Revit.DB.XYZ) As Revit.DB.XYZ ' based on
http://thebuildingcoder.typepad.com/blog/2010/01/spot-elevation-creation-on- top-of-beam.html Try rTrans.DoStartSubTran() Dim centerOfBox = New Revit.DB.XYZ(0, 0, 0) Dim doc As Document = elem.Document Dim viewDirection As Revit.DB.XYZ = New Revit.DB.XYZ(0, 0, -1) Dim view3D As View3D = doc.Create.NewView3D(viewDirection) 'Dim VT As ElementId = Get3DViewElementID() 'Dim view3D As View3D = DB.View3D.CreateIsometric(doc, VT) Dim elemBoundingBox As BoundingBoxXYZ = elem.BoundingBox(View3D) max = elemBoundingBox.Max min = elemBoundingBox.Min centerOfBox = min.Add(max).Divide(2) rTrans.DoRollBackSubTran() Return centerOfBox Catch ex As Exception rTrans.DoRollBackSubTran() Return New Revit.DB.XYZ(0, 0, 0) End Try End Function Created By: Peter Mann (5/22/2012 1:54 PM) Hi Jeremy, My question is do you have a version of your code snippet updated for Revit 2013 that replaces the obsolete NewView3D? The update notes suggest CreateIsometric, but because this doesn't include the view direction, it will break your snippet? The direction will not matter if finding the centre of the bounding box, but it will if one wants the extents.
http://thebuildingcoder.typepad.com/blog/2010/01/spot-elevation-creation-on- top-of-beam.html Privacy | Legal Description:
http://na1.salesforce.com/servlet/servlet.ImageServer?oid=00D300000008uIL&es id=0183000000KEi1l