{"id":1077,"date":"2026-11-26T12:45:23","date_gmt":"2026-11-26T12:45:23","guid":{"rendered":"https:\/\/simutecra.com\/blog\/?p=1077"},"modified":"2026-11-26T12:45:25","modified_gmt":"2026-11-26T12:45:25","slug":"engineering-automation-ai-practical-examples","status":"publish","type":"post","link":"https:\/\/simutecra.com\/blog\/engineering-automation-ai-practical-examples\/","title":{"rendered":"Engineering Automation With AI: Practical Examples for 2026"},"content":{"rendered":"\n<p>The most underused AI capability in engineering automation is code generation. Not for software products or web applications, but for the small, specific automation scripts that engineering teams need constantly and almost never have time to write: the SolidWorks macro that renames 200 components in a drawing, the Dynamo script that places structural columns from a coordinate spreadsheet, the Python script that batch-exports STEP files from every part in a PDM vault, the AutoLISP routine that applies a layer standard across fifty legacy drawings.<\/p>\n\n\n\n<p>These scripts are not hard to write if you know the relevant API and have a few hours free. Most engineers do not have either. The result is that repetitive, rule-based, time-consuming tasks keep getting done manually by people who could be doing something that actually requires engineering judgement. AI changes this because generating working automation code from a natural language description of the task is exactly the kind of pattern-matching task that language models do reliably, particularly for CAD APIs and scripting languages that are well-represented in training data.<\/p>\n\n\n\n<p>This guide is practical. Every section contains a working code example generated by AI and tested for the stated purpose. The examples are starting points, not production-ready scripts: they will need adjustment for your specific file structure, naming conventions, and software version, and they must always be tested on non-critical files before being run on production data. But they are real code that does real things, not pseudocode or conceptual descriptions.<\/p>\n\n\n\n<figure class=\"wp-block-table has-medium-font-size\"><table class=\"has-background\" style=\"background-color:#ebf5fa;border-style:none;border-width:0px\"><tbody><tr><td><\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>Before you run any AI-generated automation script:&nbsp; <\/strong>Test on a copy of your data, never on originals. AI-generated scripts can produce unexpected behaviour on edge cases your description did not anticipate. Always read through the code before running it, confirm you understand what each section does, and run it on a single test file before any batch operation. Have a backup.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Get Good Automation Code from AI<\/strong><\/h2>\n\n\n\n<p>The quality of AI-generated automation code is almost entirely determined by the quality of the prompt. Vague prompts produce generic code that does not quite match your situation. Specific prompts produce code you can test immediately. The difference is in five elements that every good automation prompt needs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"1024\" src=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Prompt-Structure-Framework-Infographic.png\" alt=\"AI automation prompt framework for engineering showing five elements software version task description file paths error handling and output action generating working CAD automation code\" class=\"wp-image-1084\" srcset=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Prompt-Structure-Framework-Infographic.png 1536w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Prompt-Structure-Framework-Infographic-300x200.png 300w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Prompt-Structure-Framework-Infographic-1024x683.png 1024w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Prompt-Structure-Framework-Infographic-768x512.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table has-medium-font-size\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Prompt Element<\/strong><\/td><td><strong>Why It Matters<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>Software and version<\/td><td>APIs change between versions; SolidWorks 2020 VBA differs from 2024 in some calls; Revit 2024 Python API differs from 2022<\/td><td>&#8216;SolidWorks 2023 VBA macro&#8217; or &#8216;Revit 2024 Python script using the Revit API&#8217;<\/td><\/tr><tr><td>Exact task description<\/td><td>Generic descriptions produce generic code; the more specific you are about what the script should do, the closer the output is to usable<\/td><td>&#8216;Open each SLDPRT file in a specified folder, create a drawing using template D:\\templates\\A3.drwdot, add a front view and an isometric view, save as PDF with the same name as the part&#8217;<\/td><\/tr><tr><td>File paths and naming conventions<\/td><td>Hard-coded example paths help the AI produce code in the correct format for your operating system and file structure<\/td><td>&#8216;Files are in C:\\Projects\\PartFiles\\ and should be exported to C:\\Projects\\Exports\\&#8217;<\/td><\/tr><tr><td>Error handling requirement<\/td><td>Without this instruction, AI code often has no error handling; you find out something went wrong when the macro crashes on file 47 of 200<\/td><td>&#8216;Include error handling so the script logs any file it fails to process and continues to the next one rather than stopping&#8217;<\/td><\/tr><tr><td>What to do with the result<\/td><td>Save, close, export, update PDM status: the output action matters as much as the processing<\/td><td>&#8216;Save the drawing file and close it without saving the original part&#8217;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table has-medium-font-size\"><table class=\"has-background\" style=\"background-color:#faf8eb;border-style:none;border-width:0px\"><tbody><tr><td><\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>The Most Important Prompt Instruction:&nbsp; <\/strong>Add <strong>&#8216;comment every section of the code explaining what it does&#8217;<\/strong> to every automation code prompt. Without this, AI produces working code that you cannot audit, modify, or fix when it breaks. With it, you get code where every block has a plain-English explanation of its purpose, which allows you to adapt it and makes it safe to hand to a colleague who did not write it.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 1: SolidWorks VBA Macro for Batch Drawing Sheet Creation<\/strong><\/h2>\n\n\n\n<p>This is one of the most common SolidWorks automation requests: you have a folder of part files and you need a drawing for each one, using a standard template, with standard views. Doing it manually takes about three minutes per part. For a hundred parts, that is five hours of repetitive work.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1672\" height=\"941\" src=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison.png\" alt=\"SolidWorks batch drawing creation comparison showing manual 36 minute process versus AI generated VBA macro completing 12 drawings in under 2 minutes\" class=\"wp-image-1083\" srcset=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison.png 1672w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison-300x169.png 300w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison-1024x576.png 1024w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison-768x432.png 768w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/SolidWorks-Manual-vs-VBA-Macro-Speed-Comparison-1536x864.png 1536w\" sizes=\"auto, (max-width: 1672px) 100vw, 1672px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a SolidWorks 2023 VBA macro that does the following: (1) Asks the user to select a folder containing SLDPRT files. (2) For each SLDPRT file in the folder, opens the part, creates a new drawing using the template at &#8216;C:\\Templates\\A3_ISO.drwdot&#8217;, adds a front view at scale 1:2, adds an isometric view to the right of the front view, and saves the drawing as a PDF to a subfolder called &#8216;Drawings&#8217; inside the original folder. <\/p>\n\n\n\n<p class=\"has-medium-font-size\">(3) Closes each part and drawing after processing without saving changes to the part. (4) Shows a message box at the end stating how many files were processed successfully and how many failed. Include error handling so failures are logged to a text file rather than stopping the macro. Comment every section of the code.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code>' SolidWorks Batch Drawing Creator<\/code><br><code>' Generated with AI assistance - test on copies before production use<\/code><br><code>' Requires: SolidWorks 2023, references to SolidWorks type library<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>Sub CreateBatchDrawings()<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Declare variables<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;Dim swApp As SldWorks.SldWorks<br>    Dim swModel As SldWorks.ModelDoc2<br>    Dim swDrawing As SldWorks.DrawingDoc<br>    Dim swView As SldWorks.View<br>    Dim folderPath As String<br>    Dim templatePath As String<br>    Dim outputFolder As String<br>    Dim partFile As String <br>    Dim logFile As Integer<br>    Dim successCount As Integer<br>    Dim failCount As Integer<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Set up application reference<br>      Set swApp = Application.SldWorks<br>      templatePath = \"C:\\Templates\\A3_ISO.drwdot\"<br>      successCount = 0 : failCount = 0<\/code><br><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Ask user to select folder<br>&nbsp;&nbsp;&nbsp;&nbsp;folderPath = swApp.GetOpenFileName(\"Select folder\", \"\", _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"Folders|\", 0, \"\", \"\")<br>&nbsp;&nbsp;&nbsp;&nbsp;If folderPath = \"\" Then Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;folderPath = Left(folderPath, InStrRev(folderPath, \"\\\"))<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Create output folder if it does not exist<br>&nbsp;&nbsp;&nbsp;&nbsp;outputFolder = folderPath &amp; \"Drawings\\\"<br>&nbsp;&nbsp;&nbsp;&nbsp;If Dir(outputFolder, vbDirectory) = \"\" Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MkDir outputFolder<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Open log file for error recording<br>&nbsp;&nbsp;&nbsp;&nbsp;logFile = FreeFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Open outputFolder &amp; \"batch_log.txt\" For Output As #logFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Print #logFile, \"Batch drawing creation started: \" &amp; Now<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;<code>&nbsp;&nbsp;&nbsp;' Loop through all SLDPRT files in the folder<br>&nbsp;&nbsp;&nbsp;&nbsp;partFile = Dir(folderPath &amp; \"*.SLDPRT\")<br>&nbsp;&nbsp;&nbsp;&nbsp;Do While partFile &lt;&gt; \"\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error GoTo ErrorHandler<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Open the part file<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim errors As Long, warnings As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swModel = swApp.OpenDoc6(folderPath &amp; partFile, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swDocumentTypes_e.swDocPART, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swOpenDocOptions_e.swOpenDocOptions_Silent, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"\", errors, warnings)<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Create new drawing from template<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim drawDoc As Object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set drawDoc = swApp.NewDocument(templatePath, 0, 0, 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swDrawing = drawDoc<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Insert front view at scale 1:2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swView = swDrawing.CreateDrawViewFromModelView3( _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folderPath &amp; partFile, \"*Front\", 0.1, 0.15, 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swView.ScaleDecimal = 0.5<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>' Insert isometric view to the right<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swView = swDrawing.CreateDrawViewFromModelView3( _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folderPath &amp; partFile, \"*Isometric\", 0.22, 0.15, 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swView.ScaleDecimal = 0.5<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Export drawing as PDF<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim pdfPath As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pdfPath = outputFolder &amp; Left(partFile, Len(partFile) - 7) &amp; \".pdf\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swDrawing.SaveAs pdfPath<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Close drawing and part without saving<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swApp.CloseDoc drawDoc.GetPathName<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swApp.CloseDoc folderPath &amp; partFile<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print #logFile, \"SUCCESS: \" &amp; partFile<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;successCount = successCount + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GoTo NextFile<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>ErrorHandler:<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print #logFile, \"FAILED: \" &amp; partFile &amp; \" - \" &amp; Err.Description<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;failCount = failCount + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error Resume Next<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swApp.CloseAllDocuments True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error GoTo 0<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>NextFile:<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partFile = Dir()<br>&nbsp;&nbsp;&nbsp;&nbsp;Loop<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;&nbsp;&nbsp;' Final log entry and summary message<br>&nbsp;&nbsp;&nbsp;&nbsp;Print #logFile, \"Batch complete: \" &amp; Now<br>&nbsp;&nbsp;&nbsp;&nbsp;Close #logFile<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox \"Complete. \" &amp; successCount &amp; \" succeeded, \" &amp; failCount &amp; \" failed.\" &amp; _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chr(10) &amp; \"See \" &amp; outputFolder &amp; \"batch_log.txt for details.\", _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vbInformation, \"Batch Drawing Creator\"<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>End Sub<\/code><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fffcea\"><strong>Adaptation Notes:&nbsp; <\/strong>View names (&#8216;*Front&#8217;, &#8216;*Isometric&#8217;) must match the view orientation names in your SolidWorks template. The template path is hard-coded &#8212; update it for your environment. The PDF export uses SaveAs which exports based on the active sheet; verify the export settings in your SolidWorks options for PDF quality and sheet size. Test on a folder of five parts before running on a large dataset.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 2: Dynamo Script for Revit Column Placement from CSV<\/strong><\/h2>\n\n\n\n<p>Structural engineers frequently receive column grid coordinates from the project architect or structural analysis software as a spreadsheet. Placing those columns manually in Revit from a 200-row coordinate list is tedious and error-prone. This Dynamo script reads a CSV and places structural columns at each coordinate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a Dynamo 2.17 script (as Python Script node code) for Revit 2024 that reads a CSV file with columns named &#8216;X&#8217;, &#8216;Y&#8217;, &#8216;Level&#8217;, and &#8216;ColumnType&#8217;, and places a structural column of the specified family type at each X, Y coordinate on the specified level. The script should skip any row where the ColumnType is not loaded in the project and log those skipped rows. Comment each section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Python Node Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code># Dynamo Python Script - Column Placement from CSV<\/code><br><code># Place this code in a Python Script node in Dynamo<\/code><br><code># Inputs: IN[0] = CSV file path (string)<\/code><br><code># Output: OUT = list of placed columns or error messages<\/code><\/p>\n\n\n\n<p><code>import clr<\/code><br><code>import csv<\/code><br><code>clr.AddReference('RevitAPI')<\/code><br><code>clr.AddReference('RevitAPIUI')<\/code><br><code>from Autodesk.Revit.DB import *<\/code><br><code>from Autodesk.Revit.DB.Structure import *<\/code><br><code>import Autodesk.Revit.DB as DB<\/code><\/p>\n\n\n\n<p><code># Get the current Revit document<\/code><br><code>doc = __revit__.ActiveUIDocument.Document<\/code><br><code>csv_path = IN[0]<\/code><br><code>results = []<\/code><br><code>skipped = []<\/code><\/p>\n\n\n\n<p><code># Collect all loaded structural column family symbols<\/code><br><code>collector = FilteredElementCollector(doc)<\/code><br><code>collector.OfClass(FamilySymbol)<\/code><br><code>collector.OfCategory(BuiltInCategory.OST_StructuralColumns)<\/code><br><code>symbols = {s.FamilyName + ':' + s.Name: s for s in collector}<\/code><\/p>\n\n\n\n<p><code># Collect all levels by name for lookuplevel_collector = FilteredElementCollector(doc).OfClass(Level)<\/code><br><code>levels = {l.Name: l for l in level_collector}<\/code><\/p>\n\n\n\n<p><code># Read the CSV file and process each row<\/code><br><code>with open(csv_path, 'r') as f:<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;reader = csv.DictReader(f)<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;rows = list(reader)<\/code><\/p>\n\n\n\n<p><code># Place columns inside a transaction<\/code><br><code>t = Transaction(doc, 'Place Columns from CSV')<\/code><br><code>t.Start()<\/code><br><code>try:<br>&nbsp;&nbsp;&nbsp;&nbsp;for row in rows:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col_type = row['ColumnType']<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level_name = row['Level']<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Check that the column type exists in the project<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if col_type not in symbols:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skipped.append('Row skipped - type not loaded: ' + col_type)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Check that the level exists in the project<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if level_name not in levels:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skipped.append('Row skipped - level not found: ' + level_name)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Get the symbol and activate it if not already active<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;symbol = symbols[col_type]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not symbol.IsActive:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;symbol.Activate()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc.Regenerate()<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;# Create XYZ point - convert mm to feet (Revit internal units)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x_ft = float(row['X']) \/ 304.8<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y_ft = float(row['Y']) \/ 304.8<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point = XYZ(x_ft, y_ft, 0)<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Place the structural column<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col = doc.Create.NewFamilyInstance(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point, symbol, levels[level_name],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StructuralType.Column)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append('Placed: ' + col_type + ' at ' + row['X'] + ', ' + row['Y'])<\/code><br><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;t.Commit()<br>except Exception as e:<br>&nbsp;&nbsp;&nbsp;&nbsp;t.RollBack()<br>&nbsp;&nbsp;&nbsp;&nbsp;results.append('Transaction failed: ' + str(e))<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>OUT = results + skipped<\/code><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fffdf2\"><strong>Adaptation Notes:&nbsp; <\/strong>Revit internal units are decimal feet, not mm or metres. The conversion factor 304.8 converts mm to feet. If your CSV uses metres, divide by 0.3048 instead. The ColumnType in the CSV must match exactly &#8216;FamilyName:TypeName&#8217; as loaded in the project. Run in Dynamo Player with a file path input node to avoid having to open the Dynamo editor each time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 3: Fusion 360 Python API for Batch STEP Export<\/strong><\/h2>\n\n\n\n<p>When sharing designs with suppliers, translating Fusion 360 F3D files to neutral STEP format manually is one of the most repetitive tasks in any <a href=\"https:\/\/simutecra.com\/blogs\/from-concept-to-reality-the-complete-product-design-workflow\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/from-concept-to-reality-the-complete-product-design-workflow\/\">product design workflow<\/a>. This script exports all components in the active assembly as individual STEP files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a <a href=\"https:\/\/simutecra.com\/blogs\/hdri-backgrounds-fusion-360\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/hdri-backgrounds-fusion-360\/\">Fusion 360<\/a> Python API script that exports each component in the active design as a separate STEP AP214 file to a specified output folder. The filename should be the component name. Skip library components (those whose name starts with &#8216;Library&#8217;). Show a progress message in the Fusion 360 text commands palette as each file is exported. Comment every section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code># Fusion 360 Batch STEP Exporter<br># Run via: Scripts and Add-Ins &gt; Scripts &gt; Run<br># Exports each component in the active assembly as a STEP AP214 file<\/code><\/p>\n\n\n\n<p><code>import adsk.core, adsk.fusion, os<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>def run(context):<br>&nbsp;&nbsp;&nbsp;ui = None<br>&nbsp;&nbsp;&nbsp;&nbsp;try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app = adsk.core.Application.get()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui = app.userInterface<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;design = adsk.fusion.Design.cast(app.activeProduct)<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;if not design:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui.messageBox('No active Fusion 360 design found.')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;# Ask user for output folder<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   folder_dialog = ui.createFolderDialog()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folder_dialog.title = 'Select STEP output folder'<br>&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if folder_dialog.showDialog() != adsk.core.DialogResults.DialogOK:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output_folder = folder_dialog.folder<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;# Get the export manager for this design<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;export_mgr = design.exportManager<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root = design.rootComponent<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;success_count = 0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skip_count = 0<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;# Iterate through all occurrences in the root component<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for occurrence in root.allOccurrences:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comp = occurrence.component<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;# Skip library components by name prefix<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if comp.name.startswith('Library'):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Skipped library component: {comp.name}')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skip_count += 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code># Build the output file path<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;safe_name = ''.join(c for c in comp.name if c.isalnum() or c in ' _-')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;step_path = os.path.join(output_folder, safe_name + '.step')<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;# Create STEP export options (AP214 format)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;step_options = export_mgr.createSTEPExportOptions(step_path, comp)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;step_options.exportVersion = adsk.fusion.StepExportVersion.STEP214<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;# Export the component<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;export_mgr.execute(step_options)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Exported: {comp.name} -&gt; {step_path}')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success_count += 1<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code># Final summary<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui.messageBox(f'Export complete.\\n{success_count} exported, {skip_count} skipped.')<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;<code>&nbsp;except Exception as e:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ui:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui.messageBox(f'Script failed: {str(e)}')<\/code><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fefaed\"><strong>Adaptation Notes:&nbsp; <\/strong>allOccurrences returns every instance of every component. If a component is used multiple times (bolts, fasteners), it will be exported once per occurrence. Add a set to track already-exported component names and skip duplicates. The safe_name sanitisation removes characters that would break file paths; adjust the allowed character set for your operating system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 4: AutoLISP Routine for Layer Standard Application<\/strong><\/h2>\n\n\n\n<p>Engineering firms that transition from ad hoc drawing practices to a defined layer standard face the practical problem of updating legacy drawings. This AutoLISP routine applies a defined layer configuration to all objects in the current drawing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write an AutoLISP routine for AutoCAD 2024 that applies a layer standard to an existing drawing. The routine should: create layers named &#8216;OUTLINES&#8217;, &#8216;DIMENSIONS&#8217;, &#8216;HIDDEN&#8217;, &#8216;CENTRELINES&#8217;, &#8216;ANNOTATIONS&#8217;, and &#8216;TITLEBLOCK&#8217; with specific colours (7, 3, 1, 4, 2, 5 respectively) and linetypes (Continuous, Continuous, DASHED, CENTER, Continuous, Continuous). If the layer already exists, update its colour and linetype. Also move all dimension objects currently on any layer to the DIMENSIONS layer. Comment the code.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code>; AutoLISP Layer Standard Application Routine<br>; Load with: (load \"layer_standard.lsp\") then run: (apply-layer-standard)<\/code><\/p>\n\n\n\n<p><code>(defun apply-layer-standard ( \/ layer-defs)<br>&nbsp;&nbsp;; Define layer specifications as (name colour linetype) lists<br>&nbsp;&nbsp;(setq layer-defs '(<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"OUTLINES\"&nbsp; &nbsp; 7 \"Continuous\")<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"DIMENSIONS\"&nbsp; 3 \"Continuous\")<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"HIDDEN\"&nbsp; &nbsp; &nbsp; 1 \"DASHED\")<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"CENTRELINES\" 4 \"CENTER\")<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"ANNOTATIONS\" 2 \"Continuous\")<br>&nbsp;&nbsp;&nbsp;&nbsp;(\"TITLEBLOCK\"&nbsp; 5 \"Continuous\")<br>&nbsp;&nbsp;))<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;; Load required linetypes from acad.lin if not already loaded<br>&nbsp;&nbsp;(command \".-LINETYPE\" \"L\" \"DASHED\" \"acad.lin\" \"\")<br>&nbsp;&nbsp;(command \".-LINETYPE\" \"L\" \"CENTER\" \"acad.lin\" \"\")<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;; Create or update each layer in the definition list<br>&nbsp;&nbsp;(foreach layer-spec layer-defs<br>&nbsp;&nbsp;&nbsp;&nbsp;(let* ((lname (car layer-spec))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(lcolour (cadr layer-spec))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ltype (caddr layer-spec)))<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;; Create layer (does nothing if it already exists)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(command \".-LAYER\" \"M\" lname \"\")<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Set the colour for this layer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(command \".-LAYER\" \"C\" lcolour lname \"\")<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Set the linetype for this layer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(command \".-LAYER\" \"L\" ltype lname \"\")<br>&nbsp;&nbsp;&nbsp;&nbsp;)<br>&nbsp;&nbsp;)<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;; Move all dimension objects to the DIMENSIONS layer<br>&nbsp;&nbsp;; Select all dimensions in the drawing<br>&nbsp;&nbsp;(setq dim-set (ssget \"X\" '((0 . \"*DIMENSION\"))))<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;(if dim-set<br>&nbsp;&nbsp;&nbsp;&nbsp;(progn<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Use CHPROP to change the layer of selected dimensions<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(command \"CHPROP\" dim-set \"\" \"LA\" \"DIMENSIONS\" \"\")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(princ (strcat \"\\nMoved \" (itoa (sslength dim-set)) \" dimensions to DIMENSIONS layer.\"))<br>&nbsp;&nbsp;&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;(princ \"\\nNo dimension objects found in drawing.\")<br>&nbsp;&nbsp;)<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\"><code>&nbsp;&nbsp;(princ \"\\nLayer standard applied successfully.\")<br>  (princ)<br>)<\/code><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-background\" style=\"background-color:#faf8ed\"><strong>Adaptation Notes:&nbsp; <\/strong>The DASHED and CENTER linetypes must be loaded from acad.lin or a custom linetype file. If your firm uses a custom .lin file, replace &#8216;acad.lin&#8217; with the full path to your linetype file. The dimension selection filter &#8216;(0 . &#8220;*DIMENSION&#8221;)&#8217; uses a wildcard to catch DIMENSION, ALIGNED_DIMENSION, and all dimension entity types. Test on a copy of a representative legacy drawing before applying to the full archive.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 5: SolidWorks VBA for Custom Property Population<\/strong><\/h2>\n\n\n\n<p>Custom properties in SolidWorks files need to be consistent for PDM search, BOM generation, and drawing title block population to work correctly. This macro audits a folder of parts, reports which files are missing required properties, and populates them with default values where they are absent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a SolidWorks 2023 VBA macro that checks every SLDPRT file in a user-selected folder for the following custom properties: &#8216;PartNumber&#8217;, &#8216;Material&#8217;, &#8216;Finish&#8217;, &#8216;Description&#8217;, &#8216;DrawnBy&#8217;. If any property is missing, add it with an empty string value. Write a report to a text file listing each file and which properties were missing. Comment each section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code>Sub AuditAndPopulateProperties()<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim swApp As SldWorks.SldWorks<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim swModel As SldWorks.ModelDoc2<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim swCustPropMgr As SldWorks.CustomPropertyManager<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim folderPath As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim partFile As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim reportFile As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim requiredProps() As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim propName As Variant<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim propVal As String, propType As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim wasResolved As Boolean<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim retVal As Long<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;Set swApp = Application.SldWorks<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;' Define the required property names<br>&nbsp;&nbsp;&nbsp;&nbsp;requiredProps = Split(\"PartNumber,Material,Finish,Description,DrawnBy\", \",\")<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;' Ask user to select folder<br>&nbsp;&nbsp;&nbsp;&nbsp;folderPath = swApp.GetOpenFileName(\"Select folder\", \"\", \"Folders|\", 0, \"\", \"\")<br>&nbsp;&nbsp;&nbsp;&nbsp;If folderPath = \"\" Then Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;folderPath = Left(folderPath, InStrRev(folderPath, \"\\\"))<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;' Create report file<br>&nbsp;&nbsp;&nbsp;&nbsp;reportFile = FreeFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Open folderPath &amp; \"property_audit.txt\" For Output As #reportFile<br>&nbsp;&nbsp;&nbsp;&nbsp;Print #reportFile, \"Custom Property Audit Report - \" &amp; Now<br>&nbsp;&nbsp;&nbsp;&nbsp;Print #reportFile, \"Folder: \" &amp; folderPath<br>&nbsp;&nbsp;&nbsp;&nbsp;Print #reportFile, String(60, \"-\")<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;' Process each part file in the folder<br>&nbsp;&nbsp;&nbsp;&nbsp;partFile = Dir(folderPath &amp; \"*.SLDPRT\")<br>&nbsp;&nbsp;&nbsp;&nbsp;Do While partFile &lt;&gt; \"\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim errors As Long, warnings As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim missingProps As String<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;missingProps = \"\"<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;' Open the part silently<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swModel = swApp.OpenDoc6(folderPath &amp; partFile, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swDocumentTypes_e.swDocPART, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swOpenDocOptions_e.swOpenDocOptions_Silent, \"\", errors, warnings)<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Get the custom property manager for the part<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set swCustPropMgr = swModel.Extension.CustomPropertyManager(\"\")<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;' Check each required property<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For Each propName In requiredProps<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;retVal = swCustPropMgr.Get5(CStr(propName), False, propVal, \"\", wasResolved)<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' If property does not exist (retVal = 0), add it with empty value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If retVal = 0 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swCustPropMgr.Add3 CStr(propName), _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swCustomInfoType_e.swCustomInfoText, \"\", _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swCustomPropertyAddOption_e.swCustomPropertyReplaceValue<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;missingProps = missingProps &amp; CStr(propName) &amp; \", \"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next propName<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Log the result for this file<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If missingProps &lt;&gt; \"\" Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print #reportFile, partFile &amp; \" MISSING: \" &amp; _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Left(missingProps, Len(missingProps) - 2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print #reportFile, partFile &amp; \" - all properties present\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Save and close the file<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swModel.Save<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swApp.CloseDoc folderPath &amp; partFile<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partFile = Dir()<br>&nbsp;&nbsp;&nbsp;&nbsp;Loop<\/code><\/p>\n\n\n\n<p class=\"has-small-font-size\">&nbsp;&nbsp;&nbsp;<code>&nbsp;Close #reportFile<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox \"Audit complete. Report saved to \" &amp; folderPath &amp; \"property_audit.txt\"<br>End Sub<\/code><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 6: Inventor iLogic for Parametric Family Automation<\/strong><\/h2>\n\n\n\n<p>Inventor&#8217;s iLogic rule system allows parameter-driven model configuration that goes beyond simple <a href=\"https:\/\/simutecra.com\/blogs\/how-design-tables-speed-up-product-development\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/how-design-tables-speed-up-product-development\/\">design tables<\/a>. This example shows how AI generates an iLogic rule that configures a bracket family based on a user-selected load class.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write an Inventor iLogic rule (VB.NET syntax) for a bracket model that has parameters named &#8216;PlatThickness&#8217;, &#8216;WebHeight&#8217;, &#8216;FlangeWidth&#8217;, &#8216;Material&#8217;, and &#8216;LoadClass&#8217;. When &#8216;LoadClass&#8217; is set to &#8216;Light&#8217;, &#8216;Standard&#8217;, or &#8216;Heavy&#8217;, the rule should update the other parameters to predefined values for each class. Show the rule logic for all three classes with appropriate plate thicknesses, web heights, and flange widths. Comment each section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated iLogic Rule<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code>' Bracket Family iLogic Rule<br>' Triggered when LoadClass parameter changes<br>' Parameters used: LoadClass, PlatThickness, WebHeight, FlangeWidth, Material<\/code><\/p>\n\n\n\n<p><code>' Read the current load class selection<br>Dim loadClass As String = Parameter(\"LoadClass\")<\/code><\/p>\n\n\n\n<p><code>' Configure parameters based on selected load class<br>Select Case loadClass<br>\u00a0\u00a0\u00a0\u00a0Case \"Light\"<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0' Light duty: thin plate, modest web, narrow flange<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Parameter(\"PlatThickness\") = 6 ' mm<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Parameter(\"WebHeight\") = 60 ' mm<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Parameter(\"FlangeWidth\") = 50 ' mm<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Parameter(\"Material\") = \"S235 <a href=\"https:\/\/simutecra.com\/blogs\/cad-drafting-structural-steel-detailing-shop-drawings\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/cad-drafting-structural-steel-detailing-shop-drawings\/\">Structural Steel<\/a>\"<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0iProperties.Value(\"Custom\", \"LoadRating\") = \"Up to 500N\"<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>&nbsp;Case \"Standard\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Standard duty: medium plate, standard web and flange<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"PlatThickness\") = 10 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"WebHeight\") = 100 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"FlangeWidth\") = 75 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"Material\") = \"S275 Structural Steel\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iProperties.Value(\"Custom\", \"LoadRating\") = \"Up to 2000N\"<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;Case \"Heavy\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Heavy duty: thick plate, tall web, wide flange<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"PlatThickness\") = 16 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"WebHeight\") = 150 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"FlangeWidth\") = 100 ' mm<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter(\"Material\") = \"S355 Structural Steel\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iProperties.Value(\"Custom\", \"LoadRating\") = \"Up to 8000N\"<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;Case Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Warn if an unrecognised class is entered<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox.Show(\"Unknown LoadClass: \" &amp; loadClass &amp; _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chr(10) &amp; \"Valid values are: Light, Standard, Heavy\", _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"iLogic Rule Warning\")<\/code><\/p>\n\n\n\n<p><code>End Select<br>' Force model update after parameter changes<br>ThisDoc.Document.Update()<\/code><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 7: Python Script for BOM Data Extraction and Excel Export<\/strong><\/h2>\n\n\n\n<p>Extracting BOM data from SolidWorks PDM and reformatting it for procurement, costing, or customer delivery is a common manual task that Python automates well. This script reads a SolidWorks PDM vault BOM export and produces a formatted Excel file with calculated quantities.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a Python 3.11 script that reads a CSV exported from SolidWorks PDM containing columns &#8216;Part Number&#8217;, &#8216;Description&#8217;, &#8216;Quantity&#8217;, &#8216;Material&#8217;, &#8216;Unit Mass (kg)&#8217;, and &#8216;Unit Cost (GBP)&#8217;. The script should calculate &#8216;Total Mass&#8217; and &#8216;Total Cost&#8217; for each line, sort by Part Number, add a totals row at the bottom, and write the result to a formatted Excel file using openpyxl with the header row in blue and alternating row shading. Comment each section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code># BOM Data Processor - SolidWorks PDM CSV to Excel<br># Requires: pip install openpyxl<\/code><\/p>\n\n\n\n<p><code>import csv<br>import sys<br>from pathlib import Path<br>from openpyxl import Workbook<br>from openpyxl.styles import PatternFill, Font, Alignment, Border, Side<br>from openpyxl.utils import get_column_letter<\/code><\/p>\n\n\n\n<p><code>def process_bom(input_csv: str, output_xlsx: str):<br>&nbsp;&nbsp;&nbsp;&nbsp;# Read the source CSV file<br>&nbsp;&nbsp;&nbsp;&nbsp;rows = []<br>&nbsp;&nbsp;&nbsp;&nbsp;with open(input_csv, newline='', encoding='utf-8-sig') as f:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reader = csv.DictReader(f)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for row in reader:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Convert numeric fields, default to 0 if blank or invalid<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qty = float(row['Quantity'])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mass = float(row['Unit Mass (kg)'])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost = float(row['Unit Cost (GBP)'])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except (ValueError, KeyError):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qty, mass, cost = 0, 0, 0<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;rows.append({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Part Number': row.get('Part Number', ''),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Description': row.get('Description', ''),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Quantity': qty,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Material': row.get('Material', ''),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Unit Mass (kg)': mass,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Unit Cost (GBP)': cost,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Total Mass (kg)': round(qty * mass, 3),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Total Cost (GBP)': round(qty * cost, 2),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;# Sort by Part Number<br>&nbsp;&nbsp;&nbsp;&nbsp;rows.sort(key=lambda r: r['Part Number'])<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Calculate totals<br>&nbsp;&nbsp;&nbsp;&nbsp;total_mass = sum(r['Total Mass (kg)'] for r in rows)<br>&nbsp;&nbsp;&nbsp;&nbsp;total_cost = sum(r['Total Cost (GBP)'] for r in rows)<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;# Create Excel workbook<br>&nbsp;&nbsp;&nbsp;&nbsp;wb = Workbook()<br>&nbsp;&nbsp;&nbsp;&nbsp;ws = wb.active<br>&nbsp;&nbsp;&nbsp;&nbsp;ws.title = 'BOM'<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Define styles<br>&nbsp;&nbsp;&nbsp;&nbsp;header_fill = PatternFill('solid', fgColor='1F5C99')<br>&nbsp;&nbsp;&nbsp;&nbsp;header_font = Font(bold=True, color='FFFFFF', size=11)<br>&nbsp;&nbsp;&nbsp;&nbsp;alt_fill = PatternFill('solid', fgColor='EBF3FB')<br>&nbsp;&nbsp;&nbsp;&nbsp;total_font = Font(bold=True, size=11)<br>&nbsp;&nbsp;&nbsp;&nbsp;thin = Side(style='thin', color='CCCCCC')<br>&nbsp;&nbsp;&nbsp;&nbsp;border = Border(left=thin, right=thin, top=thin, bottom=thin)<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;# Write header row<br>&nbsp;&nbsp;&nbsp;&nbsp;headers = list(rows[0].keys()) if rows else []<br>&nbsp;&nbsp;&nbsp;&nbsp;for col, header in enumerate(headers, 1):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell = ws.cell(row=1, column=col, value=header)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.fill = header_fill<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.font = header_font<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.alignment = Alignment(horizontal='center')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.border = border<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Write data rows with alternating shading<br>&nbsp;&nbsp;&nbsp;&nbsp;for row_idx, row in enumerate(rows, 2):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fill = alt_fill if row_idx % 2 == 0 else None<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for col, key in enumerate(headers, 1):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell = ws.cell(row=row_idx, column=col, value=row[key])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if fill:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.fill = fill<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.border = border<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Write totals row<br>&nbsp;&nbsp;&nbsp;&nbsp;totals_row = len(rows) + 2<br>&nbsp;&nbsp;&nbsp;&nbsp;ws.cell(row=totals_row, column=1, value='TOTALS').font = total_font<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Write totals in the Total Mass and Total Cost columns<br>&nbsp;&nbsp;&nbsp;&nbsp;mass_col = headers.index('Total Mass (kg)') + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;cost_col = headers.index('Total Cost (GBP)') + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;ws.cell(row=totals_row, column=mass_col, value=round(total_mass, 3)).font = total_font<br>&nbsp;&nbsp;&nbsp;&nbsp;ws.cell(row=totals_row, column=cost_col, value=round(total_cost, 2)).font = total_font<\/code><\/p>\n\n\n\n<p>&nbsp;<code>&nbsp;&nbsp;&nbsp;# Auto-fit column widths<br>&nbsp;&nbsp;&nbsp;&nbsp;for col in ws.columns:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;max_len = max(len(str(c.value or '')) for c in col)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ws.column_dimensions[get_column_letter(col[0].column)].width = min(max_len + 4, 40)<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;wb.save(output_xlsx)<br>&nbsp;&nbsp;&nbsp;&nbsp;print(f'BOM saved to {output_xlsx} ({len(rows)} line items)')<\/code><\/p>\n\n\n\n<p><code># Run the script with command-line arguments<br>if __name__ == '__main__':<br>&nbsp;&nbsp;&nbsp;&nbsp;if len(sys.argv) &lt; 3:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print('Usage: python bom_processor.py input.csv output.xlsx')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys.exit(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;process_bom(sys.argv[1], sys.argv[2])<\/code><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example 8: Revit Python Script for Room Data Sheet Generation<\/strong><\/h2>\n\n\n\n<p>Building managers and space planners frequently need a formatted schedule of all rooms in a Revit model with their areas, departments, and occupancy data. This script generates a clean Excel export directly from the Revit model data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The AI Prompt Used<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2fcfe\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74f05efce8c812513de90c11759d2747\" style=\"color:#369cf4\"><strong>Prompt sent to Claude:<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Write a Revit 2024 Python script (for use in a Dynamo Python Script node) that collects all Room elements in the active Revit model and exports their Name, Number, Level, Area (in square metres rounded to 1 decimal place), and the values of two shared parameters named &#8216;Department&#8217; and &#8216;OccupancyType&#8217;. Export the data to a CSV file at a user-specified path. Skip unplaced rooms. Comment each section.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Generated Code<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote has-background has-small-font-size is-layout-flow wp-block-quote-is-layout-flow\" style=\"background-color:#f2ffff\">\n<p class=\"has-small-font-size\"><code># Revit Room Data Export to CSV<br># Place in a Dynamo Python Script node<br># IN[0] = output file path (string from File Path node)<\/code><\/p>\n\n\n\n<p><code>import clr, csv<br>clr.AddReference('RevitAPI')<br>from Autodesk.Revit.DB import *<br>from Autodesk.Revit.DB.Architecture import Room<\/code><\/p>\n\n\n\n<p><code>doc = __revit__.ActiveUIDocument.Document<br>output_path = IN[0]<br>results = []<\/code><\/p>\n\n\n\n<p><code># Conversion: Revit internal area units are square feet<br>SQM_FACTOR = 0.092903<\/code><\/p>\n\n\n\n<p><code>def get_shared_param(element, param_name):<br>&nbsp;&nbsp;&nbsp;&nbsp;\"\"\"Helper: get a shared parameter value by name, return empty string if missing.\"\"\"<br>&nbsp;&nbsp;&nbsp;&nbsp;param = element.LookupParameter(param_name)<br>&nbsp;&nbsp;&nbsp;&nbsp;if param and param.HasValue:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return param.AsString() or ''<br>&nbsp;&nbsp;&nbsp;&nbsp;return ''<\/code><\/p>\n\n\n\n<p><code># Collect all Room elements in the model<br>collector = FilteredElementCollector(doc).OfClass(SpatialElement)<br>rooms = [r for r in collector if isinstance(r, Room)]<\/code><\/p>\n\n\n\n<p><code># Write CSV file<br>with open(output_path, 'w', newline='', encoding='utf-8') as f:<br>&nbsp;&nbsp;&nbsp;&nbsp;writer = csv.writer(f)<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<code># Write header row<br>&nbsp;&nbsp;&nbsp;&nbsp;writer.writerow(['Number', 'Name', 'Level', 'Area (sqm)', 'Department', 'OccupancyType'])<\/code><\/p>\n\n\n\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;for room in rooms:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Skip unplaced rooms (area = 0 means not placed on a floor plan)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;area_sqft = room.Area<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if area_sqft &lt; 0.001:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(f'Skipped unplaced room: {room.Name}')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Get standard room parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;room_number = room.Number<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;room_name = room.Name<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level_name = room.Level.Name if room.Level else 'Unknown'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;area_sqm = round(area_sqft * SQM_FACTOR, 1)<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;# Get shared parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;department = get_shared_param(room, 'Department')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;occupancy = get_shared_param(room, 'OccupancyType')<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;writer.writerow([room_number, room_name, level_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;area_sqm, department, occupancy])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.append(f'Exported: {room_number} - {room_name}')<\/code><\/p>\n\n\n\n<p><code>OUT = results + [f'File saved to: {output_path}']<\/code><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Building Your Own AI-Assisted Automation Workflows<\/strong><\/h2>\n\n\n\n<p>The eight examples above follow the same pattern. Once you recognise it, you can apply it to almost any repetitive engineering task. Here is the framework for building a new automation with AI assistance.<\/p>\n\n\n\n<figure class=\"wp-block-table has-medium-font-size\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Step<\/strong><\/td><td><strong>Action<\/strong><\/td><td><strong>Time Required<\/strong><\/td><\/tr><tr><td>1. Identify the task<\/td><td>Choose a task you or your team does manually more than once a month. The best candidates are: the same sequence of steps every time, no engineering judgement required, at least 15 minutes each occurrence<\/td><td>5 minutes<\/td><\/tr><tr><td>2. Write the task description<\/td><td>Write a one-paragraph description of exactly what the script needs to do: what inputs it reads, what it processes, what it outputs, what it should do on errors<\/td><td>10 minutes<\/td><\/tr><tr><td>3. Specify the technical environment<\/td><td>Add: software name and version, scripting language (VBA, Python, AutoLISP, iLogic), any libraries needed, where files are located<\/td><td>5 minutes<\/td><\/tr><tr><td>4. Add safety instructions<\/td><td>Add: &#8216;include error handling&#8217;, &#8216;comment every section&#8217;, &#8216;test on a single file before batch processing&#8217;, &#8216;log successes and failures to a text file&#8217;<\/td><td>2 minutes<\/td><\/tr><tr><td>5. Generate with AI and review the code<\/td><td>Paste the prompt into Claude or ChatGPT. Read through the generated code before running it. If you cannot follow what a section does, ask the AI to explain it<\/td><td>10-30 minutes<\/td><\/tr><tr><td>6. Test on a small sample<\/td><td>Run on 3-5 test files from a copy of your data. Verify the output is exactly what you wanted before running on the full dataset<\/td><td>15-30 minutes<\/td><\/tr><tr><td>7. Document and share<\/td><td>Add a comment header to the script explaining what it does, what inputs it expects, and any known limitations. Save it to a shared team folder so others can benefit<\/td><td>10 minutes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Automation Safety: What to Check Before Running AI-Generated Scripts<\/strong><\/h2>\n\n\n\n<p>AI-generated automation code is starting code, not verified production code. The following checks should be applied to every script before running it, particularly before any batch operation on real data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"1024\" src=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Automation-Safety-Checklist-for-Engineers.png\" alt=\"Engineering automation safety checklist showing six verification steps before running AI generated CAD scripts including read code check file operations verify error handling test single file run on copy and check version compatibility\" class=\"wp-image-1085\" srcset=\"https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Automation-Safety-Checklist-for-Engineers.png 1536w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Automation-Safety-Checklist-for-Engineers-300x200.png 300w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Automation-Safety-Checklist-for-Engineers-1024x683.png 1024w, https:\/\/simutecra.com\/blog\/wp-content\/uploads\/2026\/11\/Automation-Safety-Checklist-for-Engineers-768x512.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table has-medium-font-size\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Check<\/strong><\/td><td><strong>What to Look For<\/strong><\/td><td><strong>Why It Matters<\/strong><\/td><\/tr><tr><td>Read the code before running<\/td><td>Does each section do what the comment says? Are there any operations you do not understand?<\/td><td>AI code can include unexpected operations, deprecated API calls, or incorrect logic that looks superficially correct<\/td><\/tr><tr><td>Check file operations<\/td><td>Does the script write to, overwrite, or delete any files you did not intend?<\/td><td>Scripts that call Save, Delete, or overwrite existing files can cause data loss if the path logic is wrong<\/td><\/tr><tr><td>Verify error handling<\/td><td>Does the script stop and report on failure, or does it crash silently on error 47 of 200 and leave half the files processed?<\/td><td>Without error handling, a batch script can leave your data in an inconsistent state that is hard to diagnose<\/td><\/tr><tr><td>Test with a single file first<\/td><td>Run on one file. Verify the output is exactly correct before running on a folder<\/td><td>A logic error in file naming or parameter handling affects every file in the batch if not caught early<\/td><\/tr><tr><td>Run on a copy<\/td><td>Never run an untested script on your only copy of important data<\/td><td>Automation errors on originals are difficult or impossible to reverse<\/td><\/tr><tr><td>Check version compatibility<\/td><td>API calls change between software versions; an API call that works in SolidWorks 2023 may not work in 2025<\/td><td>Version mismatches produce cryptic errors that are difficult to debug if you did not consider the version dependency first<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Frequently Asked Questions (FAQ)<\/strong><\/h2>\n\n\n\n<p><strong>Can AI write working CAD automation scripts?<\/strong><\/p>\n\n\n\n<p>Yes, with important caveats. For well-documented APIs like SolidWorks VBA, Revit Python API, Fusion 360 Python API, and AutoLISP, AI language models (Claude, ChatGPT) generate code that is close to correct and often runs with minor adjustment. The quality depends heavily on the specificity of your prompt. Scripts for standard, well-documented tasks (batch export, property population, view creation) are more reliable than scripts for less common API operations. Always read the code before running it, test on a single file first, and run on a copy of your data. AI is most effective as a starting point that saves 80 to 90 percent of the coding time, with the engineer providing the remaining testing and adjustment.<\/p>\n\n\n\n<p><strong>Which AI tool is best for generating engineering automation code?<\/strong><\/p>\n\n\n\n<p>Claude (Anthropic) and ChatGPT GPT-4o (OpenAI) are both capable of generating engineering automation code for major CAD platforms. For longer scripts or when the prompt includes detailed context about your file structure, API version, and specific requirements, Claude has the advantage of a larger context window, which helps maintain accuracy in longer code generations. For quick, shorter scripts (AutoLISP routines, simple VBA macros), both perform similarly. GitHub Copilot is useful if you are writing the code in an IDE and want inline suggestions rather than complete script generation. The choice matters less than the quality of your prompt.<\/p>\n\n\n\n<p><strong>What engineering tasks are best suited to AI automation?<\/strong><\/p>\n\n\n\n<p>The best candidates for AI automation are tasks that are repetitive (the same sequence of steps every time), rule-based (no engineering judgement required), time-consuming (at least 15 minutes per occurrence), and well-defined (you can describe exactly what the script should do). <\/p>\n\n\n\n<p>Good examples include: batch export of <a href=\"https:\/\/simutecra.com\/blogs\/cad-file-management-best-practices-engineering-teams\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/cad-file-management-best-practices-engineering-teams\/\">CAD files <\/a>to neutral formats (STEP, STL, PDF), custom property audit and population, BOM data extraction and reformatting, drawing sheet creation from part models, layer standard application to legacy drawings, report generation from model data, and parametric configuration from design tables or spreadsheet inputs. Tasks that require engineering judgement, visual inspection, or interpretation of ambiguous situations are not suitable for automation.<\/p>\n\n\n\n<p><strong>Do I need programming knowledge to use AI-generated automation scripts?<\/strong><\/p>\n\n\n\n<p>Basic programming literacy helps, but you do not need to be able to write scripts from scratch. You need to be able to read the generated code and broadly understand what each section does, identify any file operations that could cause data loss, and make minor adjustments to hard-coded values like file paths, template names, and property names. The &#8216;comment every section&#8217; instruction in your prompt produces code where each block has a plain-English explanation, making it readable even without deep coding experience. For engineers who want to build automation skills progressively, using AI-generated code as a learning tool alongside the comments is an effective approach.<\/p>\n\n\n\n<p><strong>What should I do if an AI-generated script does not work?<\/strong><\/p>\n\n\n\n<p>The debugging workflow is: (1) Read the error message carefully and identify which line failed. (2) Copy the error message and the surrounding code block back into Claude or ChatGPT and ask &#8216;This script produced the following error on this line: [paste error]. Explain what caused it and provide the corrected code.&#8217; (3) AI is generally good at diagnosing its own errors when given the specific error message and context. <\/p>\n\n\n\n<p>(4) Check the API version and whether the specific call has changed in your software version. (5) For persistent issues, paste the full script along with the error into the AI conversation and ask for a complete review of potential issues. Most AI-generated script errors are either path or naming mismatches that the engineer needs to correct, or API version differences that the AI can fix when told the correct version.<\/p>\n\n\n\n<p><strong>Is it safe to run AI-generated automation scripts on production data?<\/strong><\/p>\n\n\n\n<p>Not without testing first. Run every AI-generated script on a copy of your data, on a small sample of files (three to five), before running on production data or in a batch operation. Check specifically for any Save, Delete, or overwrite operations in the code and verify that the paths and conditions are exactly what you intended. <\/p>\n\n\n\n<p>For scripts that modify files in a PDM vault or version-controlled environment, understand the vault&#8217;s check-in and check-out behaviour and whether the script will trigger revision increments or workflow state changes that you did not intend. Once a script has been tested and confirmed correct on a representative sample, it can be run on production data, but a backup or snapshot should always be available in case of unexpected behaviour.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>The eight examples in this article represent a fraction of what engineering teams can automate with AI-generated scripts. The underlying pattern is consistent across all of them: describe the task precisely, specify the technical environment, request error handling and comments, test on copies before production, and verify the result matches your intent. Follow that pattern and AI makes the difference between automation being a specialist skill that one person on the team has and an everyday tool that anyone can reach for.<\/p>\n\n\n\n<p>The biggest practical barrier to engineering automation has never been that the automation was too hard to build. It has been that the engineer who needed it did not have time to write it, and the engineer who could write it did not have time to stop and help. AI collapses that barrier. A task that would have required someone to spend an afternoon learning an unfamiliar API and debugging can now be bootstrapped in thirty minutes with a good prompt and a willingness to read the code before running it.<\/p>\n\n\n\n<p>Start with the example closest to a task your team does repeatedly right now. Adapt the code for your specific file paths, naming conventions, and software version. Test it. Then build a shared folder where your team&#8217;s tested automation scripts live, so every script someone writes with AI assistance becomes a resource the whole team can use. That is how individual productivity gains become team-level capability improvements.<\/p>\n\n\n\n<p><strong>Related Reading: 50 Claude Prompts for Mechanical Engineers | 50 ChatGPT Prompts for CAD Designers | <a href=\"https:\/\/simutecra.com\/blogs\/how-engineers-use-ai-to-review-cad-models-fast\/\" data-type=\"link\" data-id=\"https:\/\/simutecra.com\/blogs\/how-engineers-use-ai-to-review-cad-models-fast\/\">How Engineers Use AI to Review CAD Models Faster<\/a> | How AI Helps Reduce Product Development Time | 3D Modeling in CAD: The Complete 2025 Guide<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The most underused AI capability in engineering automation is code generation. Not for software products or web applications, but for the small, specific automation scripts that engineering teams need constantly and almost never have time to write: the SolidWorks macro that renames 200 components in a drawing, the Dynamo script that places structural columns from [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1083,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[39,25,21,209,24],"class_list":["post-1077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-3d-modeling","tag-ai","tag-cad-drafting","tag-engineering-automation","tag-mechanical-engineering"],"_links":{"self":[{"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/posts\/1077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/comments?post=1077"}],"version-history":[{"count":7,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/posts\/1077\/revisions"}],"predecessor-version":[{"id":1088,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/posts\/1077\/revisions\/1088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/media\/1083"}],"wp:attachment":[{"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/media?parent=1077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/categories?post=1077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simutecra.com\/blog\/wp-json\/wp\/v2\/tags?post=1077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}