custom lisp not working properly

custom lisp not working properly

WarrenBush
Explorer Explorer
732 Views
5 Replies
Message 1 of 6

custom lisp not working properly

WarrenBush
Explorer
Explorer

Can any one help with my lisp as it seems to work but the help menu opens after I run it?

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

paullimapa
Mentor
Mentor
Accepted solution

Try replacing the following lines of code:

(command "osnap" "end,per,mid,cen,node,quad,ins,appint" "")
(command "grid" "off" "")

 

with:

(command "osnap" "end,per,mid,cen,node,quad,ins,appint")
(command "grid" "off")

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

WarrenBush
Explorer
Explorer

Thank you very much that seems to elimate the help menu opening, but for some reason it still is giving a invalid choice and iniating the command scale, is there another code entry i might have over looked or placed in the wrong order?

I checked it thru vlisp and didn't get any issues

 

 

 

Command: (load"ing-scale.lsp")
Scale Factor of 1C selected.Invalid choice.Scale list reset to default entries.

No unreferenced linetypes found.
nil

Command: scale

 

I also have another custom that is doing the same thing opening the help menu, I looked for the same issues you found in the Scale but was unable to locate the source I use this for the setup, could you see if you see my error I really appreciate your time and help.

Thanks

 

0 Likes
Message 4 of 6

paullimapa
Mentor
Mentor

What if you replaced the last line of code:

)Done!

 

with this:

) ; Done!

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

WarrenBush
Explorer
Explorer

Thanks again 

I tried replacing it with ) ; Done!

and also removed that line and it still activates the Command: scale 

Its ok though I'm just glad the help menu is no longer opening.

 

Did you get a chance to see why the help menu is opening in the other Custom I created called (ing-setup.lsp),

I'm new to this and use the vlisp in ACAD2015 it says all is good but still the help menu opens on this one.

 

I couldn't find any extra "" as you did mabe I'm just looking to hard.

🙂

 

0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

@Yahamahog wrote:

Can any one help with my lisp as it seems to work but the help menu opens after I run it?


I didn't notice any extraneous Enters that might do that, but it could be that the problem is something in one of the   e n o r m o u s   q u a n t i t i e s   of (if) functions for all those different settings based on all those different scales.  The LISP in AutoLISP stands for LISt Processing, and the programming language is built to be good at that, and I would suggest doing those things with lists, which will greatly reduce the amount of code, and eliminate any glitch if one of those repetitive items has an error in it.  You can keep everything up to:

...

(setvar "userr3" scale)

... and following that, make some lists and have it work from those, assigning the corresponding value from one list based on the position of the scale value in another, or in some cases based just on the scale value itself, something like this:
(if (> scale 1)

  (setvar "userr5"

    (nth

      (vl-position scale '(1 24 32 48 64 96 128 192 120 240 360 480 600 720 1200)); position index

      '(0 0.6667 0.7576 1 1.25 1.5 2.25 3 1 2 3 4 5 6 10); find value at that position here [0 in front is just a place-holder]

    ); nth

  ); setvar

); if
(command "dimstyle" "r" (strcat "ie-" (itoa scale) "-arrow")); one style name concatenation for any scale
(setvar 'textsize (* scale 0.09375)); one height calculation for any scale
(command

  "insert" "h:/2015-ACAD/01-SETUP/MEPlayers"....

... and continue from there [you can fold all those commands into one combined (command) function, which will reduce the code further].

 

It should also speed it up, because as you have it, it will go through every (if) function and test for whether that's the scale, even after it has found the applicable one.  That's a use for (cond) in place of (if), which will stop looking as soon as it finds the right one, but that would still take a lot more code than the above.

Kent Cooper, AIA
0 Likes