Download presentation
Presentation is loading. Please wait.
Published byMarian Dayna Townsend Modified over 7 years ago
1
Seeing Data And More… The Analysis Visualization Framework in the Revit API
Matt Mason Director, Software Development, IMAGINiT Technologies, inc.
2
Don’t Leave!
3
Who Am I? Matt Mason Director, Software Development, IMAGINiT Technologies (merged with Avatech Solutions) Veteran of 90 Small/Medium Revit API projects and 10 large API projects over 7 years. Packaged Software Developer: IMAGINiT Utilities for Revit BIMreview – now Autodesk Revit Model Review Scan to BIM for Revit Occasional Revit API Blogger at:
4
Who Are You? A Quick Survey….
Level of Revit Experience (Expert, Solid, Moderate, Beginner) Level of Revit API Experience (Expert, Solid, Moderate, Beginner) Type of Company (AEC firm, Software Company, Other) Type of Software Firm (Analysis-oriented, Other)
5
The Revit API Track Classes Tues 10:15 am
Seeing Data and More (Matt Mason) Tues 3:15 pm Extensible Storage in 2012 API (Jeremy Tammik) Tues 5:15 pm Asynch Interaction and Modeless (Arnost Lobel) Wed 8:15 am What’s New in the Revit 2012 API? (Elizabeth Shulok) Wed 3:15 pm Geometric Progression: Further Analysis (Scott Conover) Thu 10:00 am Revit API: Managing Building Data (Mario Guttman) Thu 3:15 pm Construction Modeling and API for Builders (Harry Mattison) Thu 5:00 pm Creating an Add-in, Start to Finish (Lab – Mike King) Thu 5:15 pm BIM Beyond Revit: Linking to External DBs (Greg Wesner)
6
What Inspired This Class?
7
Goals for this class? Understand what the Analysis Visualization Framework (AVF) is, and what it can do. Understand the uses for AVF (both traditional and unusual) Interlude: Creating Temporary Geometry Create and show a variety of visualizations Understand the limitations
8
What is the Analysis Visualization Framework (AVF)?
9
Building Analysis Application
Traditional Workflow Building Analysis Application Analyze Export Re-interpret
10
New Workflow
11
The AVF – In Practical Terms
Revit API routines to let you draw “data” graphics on screen Graphics are TRANSIENT – they do not live in the Revit model. Graphics have different display “styles”
12
AVF: Graphic Types Colored Surface Point Markers (w/ optional text)
Diagram (w/ optional text) * Vectors (w/ optional text) * * Revit 2012 only
13
AVF: Typical Uses Analysis Results: Lighting Energy Structure Airflow
Temperature
14
AVF: Unusual Uses Temporary Graphics: Point Cloud rendering
Point Cloud deviation from model Visualizing Geometry Temporary Vectors (curvature, grids, etc) And more…
15
Technical Fundamentals
16
AVF: Fundamentals Results Data Specific View Revit Model
17
AVF: User Interface / Configurability
18
Point Marker Example Data
19
Technical Details
20
Fundamental Building Blocks of AVF
AVF Display Style Spatial Field Mgr Analysis Display Schema Field Data Points/Values Revit View
21
AVF Programming Workflow
Create AVF Styles Get Spatial Field Mgr Analysis Result Schema Create Field Data Points/Values Update Spatial Field Primitive Apply correct style to view
22
AVF Programming: Getting Started
// Get the Spatial Field Manager from the current view, or create if it needs it. SpatialFieldManager sfm = SpatialFieldManager.GetSpatialFieldManager(doc.ActiveView); // create it on the active view, with one-dimension data. if (sfm == null) sfm = SpatialFieldManager.CreateSpatialFieldManager(doc.ActiveView, 1); // deal with looking up the results schema, if it exists – and create if not. if ( _schemaId != -1) { IList<int> results = sfm.GetRegisteredResults(); if ( results.Contains(_schemaId) == false ) _schemaId = -1; if (_schemaId == -1) { AnalysisResultSchema resultSchema1 = new AnalysisResultSchema("ShowPoints", "Data Points"); _schemaId = sfm.RegisterResult(resultSchema1); } } return sfm;
23
Field Data for Point Markers
FieldDomainByPoints XYZ FieldValues: List<ValueAtPoint>
24
AVF Programming: Simple Point/Values
public void ShowValues(Document doc, List<XYZ> points, List<double> values) { // take care of Spatial Field Manager / AnalysisResultSchema, etc SpatialFieldManager sfm = getSpatialFieldManager(doc); // now we need to populate the FieldDomainPointsByXYZ and values FieldDomainPointsByXYZ xyzs = new FieldDomainPointsByXYZ(points); IList<ValueAtPoint> fieldValsAtPoint = new List<ValueAtPoint>(); // values could be multi-dimensional, so it's a little complex to build foreach( double val in values ) { List<double> valueList = new List<double>(); valueList.Add(val); fieldValsAtPoint.Add( new ValueAtPoint( valueList ) ); } // (continued) FieldValues fieldVals = new FieldValues(fieldValsAtPoint); // add and update the spatial field primitive int idx = sfm.AddSpatialFieldPrimitive(); sfm.UpdateSpatialFieldPrimitive(idx, xyzs, fieldVals, _schemaId); }
25
AVF Programming: Updating the Default View Style
private void updateViewAVFStyle(View v, string stylename) { //does the current view have an analysis style? Parameter avf = v.get_Parameter(BuiltInParameter.VIEW_ANALYSIS_DISPLAY_STYLE); Document doc = v.Document; if (avf != null) { // NOTE: Find styles by a static method – not FilteredElementCollector ElementId pc = AnalysisDisplayStyle.FindByName(doc, stylename); if (pc.IntegerValue > 0) { bool success = avf.Set(pc); } } }
26
Point Data Sample Practical Sample
27
AVF: Analysis Display Schema / Settings
28
AVF Programming: Working with Surface Data
Data is surface-oriented Associate the data to the surface Put data in surface (u,v) coordinates (not XYZ) (2.2,1) V U
29
AVF Programming: Working With Surface Data
public void ShowValues(Document doc, Face f, List<UV> points, List<double> values) { // take care of Spatial Field Manager / AnalysisResultSchema, etc SpatialFieldManager sfm = getSpatialFieldManager(doc); // now we need to populate the FieldDomainPointsByUV and values FieldDomainPointsByUV pnts = new FieldDomainPointsByUV(points); IList<ValueAtPoint> fieldValsAtPoint = new List<ValueAtPoint>(); // values could be multi-dimensional, so it's a little complex to build foreach( double val in values ) { List<double> valueList = new List<double>(); valueList.Add(val); fieldValsAtPoint.Add( new ValueAtPoint( valueList ) ); } FieldValues fieldVals = new FieldValues(fieldValsAtPoint); // add and update the spatial field primitive int idx = sfm.AddSpatialFieldPrimitive(face, Transform.Identity); sfm.UpdateSpatialFieldPrimitive(idx, xyzs, fieldVals, _schemaId); }
30
Surface Data Sample
31
No Surface? Make your own with GeometryCreationUtilities!
Transient (in-memory) geometric elements Create: Blend Extrusion Revolved Sweep Swept Blend Use For: AVF Faces Find Elements Intersecting Solid Boolean Operations Geometry Operations Face.Project() Face.Intersect()
32
Transient Geometry Creation
33
Transient Geometry Creation: Code
public Solid CreateCylinder(Application app, XYZ origin, XYZ vector, double radius, double height) { // create a plane normal to a vector at an origin point Plane p = app.Create.NewPlane(vector, origin); // need to create this as two arcs rather than one! Curve circle1 = app.Create.NewArc(p, radius, 0, Math.PI ); Curve circle2 = app.Create.NewArc(p, radius, Math.PI, Math.PI * 2.0); // make a curve loop CurveLoop profile = CurveLoop.Create(new List<Curve>(new Curve[2] { circle1, circle2 })); List<CurveLoop> loops = new List<CurveLoop>(new CurveLoop[1] { profile }); // create Solid cyl = GeometryCreationUtilities.CreateExtrusionGeometry(loops, vector, height); return cyl; }
34
Transient Geometry: What’s Next?
Access the faces of the solid via the “Faces” property Just need a single surface? Find the closest surface to the location you need Highlight single surface with AVF Highlight all surfaces with AVF
35
Transient Geometry / AVF – Simple Face Highlighting
public void ShowFaceValue(Document doc, Face face, double value) { // take care of Spatial Field Manager / AnalysisResultSchema, etc SpatialFieldManager sfm = getSpatialFieldManager(doc); // now we need to populate the FieldDomainPointsByUV and value // we will use just a single (arbitrary) minimum bounding box point List<UV> points = new List<UV>(); BoundingBoxUV box = f.GetBoundingBox(); points.Add( box.Min ); FieldDomainPointsByUV pnts = new FieldDomainPointsByUV(points); IList<ValueAtPoint> fieldValsAtPoint = new List<ValueAtPoint>(); List<double> valueList = new List<double>(); valueList.Add( value ); fieldValsAtPoint.Add( new ValueAtPoint( valueList ) ); FieldValues fieldVals = new FieldValues(fieldValsAtPoint); // add and update the spatial field primitive int idx = sfm.AddSpatialFieldPrimitive(face, Transform.Identity); sfm.UpdateSpatialFieldPrimitive(idx, xyzs, fieldVals, _schemaId); }
36
Cylinder Sample Practical Example
37
Vector Data Similar setup: XYZ points XYZ values (VectorAtPoint)
38
Vector Samples Simple Sample Practical Example
39
Advanced Topics
40
AVF: Setting Units // set a single unit (unit factor) for the data
AnalysisResultSchema resultSchema1 = new AnalysisResultSchema("Deviation", "Deviation of data from geometry"); List<string> unitNames = new List<string>(new string[1]{“Inches”}); List<double> unitFactors = new List<double>(new double[1]{ 1.0 } ); resultSchema1.SetUnits( unitNames, unitFactors );
41
AVF: Setting Units (Multiple)
// set multiple unit factors AnalysisResultSchema resultSchema1 = new AnalysisResultSchema("Deviation", "Deviation of data from geometry"); // make it display values in either Inches or CM List<string> unitNames = new List<string>(new string[2]{“Inches”,”CM”}); List<double> unitFactors = new List<double>(new double[2]{ 1.0, 2.54 } ); resultSchema1.SetUnits( unitNames, unitFactors );
42
AVF Limitations Total Number of Points in View Graphic Load Per Point
vs. =
43
Advanced AVF Notes Points per primitive Not limited by SectionBox
SDK Samples: Spatial Field Surface Gradient DistanceToSurface MultiThreadedAVF
44
AVF Limitations Where can you use them? Not Families! Printing Data
45
Multiple Values in AVF Used For: Different scenarios
Point Value 0 Value 1 Value 2 Value 3 Value 4 (0,0) 1.1 1.2 1.3 (1,1) 1.4 1.5 1.6 (1,2) 2.1 2.0 1.9 1.8 (2,2) 2.3 2.25 2.15 Used For: Different scenarios Days/Months of the year
46
Conclusions Ideas? Q & A
47
Autodesk, AutoCAD* [*if/when mentioned in the pertinent material, followed by an alphabetical list of all other trademarks mentioned in the material] are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2011 Autodesk, Inc. All rights reserved.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.