fren
  Log in   Registration

We are +23 BIM professionals!

Join us>
5 minutes of reading time (937 words)

Macros, plugins and Dynamo, 7 Questions and answers about development in Revit with Abdelhakim

Cover-article

Answers to questions asked to Abdelhakim BENATTIA, Modeling Engineer of Construction Projects, during the webinar on Wednesday March 25 on the topic "Automation of tasks and programming of macros in Revit in C # language".

Many of you attended the webinar whose replay is available here. This is why we transmitted your questions to Abdelhakim BENATTIA, to which he replied in writing. We therefore publish their responses in full.


1. What knowledge do I need to acquire to be able to master macros?

Basics in C # or Python, a good command of Revit in modeling and its API. A good knowledge of the organization of projects as well as workflows, to offer useful programs.


2. Which is better: Make a plug-in or a macro?

It depends on the type of development and the strategy of the company:

  • For small developments: A macro to facilitate sharing and dissemination, within teams.
  • For large developments: Plugin to secure the code, allows you to set up licenses, manage access rights, etc. With a plugin, you just distribute a DLL, the user does not have access to the code source.

Macros are useful for testing because you don't need to close Revit to regenerate the code unlike plugins.


3. What is the big advantage of a macro (C #) over Dynamo (Python)?

  • Possibility to use several languages ​​(C #, Python, vb.net), the SDK examples of Revit are provided in C #.
  • Easier user interface management (Windows form or WPF)
  • Ability to more easily connect Revit API with APIs of other software or platforms
  • Possibility of detecting and managing events that occur in the model (not feasible with Dynamo).
  • Code easier to organize and optimize with classes (personal point of view).
  • More freedom, you don't depend on what others have done in their knots and you're never stuck by a knot you miss.
  • Sharpdevelopp and Visual Studio make it easy to code with the IntelliSense which is absent in Dynamo, coding your own nodes directly in Dynamo is hell.
  • Dynamo's strong point is being able to generate complex geometric shapes using mathematical formulas. Dynamo is great for beginners and for those who don't like to code.

Be careful to only use nodes of which you are sure of the origin or which you have checked line by line. An unofficial node found on the internet may constitute a Trojan horse. It only takes a well-hidden line of code from a hacker to send a virus to your system.


4. English or French that is not a problem? 

If the Revit installed on your computer is an FR version, you have to juggle between the two, sometimes you have to use English and sometimes French in your functions, it depends on the functions.

Basics in English are necessary to dig a little in the forums. You can't always find what you want in French, and the Autodesk examples are in English.


5. Can we work directly on families (.rfa) with macros?

Yes feasible to modify or add data to families. we have already done that.
Selection of families thanks to filters, opening each family, data injection from an Excel file or other. Starting a save and reloading in the library.

The modification of the geometries (extrusion, revolution, ect…) on the other hand seems to me more complicated. But if they are parametric families, by modifying the instance or type parameters via the API, the geometries will follow.


6. Is a macro valid for all versions of Revit or do they need to be adapted?

By migrating an RVT document from one version to another, the macros they carry are converted as well.

You have to make macros on an old Revit version, then migrate them to several previous versions to be able to use them, as for families and project templates.

Does the macro to check for duplicates also work for system families? (Duplicate ducts, pipes, etc.), because normally Revit does not find these types of duplicates with warnings.

The functions shown during these webinars were only used to show what we could do, to deal with duplicate system families we use other functions based on geometry and connector analysis, it would have been complicated to tackle everything that in 20 min.

With a Macro, what is the method for splitting system families (for example splitting pipes and ducts crossing slabs)?


The fastest and easiest:

  • MechanicalUtils.BreakCurve (doc, duct.Id, point) for ducts.
  • PlumbingUtils.BreakCurve (doc, pipe.Id, point); for pipes

Example below to split in the middle. To split at ground level, it is necessary to calculate the point of intersection between the line of the element and the upper and lower faces of the ground in clash with the element.


7. Can we ask REVIT to output the quantities directly with a macro?

Yes, we can control Excel from a Revit macro, the interest is to be able to filter and group the elements and process the data thanks to analyzes and calculations before extracting them into personalized tables that cannot be obtained directly with the nomenclatures Revit. We can even extract quantities to databases (Access, SQL, ect ..)

Example: detailed glass surface analysis for HVAC service using a small macro


  A question ? Do not hesitate to ask it in comment!


1

On the same subject:

 

comments (0)

No comments yet, be the first to comment!

add a comment

  1. (Guest mode)
Attachments (0 / 5)
Share your location
Type the text shown in the image below. Not clear?

By accepting you will be accessing a service provided by a third-party external to https://www.hexabim.com/

Discover our services

recruitment

Your career at N&Co

LEARN MORE

communication

Communication

LEARN MORE

Advertising

Training

LEARN MORE

Hexabim

Log in