Buckets:
| Application: ObjectViewer | |
| Revit Platform: All | |
| Revit Version: 2011.0 | |
| First Released For: 9.0 | |
| Programming Language: C# | |
| Skill Level: Advanced | |
| Category: Views | |
| Type: ExternalCommand | |
| Subject: Show element's geometry,get and set its parameter value. | |
| Summary: | |
| This sample demonstrates two main features: | |
| 1. | |
| How to get physical or analytical model of selected element. | |
| 2. | |
| How to get and set parameters value of selected element. | |
| Classes: | |
| Autodesk.Revit.UI.IExternalCommand | |
| Autodesk.Revit.DB.Element | |
| Autodesk.Revit.DB.GeometryElement | |
| Autodesk.Revit.DB.Parameter | |
| Autodesk.Revit.DB.GeometryObject | |
| Autodesk.Revit.DB.Transform | |
| Autodesk.Revit.DB.Structure.AnalyticalModel | |
| Project Files: | |
| Command.cs | |
| This file contains the class Command which inherits from IExternalCommand interface and implements the Execute method. | |
| ErrorMessageException.cs | |
| It contains a class ErrorMessageException which is used to pass error message to UI or back to internal error message box by Execute method in IExternalCommand. | |
| GeometryData.cs | |
| It contains a class GeometryData which is used to get Revit geometry data and transform the data to appropriate format for GDI. | |
| Graphics2DData.cs | |
| It contains: | |
| A class Graphics2DData which is a data class for graphics 2D | |
| A class EmptyGraphics2DData which derives from Graphics2DData could represents a PointF class with uninitialized member data. | |
| Graphics3DData.cs | |
| It contains a class Graphics3DData which is a data class for graphics 3D. | |
| MathUtil.cs | |
| It contains a class MathUtil which provides matrix algorithm. | |
| ModelData.cs | |
| It contains a class ModelData which is used to generate GraphicsData from elements analytical model. | |
| ObjectViewer.cs | |
| It contains the class ObjectViewer which is main command class of the ObjectViewer application. | |
| ObjectViewerForm.cs | |
| It contains a class ObjectViewerForm which is used to display selected element in a PictureBox and its parameters in a DataGridView; it also allows showing element in different conditions via RadioButtons, ComboBox and so on. | |
| Para.cs | |
| It contains a class Para which is used to define a parameter of Element. | |
| ParasFactory.cs | |
| It contains a class ParasFactory which is used to create a SortableBindingList<Para> collection. The SortableBindingList could store information about parameters according to an Element. | |
| Sketch.cs | |
| It contains a class Sketch3D which provides methods to draw objects in PictureBox and deals with operations Move Zoom Rotate. | |
| UCS.cs | |
| It contains a class UCS which stands for user coordinate system. | |
| Vector.cs | |
| It contains a class Vector which is Point class used to store point coordinate value. | |
| Description: | |
| This sample demonstrates the following functionalities: | |
| - | |
| The command only works with one selected element. | |
| - | |
| In a Dialog, displays selected element in a preview window on the left and generic properties grid on the right. | |
| - | |
| The dialog contains radio buttons for switching between physical and analytical model. If the element does not have a physical or analytical model, option should be disabled and preview window should be grayed. | |
| - | |
| The dialog contains lists for selecting the following opinions: | |
| - | |
| Detail Level for physical model. | |
| - | |
| Views for physical model. | |
| - | |
| View direction for both models (physical and analytical model). | |
| - | |
| The selected element has its geometry, physical or analytical displayed in the preview pane. The elements generic properties should be displayed in the grid. | |
| - | |
| The preview panel default to a view direction of -1,-1,-1 i.e. looking down at an angle to the object | |
| - | |
| When mouse is inside the region of preview window, user zoom, rotate and move model: | |
| - | |
| Click A, S, D, W keys to move model to left, down, right and up. | |
| - | |
| Click up arrow, down arrow, left arrow, right arrow, Pg Up, Pg Down to rotate model around center. | |
| - | |
| Click Home and End keys to zoom in and out model. | |
| - | |
| All parameters displayed in the grid with their name, value, unit name. Parameters value can be changed successfully if the input value is acceptable and this parameter is not read only. | |
| Implementations: | |
| - | |
| The physical model is available via the Geometry property of the Element. | |
| - | |
| The analytical model could be found by the AnalyticalModel property available on specific elements. There are several forms of analytical model and all should be displayed by this sample. | |
| - | |
| Special attention should be paid to Inplace Family Instances to ensure that they display correctly. | |
| Instructions: | |
| 1. | |
| Draw a line, wall, beam or desk and so on. | |
| 2. | |
| Select one, and run this command. | |
| 3. | |
| A dialog will be shown to display selected element in a PictureBox and its parameters in a DataGridView, it is allowed to change parameters value via changing value in DataGridView. | |
| 4. | |
| Select radio buttons Physical Model or Analytical Model to switching between physical and analytical model of selected element. | |
| Note: If this element doesnt have some model, the PictureBox should become gray. | |
| 5. | |
| As description above, click some keys to move rotate or zoom model, the model can be seen from different angles. | |
| 6. | |
| Changing selection of ComboBox Detail level, View direction and ListBox Displayed view will lead to transformation in PictureBox. It is similar to operations in Revit. |
Xet Storage Details
- Size:
- 5.34 kB
- Xet hash:
- 5ca263f0b7b2a7f29aeb29de3abee5cfe5f6c25d04d84e6b58a3382a02fdc206
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.