r/MechanicalEngineering • • 12h ago

Using AI to create macros/scripts is powerful

Anyone else been using AI to create macros/scripts to automate your repetitive work?

We all know that macro/script recording and playback for programs such as solidworks and SAP can be used to automate tasks. Over the past few months I've found that vibe-coding custom macros is very effective. Wanted to see what other engineers are doing with this

34 Upvotes

43 comments sorted by

32

u/rhythm-weaver 12h ago

Yes. We’re forced to use Copilot and I don’t trust it to handle the big picture. I use it to build the blocks that I assemble into the big picture.

3

u/Pinkys_Revenge 8h ago

Any tips for getting copilot to work well?

I use Claude for personal stuff but I’m also forced to use copilot for work. I find copilot to be painfully bad in comparison.

4

u/Wilthywonka 6h ago

Get your company to give you copilot premium. You can use the high end models from anthropic

1

u/Pinkys_Revenge 5h ago

Wait… really!?! Holy shit. Thank you!!!

1

u/Wilthywonka 4h ago

Yep it's super nice. It all stays within the network, so you get to use claude without worrying about IP stuff

5

u/Fit_Opportunity_9728 7h ago

Copilot is so bad

0

u/rhythm-weaver 7h ago

The copilot in Excel is good

2

u/Pinkys_Revenge 7h ago

Good to know. I’ve only tried it with outlook so far, and it couldn’t even find emails I had received 20 minutes earlier.

1

u/CopperGenie R&D | Author | ISERG 10h ago

Well said. I trust genAI insofar as I can verify its output.

2

u/EndingPop 6h ago

I'm replacing some of our expensive software with free stuff Opus can make. If you're careful in how you scope/define the work and test it thoroughly it does a great job. I point it at "/grill-me" from Matt Pocock's skills (https://github.com/mattpocock/skills) and have it work through the issues with me.

2

u/Wilthywonka 6h ago

My company has been starting to do something similar. Opus can build specialized tools that are 90% as good as the ones on the market. I've been very impressed by it

1

u/big-mover 5h ago

Can you be more specific? What is the expensive software doing?

1

u/raztok 2h ago

automatically exporting dxf.... with 1 click 🤷🏻‍♀️

1

u/EndingPop 2h ago

My team is focused on FEA/CFD. We aren't rewriting Abaqus or ANSYS (yet? seems like a much bigger lift/risk), but I already built a topology optimizer and a process automation tool for DOEs/optimization and that's been very straight-forward. No GUI, and much more limited than the commercial tools, but meets our current needs and extending them as needs arise has been super fast. The tools leverage what's already in the literature and/or available in Python libraries, along with our cluster submission commands, so what actually gets built is basically just wrappers. They call the commercial FEA/CFD codes we already know inside and out and have lots of V&V already completed.

It helps that I used to work a companies that made tools like this, so I know the requirements and danger zones, but honestly Opus does a good job of identifying risks when rebuilding something that already exists. For example, it suggested hashing designs to enable restarts without rerunning designs and to ensure stale designs don't get accidentally reused when the project is changed.

Several of the CAE vendors tried to squeeze us really hard this year on price and in response we cut our substantial software budget by 15% and are rebuilding what we cut. We're now looking hard at open source for FEA/CFD and will likely end up extending the tool capabilities with AI to meet our specific needs. I keep telling my boss that we should convince legal to let us release those updates back into the public projects. If everyone did that it'd start dropping the cost for the commercial tools in a hurry. It's about the only solution to the active enshittification among CAE tools.

5

u/Pinkys_Revenge 8h ago edited 8h ago

