One of the most common uses of macros is automating the placement of equipment and piping.
Cause: E3D processes commands faster than the graphics kernel can update. Fix: Insert a small delay:
PAUSE 0.5 -- Wait half a second
In high-hazard process industries, quantitative risk assessment (QRA) requires the analysis of thousands of potential release scenarios. The E3D software suite is a standard tool for modeling the dispersion, explosion, and thermal radiation consequences of these scenarios. This paper outlines the functionality of "Macros" within E3D, describing how they are used to automate complex modeling tasks, iterate over variable parameters, and streamline the generation of consequence results.
1. Always use FINISH or CLOSE
If you leave an element "open" (like NEW STYP without FINISH), your macro will crash the next time you try to create that element type. Every NEW should have a matching FINISH.
2. Avoid Pauses
Do not use PAUS in a macro unless absolutely necessary. It kills automation. Use PROMPT instead to ask for input before the macro runs.
3. The "Dry Run" Rule
Before running a macro that modifies 500 members, add Q LIST temporarily to your macro. This just lists what would happen without actually changing the database. aveva e3d macros
4. Organize with $ (Comments)
Use $ at the start of a line to leave a comment. Six months from now, you won't remember why you set an offset to 0.025. Comment it: $ Convert 25mm to meters for cladding offset
Scenario: An EPC firm needed to model 450 identical pipe racks across a refinery. Each rack had 20 handrails, 15 grating panels, and 8 vertical supports.
Manual time per rack: 45 minutes. Total manual: 337.5 hours.
Solution:
A senior designer wrote a parameterized macro (rack.mac) that accepted:
The macro contained logic to:
Result:
Subject: Utilization of Automation and Macros within the E3D (Environmental, Explosion and Dispersion) Modeling Suite. Audience: Safety Engineers, Risk Analysts, and E3D Users.
Hard-coded values aren't very useful. You want one macro to do many things. Use ARG values (passed from the command line) or PROMPT for user input.
Example: create_beam.mac
-- Macro expects: MACRO create_beam 5000 2000 Z DEFINE LENGTH 'ARGV[1]' DEFINE OFFSET 'ARGV[2]' DEFINE ORIENT 'ARGV[3]'
NEW BEAM SPREF "IPE-300" IF (#ORIENT.EQ."X') THEN ORI X ELSE IF (#ORIENT.EQ."Z') THEN ORI Z ENDIF XLEN #LENGTH POS E #OFFSET N 0 U 1000 CREATEOne of the most common uses of macros
Command: MACRO create_beam 6000 1500 X
This creates a 6m long IPE beam, offset 1.5m in Easting, oriented along the X-axis. No typing errors. No wrong specs.
A hardcoded macro is useful. A parameterized macro is a tool.
Instead of writing "HEIGHT 8000", you want to ask the user or read a variable. The macro contained logic to: