Jump to content

Script vs Macros vs Diesel vs Lisp


Guitte

Recommended Posts

Hi all,

 

 

Having done some research I end up more confused. Knowing nothing of programming at this point. All I know is that these in the title bar are use for programming or creating commands and that Lisp doesn't work for AutoCAD LT, therefore you have to use Macros. How do you determine when to use which command/programming feature? :wacko:

 

 

Kind Regards,

Guitte

Link to comment
Share on other sites

Here is a link to a brief article concerning scripts (what they are and how they can be used). Scripts work well when batching processing a large number of files. A well written and thoroughly tested script can be set up to run unattended.

 

http://www.cad-notes.com/learn-how-to-write-command-scripts-for-autocad-and-automate-your-plotting/

Link to comment
Share on other sites

I haven't tried my script, find it too empty than Paul's. He has allot of extra line's where mine only have 3-4 lines. Mine doesn't specify page A1, A2 or A3 etc. only dimensions, he has a lot of "y", "n" and "l", scale and axis, nothing of that on mine. Ill check also the similar threads showing below. This link helps allot.

Link to comment
Share on other sites

You are talking about a plot script just do this -plot Y then you will see where all the yes no comes from you must do in correct order. Write them down ! to suit your plotting.

Link to comment
Share on other sites

Thank you BIGAL, its showing all the other things that didn't show previously. What is the purpose or the meaning of the "-" in front of every command? Both "-Plot", "-Purge" gives you more than just "plot", "purge".

Link to comment
Share on other sites

Scripts don't work with commands that utilize dialog boxes. The dash in front forces the command line version of the plot and purge commands to be used instead.

Link to comment
Share on other sites

I'm plotting to PDF, this is how my script turns out. Im not sure at the end, how to write a script to save PDF format to my Desktop? I don't think, when I write a script to save under a specific project will work, cause it will save all your work even your future work in the project folder I have used for the script. Unless you chance your script constantly to folder you are working in? I think it gives a better chance for your script to get corrupted?

-PLOT

y

doPDF v7

A3

M

L

N

W

F

C

Y

monochrome.ctb

Y

As displayed

y

y

Y

Plotting viewport 2.

Automatic save to C:\Users\marguitte\appdata\local\temp\FP003 Zone 05 wblock_1_1_1635.sv$ ...

Link to comment
Share on other sites

This is a lisp version but you can see "pdfname" in the sequence, the question has been rasied before not long ago about the filename to save on desktop do a search here for Desktop, something simple like \\Desktop\filename

 

(COMMAND "-PLOT"  "Y"  "" "dwg to Pdf"
       "Iso full bleed A3 (420.00 x 297.00 MM)" "m"    "LANDSCAPE"  "N"   "W"  "-6,-6"    "807,560" "1=2"  "C"
       "y"   "Designlasercolour.ctb" "Y" "n"    "n"    "n"   pdfName "N" "y"      )
   )

Link to comment
Share on other sites

Just for interest and for those like me that needs a starting point with Macro's or Diesel I came up with the following threads.

 

 

I will try both Diesel and Macro to find out the differences and which is the best to understand and use.

 

 

Not sure if Macro's or Diesel's symbols change with every new Autodesk suite that's on the market.

 

 

 

 

ReMark's Thread - 6th Sept 2013.

 

 

"Learn to write your own by reading "How to Write a Diesel Macro" by Ralph Grabowski.

 

http://www.upfrontezine.com/tailor/tailor17.htm

 

Diesel Programming Examples.

 

http://www.crlf.de/Dokumente/Diesel/Diesel5.html

 

Diesel Programming in AutoCAD LT.

 

http://thecadprogcp.blogspot.com/200...utocad-lt.html

 

How to Automate AutoCAD with Command Macros.

 

http://www.cad-notes.com/2012/03/how...ommand-macros/ "

 

 

 

 

This makes a lot of sense what symbols represent which command:

 

 

Stormcrow Thread - 14th April 2008

 

 

The macro is built up with things we call Special Control Characters.

Here you can find a list of the most used special macros (thanks to Alan Cullen)

 

; Issues ENTER

^M Issues ENTER

^I Issues TAB

[blank space] Enters a space; a blank space between command sequences in a command is equivalent to pressing the SPACEBAR

\ Pauses for user input (cannot be used with accelerators)

_ Translates AutoCAD commands and options that follow

=* Displays the current top-level pull-down, shortcut, or image menu

*^C^C Repeats a command until another command is chosen

