Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp for removing last characters of block name in selected object ?

22 REPLIES 22
Reply
Message 1 of 23
shehab10
2092 Views, 22 Replies

Lisp for removing last characters of block name in selected object ?

Hi, When i export revit drawing with revit family 

the revit family become block in autocad like this

M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45

usually i want to remove the ID and view name to become like this without have to re type because it is tedious

M_Single-Flush - 700 x 2200mm

 

something like how many letters you want to remove from last to first ?

or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name)  -278353-Ground Level _0_45?

 

22 REPLIES 22
Message 21 of 23
Kent1Cooper
in reply to: shehab10

If you can stand to have the word " Diameter" left in as part of the round-dining-table Block name, it looks like everything would have the pattern that you want to remove all characters starting at the second hyphen from the end.  That's the only thing resembling any kind of pattern that I can see in them, that a generic routine would be able to work with and come up with a consistent kind of change.  If that would always be the case in other Block names not listed here, a routine could be made to do that.

Kent Cooper, AIA
Message 22 of 23
shehab10
in reply to: Kent1Cooper

BlackBox_ or someone could you provide me the final version that rename all blocks that end mm or m as well as prfix m_?

Message 23 of 23
shehab10
in reply to: Kent1Cooper

The code working but I just want the code to make changes on multiple selection instead of one by one as i attached in the previous sample dwg.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost