Load lisp from Tool Palette

Load lisp from Tool Palette

MikeKovacik4928
Advisor Advisor
3,066 Views
7 Replies
Message 1 of 8

Load lisp from Tool Palette

MikeKovacik4928
Advisor
Advisor

Hi there autocad programmers,
.
https://forums.autodesk.com/t5/autocad-forum/lengthen-from-midpoint/m-p/7350684#M896161
.
The result to this post, I have used to good effect in all my drawings.
I have put it into a tool pallet, using coding, I think, that someone
did for me on the autocad customisation forum.
.
It works perfectly! I, of course have to use appload to load the lisp first.


Lispers and Customisers out there,
.
How can I add something to my toolbar,
coding to automatically load the lisp, when I click on the pallet tool.
.
See attached pdf for screenshots of what I have been doing.
.
Michael Kovacik

.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
(personal licensed copy)
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

0 Likes
Accepted solutions (1)
3,067 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant

See HERE, consider autoload.

 

 

See some of examples from my acaddoc.lsp

 

(autoload "c:/Users/CZB/_Autocad/_Apps/Text2Leader.lsp" '("TXT2LEAD"))
(autoload "c:/Users/CZB/_Autocad/_Apps/TextOverLap.lsp" '("TextOverLap"))
(autoload "c:/Users/CZB/_Autocad/_Apps/UnicodeReplace.lsp" '("UniReplace"))

 

In your case...

(autoload "c:/RealFilePath/TLM.lsp" '("TLM"))

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

I think you just need to coordinate your file and command names.

 

The code at the top of your image [the one that uses the SCALE approach and works only with Lines or single-line-segment Polylines] is from Post 14  of your linked thread, defining the command name TLM.  The command macro, however, is checking whether the command name LTM is present, and if not, it is loading the file that defines LTM, from Post 31  of that thread [the one that uses the LENGTHEN approach and works with additional kinds of objects].  But then it's calling the TLM command name, which is not  the command defined in the file it just loaded.  That's probably why you're still needing to load the file that defines TLM before you use that button -- the button doesn't load the file that defines the command name it then calls for.  In addition [though this shouldn't prevent it from working], the Tool Palette button label uses yet another  letter sequence -- MLT.

 

LTM.PNG

 

Choose which command you really want to use, and have it load the appropriate file.

Kent Cooper, AIA
0 Likes
Message 4 of 8

MikeKovacik4928
Advisor
Advisor

okay

have the correct lisp names now.

Still not loading.

 

Mike

 

 

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

@MikeKovacik4928 wrote:

okay

have the correct lisp names now.

Still not loading.

.... 


Since the TLM command defined in Post 14 of that thread is not already in a .lsp file [as the one for the LTM command in Post 31 is], but only in a Code window, I will assume that the file you saved it in is actually called  TLM.lsp -- it caught my attention because it's so different from the character of the filename before.  Is it in a location that AutoCAD can find [Support File Search Path list in the Files tab in OPTIONS]?  If you use APPLOAD and manually load it, does it load without error?  [The error message doesn't specify whether the failure is because it couldn't find it, or there's something wrong with the file itself, or otherwise.]

Kent Cooper, AIA
0 Likes
Message 6 of 8

MikeKovacik4928
Advisor
Advisor

Thanks Kent

 

It did work with appload

 

It was, however not in the support file search patch. I have put it it here and It now works without 

having to appload

 

Mike

0 Likes
Message 7 of 8

MikeKovacik4928
Advisor
Advisor

 

Autodesk moderators, finger error here, I pressed my own post for accept as solution, by mistake

How can I undo, or can you undo for me.

 

Mike Kovacik

 

 

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

@MikeKovacik4928 wrote:

 

Autodesk moderators, finger error here, I pressed my own post for accept as solution, by mistake

How can I undo, or can you undo for me.

.... 


[I took care of that for you -- we Expert Elite members wield awesome powers, one of which is to mark a Post as the Solution, or Not the solution, even in threads we did not initiate.]

Kent Cooper, AIA
0 Likes