$ Introduces a conditional DIESEL macro expression ($M=)

^B Turns Snap on or off (equivalent to CTRL+B)

^C Cancels a command (equivalent to ESC)

^D Turns Dynamic UCS on or off (equivalent to CTRL+D)

^E Sets the next isometric plane (equivalent to CTRL+E)

^G Turns Grid on or off (equivalent to CTRL+G)

^H Issues BACKSPACE

^O Turns Ortho on or off

^P Turns MENUECHO on or off

^Q Echoes all prompts, status listings, and input to the printer (equivalent to CTRL+Q)

^T Turns tablet on or off (equivalent to CTRL+T)

^V Changes the current viewport

^Z Null character that suppresses the automatic addition of SPACEBAR at the end of a command

* Is a Wildcard

, Is used to separate different things, as you can see in the examples below.

 

Enable all layers: '-la;on;*;;

Unlock & Thaw all layers: '-la;u;*;;'-la;t;*;;

Disable all layers: '-la;off;*;y;;

Export a drawing to another file (wmf): _export;;

 

Once you completed all the fields, click “Edit” on the right to start creating an Icon

Link to comment
Share on other sites

just to add a sample, here is the script I use for PDF output.

plot
y
Model
DWG to PDF.pc3
ISO full bleed A3 (420.00 x 297.00 MM)
m
l
n
e
F
C
y
STL Mono.ctb
y
AS
"p:\Design_Office\AP XXX MODULES & CABLES\AP Modules - AP021 Labels.PDF"
n
y

I haven't managed to get a button to work as I can't find a way to supply the file name. I build my scripts outside of AutoCAD using a script generation routine I wrote. I think LeeMac has something similar. (Although knowing Lee, considerably better.)

 

I'm not pure why PLOT rather than -PLOT works here but it looks like it invokes the -PLOT command for the "y" answer to have any affect.

 

the "AP Modules etc." line is used twice (one I edited out) and is supplied by my script generator routine. It opens the drawing and plots it to the same folder it is openned in.

Link to comment
Share on other sites

and this is my button script

^C^C-PLOT;Y;;PDFcreator;A3;M;L;N;E;F;0,0;Y;STL Mono.ctb;Y;N;N;N;Y

but as I said above will ask what the file name is to be so not useful in a batch process.

 

In answer to your previous question, most commands have a - equivalent, but not all. Some of the newer commands don't and they can be quite difficult to get to work. I haven't found a way to script the find & replace that is now included in AutoCAD (but I can do it in VBA).

Link to comment
Share on other sites

dbroada,

Earlier I have seen something about VBA, but haven't read about it yet. I'm so tempted to try this, also sh.. scared that I might screw my PC up (Warning: I am a natural at this, without even trying) and don't know how to fix it... unless debug works 120% ,an extra 20% safety factor. If you look at my script on thread #8 at the end "Automatic save to C:\Users\marguitte\appdata\local\temp\FP003 Zone 05 wblock_1_1_1635.sv$ ..." if I replace it with "Automatic save to C:\Users\marguitte\desktop\FP003.sv$" do you think this script might be good enough for AutoCAD to understand? Thinking about it, I'm not sure if it will work because, every drawing that is pdf will have the same "file name". For example in this case I'm working currently on project FP003, the next project will be called FP005. If the script is written for FP003 then FP005 pdf drawings will have the script name of FP003?

Link to comment
Share on other sites

dbroada,

If you look at my script on thread #8 at the end "Automatic save to C:\Users\marguitte\appdata\local\temp\FP003 Zone 05 wblock_1_1_1635.sv$ ..." if I replace it with "Automatic save to C:\Users\marguitte\desktop" do you think this script might be good enough for AutoCAD to understand?

Short answer is no, that is a reply FROM AutoCAD to you, not a command TO AutoCAD. You can't drive it the other way. Besdies, the .sv$ shows that it is an automatic save file, not a dwg file.

 

Have a look at this from Lee Mac, I'm not sure if it will help you here but it might give you more clues. http://www.lee-mac.com/scriptwriter.html

Link to comment
Share on other sites

VBA isn't supported in LT either. You are stuck with Macro's or scripts, unless you feel really adventurous, then you can try using excel VBA to create scripts (if you have excel), but it will still only create a script.

Link to comment
Share on other sites

Hi Steven-g,

 

 

Thanks. For now I'll rather be stuck with Macro's and script, seems this is where beginners start. Will be adventurous when I'm a pro in macro's and scrip's. :)

Link to comment
Share on other sites

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...