Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
43 Posts
0 Kudos
Registered: ‎02-05-2011
Post 1 of 4

LISP Help please

244 Views, 3 Replies
08-09-2012 10:38 AM

Hi all

 

I would like a LISP to do the equivilent of the following :

 

qselect .... 

 

Object : Space
Properties: Layer
Operatior: Wildcard

Value: *Mega*

 

Send to Back

 

Could anyone help me with the LISp for this thanks

Chris

 

Distinguished Contributor
404 Posts
3 Kudos
Registered: ‎12-08-2003
Post 2 of 4

Re: LISP Help please

08-09-2012 01:29 PM in reply to: haynesc87

Here might be a start. This would send anything on a layer beginning with "Mega" to the back.

(defun c:MegaStarToBack ()
(setq ss (ssget "x"
(list; begin filter
(cons 8 "Mega*")
);end filter
)
)
(command "draworder" ss "" "Back")
)

 

Active Contributor
43 Posts
0 Kudos
Registered: ‎02-05-2011
Post 3 of 4

Re: LISP Help please

08-13-2012 03:21 AM in reply to: tom_brabant

Hi thanks ...

 

what do the ")" ? mean? ...

 

if i open notepad what exactly do i need to type for the script to work ?

 

iv wrote a script before bujt iv never seen them look like this before ... normally mine look like :

 

VISRETAIN 0
-XREF R *

VISRETAIN 1

QSAVE

CLOSE

 

For example

Thanks

 

 

Distinguished Contributor
404 Posts
3 Kudos
Registered: ‎12-08-2003
Post 4 of 4

Re: LISP Help please

08-13-2012 07:47 AM in reply to: haynesc87

Everything from the "(defun" to the final ")" constitute an autolisp function definition. This particular function definition happens to add a new command to an autocad drawing session. I have reposted the contents at bottom, and shortened the new command's name to "tb" for convenience.
One of several ways to make it work is to:
1. Copy the contents and paste them into notepad and save the text file with a ".lsp" extension.
2. Then, in autocad, use the "appload" command to browse to the newly created file and load it into a drawing session.
3. Invoke the command by typing "tb" at the command line.

I might mention that appload also contains a "startup suite" so that frequently used files can be loaded into any drawing session automatically.

(defun c:tb ()
(setq ss (ssget "x"
(list; begin filter
(cons 8 "Mega*")
);end filter
)
)
(command "draworder" ss "" "Back")
)

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post