Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Rename Line Patterns

raymondlooRAB85
Participant

Rename Line Patterns

raymondlooRAB85
Participant
Participant

We are exploring using macros to automatically rename line patterns across hundreds of loadable families in line with new company standards.

 

As I'm new to using macros, I stumbled upon this web page which allows a prefix to be added to line patterns. I tested it and it seems to work fine.

 

https://www.modelical.com/en/node/revit-api-rename-line-patterns/ 

 

However, we are needing to replace the line pattern name's prefix with a different one. The above macro only adds a new prefix (ie. I can't seem to remove the existing prefix). Any advice on what modifications to this macro would be needed would be much appreciated.

 

eg. Old name = ABC-Dash_Dot

New name = DEF-Dash_Dot

 

Many thanks in advance.

0 Likes
Reply
Accepted solutions (1)
348 Views
4 Replies
Replies (4)

jeremy_tammik
Autodesk
Autodesk
Accepted solution

Yes, sure we can help. That is a very simple task. All you need to do is to use one or two of the numerous and powerful string manipulation methods provided by C# and other .NET languages:

  

  

In your specific case, you want to replace a string in a string:

  

  

I don't think I need to spell it out further still, do I?

  

Good luck and have fun!

  

And congratulations on the luck of finding such a suitable starting point for your endeavour.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

raymondlooRAB85
Participant
Participant

Hi Jeremy,

 

Many thanks for your help! After a bit of trial and error I think the issue is resolved.

 

I used StringBuilder to replace part of the line pattern name. Is there a way to batch run macros across multiple families?

0 Likes

jeremy_tammik
Autodesk
Autodesk

Good for you, congratulations. As said, there are many possible ways to achieve that.

   

The same applies for batch processing documents, both RVT and RFA. Here are some suggestions from The Building Coder:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

raymondlooRAB85
Participant
Participant

Thank you Jeremy for your help. We will take a look at what The Building Coder has to say.

0 Likes