I’ve found it’s very good at checking spreadsheets for errors (we have budgets that are huge spreadsheets and no one has the attention span to check them thuroughly, but Ai does a great job and often finds mistakes.

It’s also great at comparing docs to each-other. For example, we often have a pdf writeup about a project that can be 20+ pages long and an associated budget, Ai is great at spotting inconsistencies between the two.

It’s also great at writing the BS flowery language for emails you sometimes need for sales people or executives who don’t like the way engineers normally communicate.

4

u/ArbaAndDakarba 11h ago

Sure, but I've found much more value in building analytical calculators based on codes / standards. Claude is extremely adept at it.

2

u/lazydictionary Materials Science | Manufacturing | Mod 4h ago

We used to use Access for the front end of some of our internal databases. Been using LLMs to spin up web apps which are faster and more versatile now instead.

2

u/Accro15 11h ago

Use the AI to teach you about scripts until you're comfortable. Then use the AI to make scripts. Then you can review them with some confidence.

2

u/SimultaneousThought 12h ago

Yep, and quick custom apps too

1

u/SystemicAM 12h ago

I did until I grew tired of AI bs and the ethical problems surrounding it, now I'm sworn off it. Happy to make scripts myself as I used to. If I'm not doing the work myself then I'd rather find other work to do.

5

u/nice_arrears 10h ago

if a macro touches released drawings i wanna explain every line in a design review

-1

u/zhnki 6h ago

Why not just review the final drawing. You don’t need to understand every building block used to make it. Does it convey the correct information or not.

2

u/acomputer1 2h ago

How to you determine if the information is correct if you don't understand what's underneath it?

This is the fundamental problem with using gen AI, you can use it to build tools that can be validated, but if you're letting it control the entire workflow you have no way to validate that is doing what it claims to be doing or of its just generating a plausible looking output.

•

u/zhnki 31m ago

By being competent and reviewing what you deliver as an engineer. How the sausage gets made is rarely important.

•

u/acomputer1 20m ago

If the only thing you're reviewing is the final output that's not being competent.

2

u/Ghooble 6h ago

Agreed

2

u/zhnki 6h ago

I get what you’re saying, but you may not have a choice to do the work you want with that approach. Good luck.

3

u/SystemicAM 5h ago

I won't have the choice to do the work I want without it either. I didn't go into this field so I could be a chatbox operator. Thinking about getting a trade ticket or something. Anything that's vaguely technical and can't reasonably be bimbofied by AI tools.

1

u/wimax91 12h ago

Yeah I’ve used it to set my parameters for my parametric designs that have 200+ variables (like it pulls dimensions from online data sheets for components and changes the parameters to allow for mounting)

1

u/PrestigiousDog9842 3h ago

Same here, custom properties and drawing updates are my favorite to automate

1

u/metarinka 3h ago

I'm going beyond that.

It finishes up data packages. Exports. Relinks files. Light pdm work, folder structuring and Rev control.

I also have lots of simple but repetitive parts. Like drill bits in different diameters. It will make a macro but also just kick out the entire package and run tests to verify

1

u/sergiogsr 2h ago

At first I tried to create new macros or VBA code with copilot... but quickly found out that you can create tools using html format. Its easier, more powerful and its all local and works without internet connection if needed. 

You create a local html file that can take a file in different formats if needed and:  Can process it based on the source file content.  Can compare several different files. You can interact with the source file using forms, combo boxes, controls and check boxes.  You can load databases so it uses them to process the source file. 

And of course, can get an output file with the processing complete. 

I have created several tools like this. It has helped me to create: 

  • calculators based on databases that update constantly. 
  • user friendly file converters for legacy systems. 
  • quality assurance system for quotations.
  • quotation analysis and automated bundled solutions assistant (based on statistics and compatible combinations and attibute databases)
  • automated comparisons for large databases. 

Average creation time for most of the tools is less than an hour with Copilot, but you need to have a structured process to define the flows and validation of the output. 

1

u/Aggressive_Ad_507 11h ago

I vibe code excel. It's great to get widgets and light databases set up.

My biggest uses have been reviewing documents for ISO and pressure vessel authority compliance.

1

u/joap25 9h ago

Made an add-in to connect inventor to our ERP tool. Amazing

1

u/TheBlack_Swordsman 7h ago

Yes. For FEA stuff. It's been very helpful. LS-DYNA, automation of 100s of bodies to generate contact properties and then automating their force results out into Excel and then automating their force outputs in graphs, etc.

Turned 60-80 hours of work now into 8-12.

1

u/PigSlam 5h ago

It's pretty powerful. I've been tinkering with some game development stuff on my own time, and I've essentially built a CAD vault database/data store with viewer for managing assets I've had AI agents build using Blender/Godot Game Engine. It's incredible what you can have with a little planning and guidance.

-1

u/Lunastarfire 11h ago

Using AI to vibecode is fine for random low effort, low complexity tasks but its like trusting your uncle who only rides a push bike but has watched a load of youtube vids of pit crews and now youre getting him to fix an F1 Car.

He might be gods gifts to mechanics, but more likely it will be done with very low efficiency, major critical elements will be missed, and since you never checked in on it once, you just got to trust it doesnt explode.

Personally, I use it more like an apprentice, I ask it to do things that are broken down enough for it to understand, that I can quickly skim through to ensure its doing what I think its doing and to be open to new approaches, but ultimately its my work at the end.

0

u/BenchPressingIssues 12h ago

Yeah. I had it create a VBA macro to plug data from a spreadsheet into word document templates and save copies with the proper name. 

0

u/thirty2skadoo 7h ago

I’m automating all the design release bullshit workflows. The workflow has a UI that a human audits - the code under it is deterministic. I’be just setup Fluent MCP and I’m going to start using that for sim setup and post processing. 

0

u/MyDogNamedRed 5h ago

We have inventor, I use chatgpt to build some Ilogic form tool that helps with repetitive modeling, drawing details routine, its pretty useful.

-1

u/buginmybeer24 7h ago

I've been doing it long before AI. The AI just makes it faster.