ekko Posted February 27, 2022 Posted February 27, 2022 Masters, how to do it, take a screenshot in CAD, just a part of the selected area of the screenshot screenshot2022.dwg Quote
mhupp Posted February 27, 2022 Posted February 27, 2022 (edited) Snipping tool if your using windows. looks like their is also a command "jpgout" or "tiffout" in autocad. Edited February 27, 2022 by mhupp Quote
BIGAL Posted February 27, 2022 Posted February 27, 2022 Hold windowbutton+shift+S screen will dim pick area copied to clipboard, paste to say paint. Quote
Steven P Posted February 28, 2022 Posted February 28, 2022 18 hours ago, mhupp said: Snipping tool if your using windows. looks like their is also a command "jpgout" or "tiffout" in autocad. They're not something I use but tiffout and jpgout asks you to select objects or viewports rather than clipping an area like snippet tool does. I guess all depends what you want to do with the screenshot after what to do Quote
eldon Posted February 28, 2022 Posted February 28, 2022 AutoCAD only seems to do full screens. One can also export to WMF. For part screens, I use the Snipping Tool in Windows. Quote
ekko Posted February 28, 2022 Author Posted February 28, 2022 (edited) 21 hours ago, mhupp said: Snipping tool if your using windows. looks like their is also a command "jpgout" or "tiffout" in autocad. My idea is that when my lisp program runs and the conditions are met, the program prompts me, selects the area, and takes a screenshot and outputs. The operation is done in CAD instead of using another program, is this possible? thanks Edited February 28, 2022 by ekko Quote
ekko Posted February 28, 2022 Author Posted February 28, 2022 32 minutes ago, SLW210 said: See if THIS PREVIOUS THREAD helps. Thank you bro, this lisp program is close to what I want, but it can't select the area manually, is it possible to manually select the area and then take a screenshot? Quote
ekko Posted February 28, 2022 Author Posted February 28, 2022 14 hours ago, BIGAL said: Hold windowbutton+shift+S screen will dim pick area copied to clipboard, paste to say paint. My idea is that when my lisp program runs and the conditions are met, the program prompts me, selects the area, and takes a screenshot and outputs. The operation is done in CAD instead of using another program, is this possible? thanks Quote
mhupp Posted February 28, 2022 Posted February 28, 2022 (edited) Since the version of BricsCAD I have doesn't have jpgout command I can't test this. and its an extremely dumb down version of what @rlx posted. ;;----------------------------------------------------------------------------;; ;; SCREENSHOT (defun C:SS (/ f ss) (if (setq ss (ssget)) (progn (setq f (strcat (getvar 'dwgprefix) "\Screenshot.jpg")) ;saved to drawing location (setvar 'cmdecho 0) (command "_Zoom" "OB" SS "") (command "_Zoom" "O") (command "_jpgout" f SS "") (setvar 'cmdecho 1) ) ) (princ) ) Edited February 28, 2022 by mhupp Quote
BIGAL Posted March 1, 2022 Posted March 1, 2022 Why not just use -PLOT this can accept 2 pts etc. This is an example (COMMAND "-PLOT" "Y" "" "PublishToWeb JPG" "A4 400dpi" "PORTRAIT" "N" "W" pt1 pt2 "F" "C" "y" "Designlaser" "Y" "n" "n" "n" pdfName "N" "y") ) Quote
ekko Posted March 1, 2022 Author Posted March 1, 2022 (edited) 16 hours ago, mhupp said: Since the version of BricsCAD I have doesn't have jpgout command I can't test this. and its an extremely dumb down version of what @rlx posted. ;;----------------------------------------------------------------------------;; ;; SCREENSHOT (defun C:SS (/ f ss) (if (setq ss (ssget)) (progn (setq f (strcat (getvar 'dwgprefix) "\Screenshot.jpg")) ;saved to drawing location (setvar 'cmdecho 0) (command "_Zoom" "OB" SS "") (command "_Zoom" "O") (command "_jpgout" f SS "") (setvar 'cmdecho 1) ) ) (princ) ) (defun c:ss (/ ods pt1 pt2 patch nm ss) (setvar "cmdecho" 0) (setq ods (getvar "osmode")) (setvar "osmode" 0) (setq pt1 (getpoint "\nSelect the first point:") pt2 (getcorner pt1 "\nselect the second point:" ) ph (getvar 'dwgprefix) nm "Screenshot" ) (if (setq ss (ssget "w" pt1 pt2 '((0 . "lwpolyline,line,ARC")))) (progn (command "_Zoom" "OB" ss "") (command "_jpgout" (strcat ph nm) ss "") ) ) (command "_Zoom" "p") (setvar "osmode" ods) (princ "\ndone.") (princ (strcat "\nimage output path:" ph)) (princ) ) Brother, thank you very much for the code, obviously it works very well and is close to my needs. Now there is a question, how to control the size of the output image, I want its size to be in the range of pt1-pt2, please help me Edited March 1, 2022 by ekko Quote
mhupp Posted March 1, 2022 Posted March 1, 2022 4 hours ago, ekko said: Now there is a question, how to control the size of the output image, I want its size to be in the range of pt1-pt2, please help me Seems to output your Drawing Area and looking like you need to use @BIGAL method if you want to only output between pt1 and pt2 1 Quote
Steven P Posted March 1, 2022 Posted March 1, 2022 I have only been half following this so apologies if I am wrong. When I tried JPGOUT wasn't clipping objects to an area but would include all the selected object - there might be a setting in there somewhere to just output the selected area, I don't know. Now he mentioned it, makes more sense to plot to jpg, and then you can select only the required area, loads of example out there how to do that I reckon, Reason I was commenting, can you use (startapp ... ) or something similar to start the windows snip and sketch tool via a LISP ? Had a quick look but not too long to see if it is possible, you could use the snipping tool with (startapp "SnippingTool.exe") for example. What are you going to be doing with the screenshot once you have it by the way, there might be other way to get the result you want 1 Quote
BIGAL Posted March 1, 2022 Posted March 1, 2022 Ok as plot is set to fit selected out put size, you can control the pixel size of the jpg, a A1 24x36 will be in say Mb size, a A4 may be suitable, under Options Plot you can make your own jpg size. Try to use correct ratio check pc screen seetings. 2 1 Quote
ekko Posted March 2, 2022 Author Posted March 2, 2022 23 hours ago, BIGAL said: Why not just use -PLOT this can accept 2 pts etc. This is an example (COMMAND "-PLOT" "Y" "" "PublishToWeb JPG" "A4 400dpi" "PORTRAIT" "N" "W" pt1 pt2 "F" "C" "y" "Designlaser" "Y" "n" "n" "n" pdfName "N" "y") ) Unfortunately, when I enter the command (command "-plot" "y" "" "PublishToWeb JPG" ), there is no A4 400dpi in the drawing size option, so I can't follow up Quote
exceed Posted March 2, 2022 Posted March 2, 2022 (edited) This is a different story, this LISP outputs to WMF. You can edit this in EXCEL. (If it is a TrueType font, you can also edit the text.) and transparent background. This can specify the area as pt1 pt2, but either horizontally or vertically may be different as this scales the screen with zoom and prints with it. (defun C:EXCELIMAGE ( / *error* old_osmode startrange endrange p2 p4 ss filepath _opendirectory) (setvar 'cmdecho 0) (setq old_osmode (getvar 'osmode)) (setvar 'osmode 0) (setvar 'wmfbkgnd 0) (setvar 'wmfforegnd 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (setvar 'osmode old_osmode) (setvar 'cmdecho 1) (redraw) (princ) ) (if (and (setq startrange (getpoint "\n pick start point")) (setq endrange (getcorner startrange "\n pick end point")) ) (progn (setq p2 (list (car endrange) (cadr startrange)) p4 (list (car startrange) (cadr endrange)) ) (grvecs (list -1 startrange p2 p2 endrange endrange p4 p4 startrange)) ) ) (redraw) (princ) (setq ss (ssget "c" startrange endrange)) (sssetfirst nil ss) (setq filepath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".wmf")) (command "_.ZOOM" "w" startrange endrange) (command "_.REDRAW") (command "_.SELECT" "all" "") (command "_.WMFOUT" filepath) (princ "\n WMF output complete, Output Folder -") (princ (getvar "dwgprefix")) (princ " \n") (princ (vl-filename-base (getvar "dwgname"))) (princ ".wmf check this file.") (princ "\n you can insert this by insert > image > wmf extension") (defun _opendirectory (path / sa) (if (and (eq 'str (type path)) (findfile (vl-string-right-trim "\\" path)) (setq sa (vlax-create-object "Shell.Application")) ) (progn (vlax-invoke sa 'explore path) (vlax-release-object sa)) ) (princ) ) (_opendirectory (getvar 'dwgprefix)) (LM:endundo (LM:acdoc)) (setvar 'osmode old_osmode) (setvar 'cmdecho 1) (redraw) (princ) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc) ) ;; Start Undo - Lee Mac ;; Opens an Undo Group. (defun LM:startundo ( doc ) (LM:endundo doc) (vla-startundomark doc) ) ;; End Undo - Lee Mac ;; Closes an Undo Group. (defun LM:endundo ( doc ) (while (= 8 (logand 8 (getvar 'undoctl))) (vla-endundomark doc) ) ) ============================================== 4 hours ago, ekko said: Unfortunately, when I enter the command (command "-plot" "y" "" "PublishToWeb JPG" ), there is no A4 400dpi in the drawing size option, so I can't follow up if there's no A4 400dpi, that's just name of paper preset. you can edit this in normal PLOT command prompt can add that in PublishToWeb plotter setting, can add custom paper size (ex - 400px X 400px) and naming that also. when creating a lisp using "command", like this run "-plot" first, and add your input "~~" in order. Edited March 2, 2022 by exceed Quote
ekko Posted March 2, 2022 Author Posted March 2, 2022 1 hour ago, exceed said: This is a different story, this LISP outputs to WMF. You can edit this in EXCEL. (If it is a TrueType font, you can also edit the text.) and transparent background. This can specify the area as pt1 pt2, but either horizontally or vertically may be different as this scales the screen with zoom and prints with it. (defun C:EXCELIMAGE ( / *error* old_osmode startrange endrange p2 p4 ss filepath _opendirectory) (setvar 'cmdecho 0) (setq old_osmode (getvar 'osmode)) (setvar 'osmode 0) (setvar 'wmfbkgnd 0) (setvar 'wmfforegnd 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (setvar 'osmode old_osmode) (setvar 'cmdecho 1) (redraw) (princ) ) (if (and (setq startrange (getpoint "\n pick start point")) (setq endrange (getcorner startrange "\n pick end point")) ) (progn (setq p2 (list (car endrange) (cadr startrange)) p4 (list (car startrange) (cadr endrange)) ) (grvecs (list -1 startrange p2 p2 endrange endrange p4 p4 startrange)) ) ) (redraw) (princ) (setq ss (ssget "c" startrange endrange)) (sssetfirst nil ss) (setq filepath (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".wmf")) (command "_.ZOOM" "w" startrange endrange) (command "_.REDRAW") (command "_.SELECT" "all" "") (command "_.WMFOUT" filepath) (princ "\n WMF output complete, Output Folder -") (princ (getvar "dwgprefix")) (princ " \n") (princ (vl-filename-base (getvar "dwgname"))) (princ ".wmf check this file.") (princ "\n you can insert this by insert > image > wmf extension") (defun _opendirectory (path / sa) (if (and (eq 'str (type path)) (findfile (vl-string-right-trim "\\" path)) (setq sa (vlax-create-object "Shell.Application")) ) (progn (vlax-invoke sa 'explore path) (vlax-release-object sa)) ) (princ) ) (_opendirectory (getvar 'dwgprefix)) (LM:endundo (LM:acdoc)) (setvar 'osmode old_osmode) (setvar 'cmdecho 1) (redraw) (princ) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc_forrf 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc_forrf) ) ;; Start Undo - Lee Mac ;; Opens an Undo Group. (defun LM:startundo ( doc ) (LM:endundo_forrf doc) (vla-startundomark doc) ) ;; End Undo - Lee Mac ;; Closes an Undo Group. (defun LM:endundo ( doc ) (while (= 8 (logand 8 (getvar 'undoctl))) (vla-endundomark doc) ) ) Hello brother, my original idea was to output the screenshot to an excel sheet. Your code runs with an error message: no function definition: LM:ENDUNDO_FORRF Quote
exceed Posted March 2, 2022 Posted March 2, 2022 17 minutes ago, ekko said: Hello brother, my original idea was to output the screenshot to an excel sheet. Your code runs with an error message: no function definition: LM:ENDUNDO_FORRF oh, i edit that problem in original post. Quote
ekko Posted March 2, 2022 Author Posted March 2, 2022 4 minutes ago, exceed said: oh, i edit that problem in original post. I tried it, it is not the function I want, can you teach me how to import the screenshot from CAD to excel 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.