Jump to content

Recommended Posts

Posted

One of the difficulties (due to being a beginner) that I have in the preparation of my simple routines, is the ignorance of the arguments associated with each command of AutoCad.

For example: (command "line" pnt1 pnt1). Of course, if the "command line" do not have this difficulty, but unknown to many others.

Can someone provide this list, or know for a location where I can get this information?

It would be a good help.:)

Posted

Autocad commands within a lisp routine are commonly known as Macro.

Macro is a script that instructed the computer to perform a series of commands.

 

You supply an argument based on the requirements on the native commands as if typing from your keyboard like in your example

(command "_line" pnt1 ptn2)

Line commands requires a pick point or a point list. so its either you supply a given point list '(1.0 2.0 0.0)

(command "_line" '(1.0 2.0 0.0) '(2.0 5.0 0.0) "")

 

pass a point value variable

(command "_line" pnt1 ptn2 "")

 

or pick on the screen (getpoint) while inside the command line.

(command "_line" (getpoint) (getpoint "\nNext point:") "")

 

Therefore, if you calling "Layer" command to create a layer.

(command "_Layer" "M" [here you naturally supply a string for layer name] "" "")

 

So with (setq ln (getstring "\nEnter Layer name: "))

 

(command "_Layer" "M" ln "" "")

 

Anyhoo. HTH

Posted
Autocad commands within a lisp routine are commonly known as Macro.

 

I'm inclined to disagree with you; for me, a macro uses scripting language, and may (but not necessarily) contain LISP / DIESEL e.g.:

 

^C^Cline;\\;

Full Macro Documentation may be found here:

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS73099cc142f4875513fb5cd10c4aa30d6b-7d0a.htm,topicNumber=d0e373828

Posted
I'm inclined to disagree with you; for me, a macro uses scripting language, and may (but not necessarily) contain LISP / DIESEL e.g.:

 

 

:lol: OK.. script? Shortcuts?

Posted

If you're trying to develop a routine (whether it's a script, macro, or LISP!!) try simply working through the command as you normally would do and making a note of what appears on the command line. In your original example of drawing a line the command line shows up something like:

 

Command: l
LINE Specify first point:
Specify next point or [undo]:
Specify next point or [undo]:

 

So you know you need to use (COMMAND "LINE") and supply a number of points.

 

HTH

dJE

  • 7 months later...
Posted

Guys i think you are missing the point of the OP

I you are having a problem i may be becasue line is an open ender command you have to terminate it.

(command "line" pnt1 pnt2 "")

check to see that pnt1 & pnt2 are in the right format.

i would prefer to use dxf code rather than a command to create a line

(entmake (list '(0. "LINE')
                 (cons 10 pnt1)
                 (cons 11 pnt2)
                                  ))

Posted

A huge amount of the commands can be done as "command" you do sometimes have to remember to add extra "" for enters, the other thing you can do is do things also mid command like where you work out next thing to do based on the user input was it Y or N.

 

I would skip entmake and go to Vl-addline this is where programming is heading. probably make a generic defun (myaddline)

 

[b](setq mspace (vla-get-modelspace thisdrawing))
[/b]
[b](setq util (vla-get-utility(vla-get-activedocument (vlax-get-acad-object))))
[/b]
[b](setq PT1 (vla-getpoint util nil "\nSpecify First Point : "))

(setq PT2 (vla-getpoint util PT1 "\nSpecify Second Point : ")) ; this will drag a line from pt1

[color=#ff0000](setq myline (vla-addline mspace PT1 PT2))[/color]

[/b]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...