Barneel Posted April 25, 2014 Posted April 25, 2014 Can somebody help me out with learning macros? I've been fiddling around with them on a basic level for a while now, but I was hoping somebody could help me understand how to do an instant automated print. I looked on a few websites and they all sort of just force-fed the final result rather than explaining it, which meant I couldn't manipulate it to do what I wanted. Below is the macro I ended up with after attempting to manipulate it myself (but it doesn't work). Can anyone help me get it working? And explain what I've done wrong and how to avoid it in future? ^C^C-plot;y;;\\SBS2008\OKI ES8460 MFP;A3 297 x 420 mm ;m;l;n;l;1:1;0.00,0.00;y;monochrome.ctb;y;n;n;n;;n;y; Attached are the plot settings I'm trying to achieve Thanks Quote
MSasu Posted April 25, 2014 Posted April 25, 2014 Just call -PLOT command (please note the hyphen, it will run in prompt mode), choose Detailed Configuration and write down the answers to prompts; use these to built the script, separated by ";" or spaces. Quote
ReMark Posted April 25, 2014 Posted April 25, 2014 A macro uses the command line version of an AutoCAD command along with the standard input the user would type in. In your case the plot command is being invoked and everything that AutoCAD needs to know about plotting your drawing has to be answered by you before the macro will work. What is it that you would like to do that you are having trouble with? What plot parameters do you wish to follow? Quote
Barneel Posted April 25, 2014 Author Posted April 25, 2014 Thanks for your responses! That's a really good tip MSasu! I followed through the command and came up with this: ^C^C-plot;y;;\\SBS2008\OKI ES8460 MFP;A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;N;A;n;n;y; However it seems to be getting stuck at the Plotter name stage: "\\SBS2008\OKI ES8460 MFP" Probably because of the backslashes. It works when I enter it manually however. Is there a way to force quote this? Thanks Remark, MSasu answered 95% of what I wanted in 1 sentence! This is what I'm trying to achieve step by step: -Plot Detailed: Y Layout name: ; Output device name: \\SBS2008\OKI ES8460 MFP Paper Size: A3 297 x 420 mm paper units: millimeters Drawing Orientation: Landscape Upside down?: N Plot Area: Extents Plot Scale: Fit Plot offset: Center Plot styles?: Y Plot style: monochrome.ctb Lineweights?: N Shade plot setting: As Displayed Write plot to file?: N Save changes to page setup? N Proceed with plot: Y Quote
ReMark Posted April 25, 2014 Posted April 25, 2014 (edited) Reverse the direction of the slashes? Edited April 25, 2014 by ReMark Quote
Barneel Posted April 25, 2014 Author Posted April 25, 2014 That didn't resolve the issue unfortunately EDIT: ^C^C-plot;y;;//SBS2008/OKI ES8460 MFP;A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;N;A;n;n;y; Quote
Barneel Posted April 25, 2014 Author Posted April 25, 2014 Off for the weekend now so will check back here Monday Thanks! Quote
MSasu Posted April 25, 2014 Posted April 25, 2014 I cannot test that, but please try to double the back-slashes: \\[color=magenta]\\[/color]SBS2008\[color=magenta]\[/color]OKI ES8460 MFP Quote
RobDraw Posted April 25, 2014 Posted April 25, 2014 Plot Area: Extents Plot Scale: Fit FYI, if you are trying to plot to a scale, this could lead to problems. Quote
BIGAL Posted April 26, 2014 Posted April 26, 2014 Compare the printer name pretty sure when doing this the spaces are removed in the name, in particular when using networks the \\ need to be done different. An example from this post (setq plottername "\\\\PRODPRN03\\100B........) note \\\\ & \\ http://www.cadtutor.net/forum/showthread.php?69132-Printing-LISP-Help...&highlight=Printing-LISP Quote
dbroada Posted April 26, 2014 Posted April 26, 2014 (edited) I will check on Monday but that is pretty much what I have. After a quick re-read, I think I have to put my printer name in quotes to get it to work but I will check if you haven't sorted it by then. One thing to be aware of though is SOMETIMES the answers you give on the command line are different to those given in a script/macro! One that has caught me out in a batch plot routine is the question asked about saving changes. One asks "Do you want to save changes" while the other asks "do you want to discard changes". If something looks odd press F2 and check the questions carefully. Edited April 26, 2014 by dbroada bit about quotes added Quote
Tyke Posted April 26, 2014 Posted April 26, 2014 As Dave said the quotes are important, you need to put the plotter name and sheet size all in quotes. A space in your macro is interpreted as a return. You must also replace back slashes with forward slashes. A backslash in a macro is a pause for use input. Quote
Barneel Posted April 28, 2014 Author Posted April 28, 2014 Hi, Thanks for all your replies. I have just had a go at everything mentioned here, as well as combinations of them. It still seems to be getting stuck on this step however. I'm fairly certain I have plotter name correct - selecting "?" on: "-Plot, Enter an output device name or [?]" provides a list of plot devices, and lists my printer as "\\SBS2008\OKI ES8460 MFP" If there is another way to check if this is correct please let me know! You are correct in saying backslashes make it pause for user input - I didn't know this. However replacing them with forwardslashes doesn't fix it. Attached is a screencap of F2, showing it is able to record the entire printer name (because it tells me /SBS2008//OKI ES8460 MFP> was not found), but is not able to use it. (Also, I'm aware I could just leave this step blank and let it select it as the default plotting device, but it won't always be the case that it is the default). Any further tips as to where I might be going wrong? I really appreciate all your help so far! Quote
dbroada Posted April 28, 2014 Posted April 28, 2014 (edited) I think you have too many \ in your first line. Its telling you the default (\\SBS2008\OKI etc.) but you have supplied //SBS2008//OKI etc. This is my button code... ^C^C-PLOT;Y;Layout1;EUGBHORPD026;A3 (297 x 420 mm);M;L;N;E;F;0,0;Y;STL Mono.ctb;Y;N;N;N;N;N;Y As you have seen, scripts just continue so if you get one bit wrong it continues until it gets an answer that fits - sometimes with bad results. I have just realised that that one looks for a .pc3 file so doesn't need the path to the printer. In my script files the line that calls the printer is "\\eugbhorfile003\EUGBHORPD026" Edited April 28, 2014 by dbroada didn't read my post well enough Quote
Barneel Posted April 28, 2014 Author Posted April 28, 2014 Well spotted. Unfortunately that still hasn't fixed it. Also tried it without the path: And without spaces without the path: Quote
dbroada Posted April 28, 2014 Posted April 28, 2014 (edited) have you tried it within quotes? I get way without quotes as I don't have spaces in the device name. "[url="file://\\SBS2008\OKI"]\\SBS2008\OKI ES8460 MFP[/url]"[url="file://\\SBS2008\OKI ES8460 MFP"] [/url] Edited April 28, 2014 by dbroada quote marks get deleted. :( Quote
Barneel Posted April 28, 2014 Author Posted April 28, 2014 I have tried it as follows: ^C^C-plot;y;;"OKI ES8460 MFP";A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;N;A;n;n;y; ^C^C-plot;y;;"OKIES8460MFP";A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;N;A;n;n;y; ^C^C-plot;y;;"OKI_ES8460_MFP";A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;N;A;n;n;y; I have also tried the above without quotes, with the path at the start, with "/" instead of "\" and a combination of these 3 variations. Any other thoughts? I'm determined to make this work! Quote
Barneel Posted April 28, 2014 Author Posted April 28, 2014 Interestingly if I type in \\SBS2008\OKI ES8460 MFP manually, it accepts it. Quote
Barneel Posted April 28, 2014 Author Posted April 28, 2014 Resolved! Re-read what you said about the command looking for a .pc3 and I realised my printer wasn't set up as a .pc3 file. So I set it up as a .pc3 file by going to C:\Users\"XXX"\AppData\Roaming\Autodesk\AutoCAD Electrical 2014\R19.1\enu\Plotters Then choosing "Add-A-Plotter Wizard", which creates a .pc3 file for the printer. Working macro below: ^C^C-plot;y;;SGT_PRINTY;A3 297 x 420 mm;M;L;N;E;F;C;Y;monochrome.ctb;Y;A;N;N;Y; Thanks for everyones help! EDIT: Slight alteration to Macro to allow for lineweights Quote
Recommended Posts
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.