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

Load lisp with another lisp (or script) with predefined sub-settings

5 REPLIES 5
Reply
Message 1 of 6
miroko
502 Views, 5 Replies

Load lisp with another lisp (or script) with predefined sub-settings

Hello,

 

There is a lisp program. This lisp program - lets call it main_program - works in such a way that you can either

preselect objects and then start main_program or first start main_program and then select objects.

 

After this is done you are prompted for additional options. Shortcuts to additional options and selection of sub-setting is by following shortcuts:

E

N

O

N

P

Y

 

In other words when i use this main_program i always specify in command line all those commands and accepting them with 'enter'.

 

Is there a way to create a lisp or script (lest call it starting_program) which would do it without having to

everytime specify those options?

 

The problem is that one never know if person will first start command and then select objects or if will do it the

other way around.

 

I could use script easily, loading the lisp and then all those commands one after another. But i dont know how to make lisp or script which will know if objects are already selected or not and then proceed to the options/settings which are done by the comamnds E N O N P Y

 

regards

miroko

5 REPLIES 5
Message 2 of 6
Kent1Cooper
in reply to: miroko

If I understand what you are trying to do, I think you should be able to do it something like this:

 

(setq ss

  (cond

    ((ssget "_I")); there is a pre-selection

    ((sssget)); there isn't, so ask the User to select things

  ); cond

); setq

 

Then go on to your options, etc.  [But I don't think you can have two options with the same initial-letter shortcut, or you'll never be able to use the second one.]

Kent Cooper, AIA
Message 3 of 6
miroko
in reply to: Kent1Cooper


@Kent1Cooper wrote:

If I understand what you are trying to do, I think you should be able to do it something like this:

 

(setq ss

  (cond

    ((ssget "_I")); there is a pre-selection

    ((sssget)); there isn't, so ask the User to select things

  ); cond

); setq

 

Then go on to your options, etc.  [But I don't think you can have two options with the same initial-letter shortcut, or you'll never be able to use the second one.]


Hello,

 

Thank you for your time.

 

I must say honestly that my knowledge in lisp is limited therefore i dont know how to use string which you provided.

 

As for the options it is such that lisp has three main options:

Explodable blocks  -  Yes/No

Overkill  -  Yes/No

Proxies  -  Yes/No

 

Sorry for bein not clear enough. This is the 'superflatten' function which i found somewhere on forum.

The best would be if the 'starting_program' would load the 'main_program' and then check if the objects are already selected or not and then proceed to options where it would autiomatically set the above options to 'Yes' or 'No'.

 

Hope now it is more clear.

 

 

regards

miroko

 

Message 4 of 6
miroko
in reply to: miroko

Hello

 

Is there possibility to make it work?

 

regards

miroko

Message 5 of 6
Kent1Cooper
in reply to: miroko


@miroko wrote:

.... 

Is there possibility to make it work?

....


Without downloading SuperFlatten and trying it out, I'm not positive, but I think it can be tricky, or maybe impossible, in a Lisp routine, to feed option answers into a routine that's not a native AutoCAD command.  I don't think (command) can do it.  I think a Script can do that, but it may not be possible in a Script to ask for selection only if there isn't a pre-selection.  That's a Lisp kind of thing to do, as in my first Reply.*  While I know you can incorporate some kinds of Lisp expressions into Scripts, it may be that you can't use any that require User selection, much less one that may or may not require User selection.  At least, I don't know how to do it, and a few experiments I tried haven't worked.  Maybe someone else out there knows a way.  But if I come up with anything, I'll be back.

 

* My first reply used a bad function name -- the (sssget) there should have only two S's in it.

Kent Cooper, AIA
Message 6 of 6
miroko
in reply to: Kent1Cooper

Hello,

 

Thank you for answer.

 

Here is place where i took this lisp from:

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Superflateen-lsp-Help/m-p/2134313/hig...

 

 

Best regards

miroko

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

Post to forums  

Autodesk Design & Make Report

”Boost