Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autocad Commands as LISPs

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
611 Views, 6 Replies

Autocad Commands as LISPs

Is there a list of the commands of AutoCAD but written out as LISPS? Say if I wanted to make a LISP for "INSERT", I could find out the exact lines of code that AutoCAD uses for their commands? 

6 REPLIES 6
Message 2 of 7
fatal.error
in reply to: Anonymous

There's no need to re-code the already available AutoCAD commands.

Just use the command function to send and an AutoCAD command directly to the AutoCAD Command prompt.

 

It has a variable-length argument list. These arguments must correspond to the types and values expected by that command's prompt sequence; these may be strings, real values, integers, points, entity names, or selection set names.

Data such as angles, distances, and points can be passed either as strings or as the values themselves (as integer
or real values, or as point lists). An empty string ("") is equivalent to pressing the Spacebar or Enter on the keyboard.

 

The following code fragment shows representative calls to AutoCAD circle command:

 

(command "circle" "0,0" "3,3")

(setq p1 '(1.0 1.0 3.0))
(setq rad 4.5)
(command "circle" p1 rad)

 

 

For further information, please refer to the AutoLISP Developer's Guide (page 42).

 

Lastly, there is a dedicated Visual LISP, AutoLISP and General Customization forum.

Message 3 of 7
Moshe-A
in reply to: Anonymous

@Anonymous  hi,

 

you want to write a lisp command to insert one of your blocks?

here is an example to insert a block (with no attributes):-

 

(if (setq p0 (getpoint "\nSpecify insertion point: ")

 (command "insert"

                      "BlockName" ; replace it with your block name

                      p0                   ; insertion point

                      1                      ; XScale factor

                      1                      ; YScale factor

                      0                     ; Rotation angle

 ); command

); if

 

Does this helped?

 

Moshe

Message 4 of 7
Anonymous
in reply to: Moshe-A

I want the insertion dialog box that comes up when you do an "insert" command by itself to pop up instead if having to type in the block name. I like being able to look through the folders on the computer.

Message 5 of 7
Moshe-A
in reply to: Anonymous

@Anonymous  hi,

 


@Anonymous wrote:

I want the insertion dialog box that comes up when you do an "insert" command by itself to pop up instead if having to type in the block name. I like being able to look through the folders on the computer.


then i do not understand what do you want to do with autolisp? INSERT command will do exactly what you want.

 

Message 6 of 7
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

I want the insertion dialog box that comes up when you do an "insert" command by itself to pop up instead if having to type in the block name. I like being able to look through the folders on the computer.


If you mean that you want to call the Insert command in an AutoLisp (command) function, but also want to have the dialog box [which is normally suppressed when inside a (command) function], precede the (command) function with (initdia), which INITializes the DIAlog box for the command immediately following [read about it in Help]:

(initdia)

(command "_.insert" ....

 

I haven't used that with Insert, and don't have AutoCAD running to try it, so you may need to experiment with what is needed in the (command) function to follow up after the dialog box closes.

Kent Cooper, AIA
Message 7 of 7
dgorsman
in reply to: Anonymous


@Anonymous wrote:

Is there a list of the commands of AutoCAD but written out as LISPS? Say if I wanted to make a LISP for "INSERT", I could find out the exact lines of code that AutoCAD uses for their commands? 


 

AutoCAD is not written in LISP.  There is no direct equivalent in LISP, aside from calling the native command.  There are a few ways to do something similar, including the (command ...) calls already mentioned.  There's methods in LISP to select files (with a different dialog box), you can also create your own dialog with DCL.  There's methods to insert the block which approximates the native command.  But there's no 'standard' set of code - you build what you are capable of, to satisfy the requirements you have.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report