I arrived in Gothenburg last night.
Today I participate in my last DevDay conference for this year.
Adam and Jim are continuing to Moscow, where they will be supported by Vladimir and the rest of the team there.
Last week we conducted DevDay conferences in Paris, Milano and Farnborough, ending with a two-day stay in Munich to hold a DevDay conference followed by a DevLab workshop.
A DevLab is an open event where developers roll up bringing their current work and issues and continue developing side by side with one or more ADN DevTech engineers, in this case your humble correspondent.
This time, we organised it as a round table with everybody contributing and sharing ideas on everything together instead of holding one-on-one sessions with people waiting their turn.
Here is an overview of the participants and the numerous issues we discussed:
Overview and Participants
- Jabir Ljazouli, FISA
- Intersection between two elements
- Multi-language parameters
- Load and prompt for placement of a group
- Prompt for family instance placement options
- Remy van den Bor, ICN Solutions
- Hello world for an AppStore app
- How to use Python with Revit
- How to make a dockable tool palette
- Access to a sketch line in an extrusion in a family
- Christian Tonn, kubit
- Point clouds
- How to retrieve more than a million points
- Retrieve point cloud engine settings the view options
- Preview Control
- Programmatically generate user input to Revit commands
- Record and play back user input
- Tim Hoffeller, CAD Development
- Overview of the GitHub examples
- Managed C++ VDI 3805 MEP Family Generator
- 2D cloud-based room editor
- Alex Tomkeyev, M. C. Dean
- Unit testing
- CSV file that defines the lookup tables for parameters
- Junction box connect pipe of conduit, but it has no connectors
- Rudolf Honke and Karsten Klempin, acadGraph Man & Machine
- Revit MEP
- Extensible Storage
- Flex pipes and ducts, get the paths, determine the axis, the spline followed by the pipe
- Add fields to existing estorage schema
- Kris Riemslagh, HSBSoft
- Dynamic update of elements mutually influencing each other
- Solid modelling in the Revit project environment
- Jochen Reichert, BIMM
- Room area with slanted walls
- Analytical visualisation framework
- Editing a floor boundary
- How to determine the area and volume of a hole generated by a window
Somewhat miraculously, we managed to discuss all of these topics and provide some ideas on resolving each.
We even had some time left over at the end for a leisurely chat to round off the hectic week.
At the DevDay conference, we were told about banned.h. What is that?
Banned.h is a new C header file introduced in Visual Studio 2012 that automatically warns a developer about unsafe C and C++ function usage. It is a sanitizing resource that lists all banned APIs and helps you locate them in your code. It uses pre-processor #define pragmas to ensure that the compiler produces notifications about unsafe function calls. Replacements for the unsafe functions have been around for a long time, but calls to the unsafe functions may still be around, e.g. from age-old code.
Hello World for an AppStore App
Where can I find a minimal introduction to creating an Autodesk Exchange AppStore application, e.g. a simple 'Hello, world' example?
Look at the Exchange App videos on YouTube.
How to use Python with Revit
How to Make a Dockable Tool Palette
Here is a list of several dockable tool palette samples.
Unit testing is important and can lead to a completely new approach to developing and programming.
Two serious unit testing frameworks for Revit add-ins have now been presented, both of them based on NUnit:
Here is a collection of The Building Coder unit testing articles.
Overview of the GitHub Examples
Could you please provide an overview of the examples that you currently provide on GitHub?
Yes, sure; here they are:
- FramingXsecAnalyzer – Structural Framing Cross Section Analysis
- RoomEditorApp – Revit add-in part of cloud-based, real-time, round-trip, 2D Revit model editor
- ExportCncFab – Revit Add-In to export Revit wall parts to DXF or SAT for CNC fabrication
- the_building_coder_samples – The Building Coder Samples
- Ppt2txt – PowerPoint Slide Deck Text Extractor
- TestIdlingUnsubscribe – Revit add-in to test unsubscribing from the Idling event.
- EstoreFile – Revit Add-in storing a file in extensible storage.
- UserMepCalculation – Revit MEP Calculation External Service Sample
- RevitLookup – Interactive Revit BIM database exploration tool to view and navigate element properties and relationships.
- roomedit – CouchDB application for 2D cloud-based room editor
- PostAddinCommand – Test programmatic posting of an external command defined by a custom Revit add-in.
- PlaceInstances – Revit add-in to place family instances at locations read from selected text file.
- MoveDuctJoin – Revit MEP Add-in to Move Duct Join
- DisableMismatchWarning – Disable Processor Architecture Mismatch Warning MSB3270 in Revit Projects
Loading the Building Coder Samples
How do I load The Building Coder samples?
They are loaded by the RvtSamples SDK external application. You first need to set up RvtSamples as usual to load all the standard Revit SDK samples. When that is working, you add the include file BcSamples.txt at the end of RvtSamples.txt as described in loading The Building Coder samples way back in the year 2008.
Worksharing and Add-ins
This is a really important topic.
If your users are using worksharing and worksets, you absolutely must look at Scott Conover's Autodesk University class on Revit add-ins that cooperate with worksharing.
Avoid using ProjectInfo to store data for your add-in, since that element is required by all users!
Place extensible storage on private DataStorage elements to minimize conflicts.
Understand best practice for worksharing and worksets from the product point of view, and ensure your add-in interferes as little as possible!
Dynamic Update of Elements that Mutually Influence each Other
How can I implement relationships where one element influences another in the Revit BIM?
You can use a combination of extensible storage and DMU. Store the element ids of the relationship in estorage. Example: distributing trees along a model curve across a terrain model. Extensible storage stores the required rules and other parameters. The model curve is the parent; each element stores its parent in estorage. On modification, destroy the old instances and create new ones. Store the collection of child element ids in parent estorage. In the add-in options, you can control DMU activity and toggle it on and off to reduce the performance impact. DMU does not allow element creation. Sometimes the DMU updater Execute method needs to subscribe to another follow-up event, e.g. Idling or something, since it cannot commit all required changes in one single transaction.
Availability of a Solid Modeller Inside a Revit Project
How can I define an arbitrary solid shape out of the blue in the project, e.g. a box with a spherical hole?
In Revit 2014, you have to create a family and insert an instance. Look at the FreeFormElement SDK sample. The solid to subtract can be an arbitrary geometry instance. Pump them into the BooleanOperationsUtils class and e.g. its ExecuteBooleanOperation method. The resulting volume is immediately accessible e.g. by querying the toSubtract.Volume property. There are other possibilities as well, e.g. the instance void cut utils.
Intersection Between Elements
On one hand, all the aspects mentioned above regarding Boolean operations between elements apply.
On the other hand, you can also use the pure geometry memory-only BooleanOperationsUtils class ExecuteBooleanOperation method.
Multi-language Shared Parameters
We recently discussed an interesting workaround showing how to implement multi-language shared parameter.
To specify the parameter group, include the appropriate BuiltInParameterGroup PG_ enum value in the call to create the parameter definition.
How can I get more than a million points?
The point cloud itself was expanded from 1 to 20 million points in Revit 2014, but the API is still limited to 1 million.
For the point cloud engines, how can we retrieve the settings, e.g. the view options defining whether scans should be displayed or not?
Access to CSV Files and Internal Data Defining Parameter Value Lookup Tables
In Revit 2014, the CSV file family parameter value lookup tables can be moved from the project space to the family environment and embedded into the family definition. Load it into the family and send the family to a customer in one single file.
How can we programmatically extract this CSV information back out of the family definition?
In family parameters, you can use the lookup function. E.g., look at Pipe fitting > Edit family > Types and properties:
size_lookup( Lookup Table Name, "FOD", Nominal Diameter + 3.2 mm, Nominal Diameter)
- M_Pipe Fitting - Generic
- C:\ProgramData\Autodesk\RVT 2014\Lookup Tables\Pipe\M_Pipe Fitting - Generic.csv
This functionality is usable in any kind of family. It specifies all valid parameter combinations in individual rows.
Family instance > Symbol > Parameters > Conduit Size Lookup > Value filename.csv.
How to access this data from the API?
Look at the value of the 'Lookup Table Name' parameter in the family types and parameters. This name may vary for different families, though.
- Iterate over all family parameters.
- Search for 'size_lookup'.
- Extract the first argument.
- It names a parameter.
- Look up its value.
- It names the CSV file.
When the lookup table is loaded into the family, it may differ from the content of the external CSV file.Where is it if it has been loaded into the family? You import the whole file content into the family. Look at the FamilySizeTableManager documentation in the Revit API help file RevitAPI.chm.
Analysis Visualisation Framework
The Building Coder defines a whole category for the Analysis Visualisation Framework AVF.
The Revit Webcam demonstrates grabbing real-time webcam images and using AVF to display a grey scale animated version on the surface of a building element. Note that it is a pretty old sample with an out-dated implementation of the handling of the Idling event. The more recent RoomEditorApp provides a better example of that aspect, and better still how to replace Idling by an external event.
Edit a Floor
We looked at how to edit a floor profile by creating a new floor based on the existing floor's boundary edges.
How can we access the existing sketch elements?
You can use the temporary transaction hack to delete it and retrieve the sketch elements, then edit those as described by Joe Ye in changing the boundary of floors and slabs.
There is obviously the problem of losing hosted elements.
Another discussion on creating a nonrectangular slab explains the SlabShapeEditor and the SlabShapeEditing SDK sample. It emulates the built-in command to pick supports, accessible by drawing a floor with no slope and picking Shape Editing > Modify Subelements > Add Point > Add Spline > Pick Supports. What we would need in this case, however, is the Edit Boundary command.
Can I add my own navigation options to the preview control?
The only input to the preview control is via the constructor.
You could try to some widgets of your own on top of it via the Windows or .NET API, but how to get them to affect the view is another question.
One input to the constructor is the Revit view, which links to a real view element in the Revit model. You might be able to change its settings via the Revit API, and that might update the preview control also. There is some kind of link between the view in the preview and the original Revit view. One may update the other, and vice versa, it seems.
Access to a Sketch Line in an Extrusion in a Family
How can I determine the area of glass in a window in a family?
If rectangular, take width by height, but for the general case...
For the general case, the glass is represented by its own extrusion or solid. Query that solid for its faces, identify the face in the correct plane, e.g. the front reference plane, and ask it for its area.
Load and Prompt for Placement of Group
The 'My First Revit Add-in' tutorial example shows how to place groups of elements: Lesson 6: Working with Room Geometry. The PlaceGroup method inserts a group. If your group is defined in a separate RVT file, you can open that in the background and use the copy and paste API to bring in its elements into the current project, then group them if needed and place the group using the PlaceGroup method.
Connect Pipe or Conduit to Junction Box
In the UI you can grab a junction box and add connectors to it, nota bene in the project, not the family environment. Produce reproducible sample and we'll take a look.
How to Determine the Area and Volume of a Hole Generated by a Window
Several different approaches, e.g.
- Query the wall for its solid with the window inserted; delete the window; query the solid; subtract the first from the second.
- Query the window for its solid; use the ExtrusionAnalyser to project it onto a plane parallel to the wall.
Programmatically Generate User Input to Revit Commands
How can I programmatically provide input to Revit built-in commands?
The Revit journal file record and stores all user input. You can play back a Revit journal file, but only in its entirety. Another approach to record and playback user input is to use the Windows journal. You can subscribe to the Windows journaling mechanism, record all events that are of interest to you, and play them back. If I want to input the start and end point of a wall, e.g. I may need to convert between Revit and Windows coordinate systems. This is demonstrated by the customised tooltip add-in. The Revit API UIView class provides the coordinates of the view corners in both Revit and Windows coordinate systems, and that enables you to define a transform between the two.
That was that. A successful day!
Now I have to go off and give my presentations here in Gothenburg. Wish me luck!