A couple of newbie lisp questions / requests

A couple of newbie lisp questions / requests

h_s_walker
Mentor Mentor
2,146 Views
39 Replies
Message 1 of 40

A couple of newbie lisp questions / requests

h_s_walker
Mentor
Mentor

My company is soon going to be getting LT2025 after being stuck on LT2016 for ages.

Now I know if I want settings to load up everytime I need to put them in the *doc.lsp file.

What do I need put in the lisp file to change the following?

MTEXTCOLUMN 0

HPANNO 1

PASTESPECMODE 1

Those 3 will do for starters.

 

OK next request

We get sent drawings from clients all the time and I use the RENAME command to put "XCLIENT " in front of every entity so that all client stuff gets shoved to the bottom of the dialog boxes.

Is there a lisp which can run through the renaming of everything in the client drawing without me have to go through each and every group of items?

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Accepted solutions (3)
2,147 Views
39 Replies
Replies (39)
Message 21 of 40

MrJSmith
Advocate
Advocate
@ronjonp I thought about that, but figured I should just give him what he asked for 😉
0 Likes
Message 22 of 40

pendean
Community Legend
Community Legend
0 Likes
Message 23 of 40

MrJSmith
Advocate
Advocate

@pendean I think you misunderstood him, he doesn't want to rename the files but rather the objects inside ACAD i.e. blocks and layers.

0 Likes
Message 24 of 40

pendean
Community Legend
Community Legend

@MrJSmith wrote:

@pendean I think you misunderstood him, he doesn't want to rename the files but rather the objects inside ACAD i.e. blocks and layers.


Thanks for that.

0 Likes
Message 25 of 40

ronjonp
Advisor
Advisor

@MrJSmith wrote:

@ronjonp He wanted all the named objects as listed in the RENAME command. That only handles the tables. You still have to do the dictionaries. 


I'm aware of that .. this was all the effort I wanted to put into this. 😎

 

I still think this is a much simpler solution: Another way to solve this sorting problem is to have a template and make all your layers blocks etc ...

0 Likes
Message 26 of 40

ronjonp
Advisor
Advisor

@MrJSmith wrote:
@ronjonp I thought about that, but figured I should just give him what he asked for 😉

Why wouldn't you add it? It's a simple WCMATCH check.

0 Likes
Message 27 of 40

paullimapa
Mentor
Mentor

for some reason when it comes to textstyles this line of code:

(vl-catch-all-apply '(lambda () (vla-put-name it (strcat prefix (vla-get-name it))))) 

Would yield following error

; error: ActiveX Server returned an error: Type mismatch

I had to resort to the old rename command:

(vl-cmdf "_.-Rename" "_Style" (vla-get-name it) (strcat prefix (vla-get-name it))) 

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 28 of 40

john.uhden
Mentor
Mentor

@paullimapa ,

Have you tried (vlax-invoke it 'get-name ....))?  Or even vlax-invoke-method?

I have found that for various species of the vla* family, certain varieties will work but others not.

John F. Uhden

0 Likes
Message 29 of 40

paullimapa
Mentor
Mentor
Accepted solution

Since the setpropertyvalue method works I decided to code it like this:

       (if (eq "textstyles" table) ; add filter out to run different code for textstyles
        (if (not (tblsearch "style" (strcat prefix (vla-get-name it)))) ; add check if rename textstyle doesn't exist
         (setpropertyvalue (vlax-vla-object->ename it) "Name" (strcat prefix (vla-get-name it))) ; this works on textstyles
        )
        (vl-catch-all-apply '(lambda () (vla-put-name it (strcat prefix (vla-get-name it))))) ; this doesn't work on textstyles
       )

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 30 of 40

h_s_walker
Mentor
Mentor

@MrJSmith @ronjonp Thanks I'll try those when I get into work

@pendean No I just needed to change my username, because my work will use my old one for LT 2025

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 31 of 40

Sea-Haven
Mentor
Mentor

Just my $0.05 I stay away from acaddoc.lsp etc but rather have a custom lisp with all my start up code, you just do Appload and add to the "start up suite" it will run when you open a dwg.

 

0 Likes
Message 32 of 40

h_s_walker
Mentor
Mentor

@Sea-Haven Yeah I am thinking of going that route.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 33 of 40

h_s_walker
Mentor
Mentor

@MrJSmith Yep that is almost perfect as has been mentioned elsewhere it doesn't work on text styles

@paullimapa Where would I put your little snippet of code to make it work?

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 34 of 40

paullimapa
Mentor
Mentor
Accepted solution

attached is my modified version...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 35 of 40

h_s_walker
Mentor
Mentor

@paullimapa Works perfectly. Cheers

@ronjonp Since the dinosaurs started crawling out of the primordial ooze

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 36 of 40

paullimapa
Mentor
Mentor

It was a group effort…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 37 of 40

Sea-Haven
Mentor
Mentor

Glad to help, we ran a server so any updates to the autoload were straight away available. No customizing code on each pc.

0 Likes
Message 38 of 40

MrJSmith
Advocate
Advocate

@paullimapa Interesting. Turns out the textstyles name property is read only. I've hence updated my code to include your fix.

0 Likes
Message 39 of 40

paullimapa
Mentor
Mentor

Yes, very strange that it's only the case with textstyles. But glad that at least the setpropertyvalue method works.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 40 of 40

Sea-Haven
Mentor
Mentor

Just a comment comparing Bricscad with LT2025 does not have the problem of missing lisp functions a definite drawback. Possibly better pricing also.

0 Likes