Replace-text-to-filename but have some changes!

Replace-text-to-filename but have some changes!

Anonymous
Not applicable
664 Views
5 Replies
Message 1 of 6

Replace-text-to-filename but have some changes!

Anonymous
Not applicable

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-to-filename-problem/td-...

Dear All,

I found the lisp for the replace-text-to-filename but I want some changes for my convenience.

For example, Filename is: 632365-01-10 0870 15D12 Nam. I want my text will be changed to 632365-0a only (After dash will be changed to 0a.

Thank you,
Moza

0 Likes
Accepted solutions (1)
665 Views
5 Replies
Replies (5)
Message 2 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

For example, Filename is: 632365-01-10 0870 15D12 Nam. I want my text will be changed to 632365-0a only (After dash will be changed to 0a.


The Oa suffix is always that? or the "0" and "a" represents something else like revisions and changes from time to time? 

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

@pbejse 
The Oa suffix is always that, Fixed value! 
Thank you,

Moza

0 Likes
Message 4 of 6

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

@pbejse 
The Oa suffix is always that, Fixed value! 
Thank you,

Moza


Replace this line from the original post

 

(setq aa (strcat (vl-filename-base (getvar 'DwgName)) ".dwg"))

 

With this

 

(setq aa (strcat (substr (vl-filename-base (getvar 'DwgName)) 1 7) "0a" ".dwg"))

 

That is if the number of characters .i.e 632365-01-10 0870 15D12 is consistent.

 

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

It is great! Thank you very much!

0 Likes
Message 6 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

It is great! Thank you very much!


Anytime moza.

Cheers

 

0 Likes