subodh_gis Posted May 27, 2014 Posted May 27, 2014 We have some drawings already made now we like to paste our logo image in all of them. Can we paste a single image in multiple drawings on fix location with fix scale and rotation without opening all the Drawing. Like batch processing or using lisp.. Quote
Dave^ Posted May 27, 2014 Posted May 27, 2014 In Notepad... open "C:\\path\to\drawing\drawing1.dwg" -insert "C:\\path\to\logo\logo.jpg" (you'll have to experiment with the options that follow - run "-insert" from the command line within autocad to check what works etc) qsave qclose open "C:\\path\to\drawing\drawing2.dwg" ... Once you built the script, save it somewhere, with the .scr extension, then type scr in the commandline within autocad, browse to your new .scr file and it will run. Not perfect, I'm not infront of a cad pc at the minute, but should give you a starting point to build on. MAKE SURE YOU TEST BEFORE RUNNING ON LIVE DRAWINGS, SAVE A COPY SOMEWHERE FIRST!!! Quote
BIGAL Posted May 28, 2014 Posted May 28, 2014 This has been mentioned many times but again, 2 ways to make your dwg list www.Lee-mac.com has a script writer program realy good. The other way is to get the dwg list via CMD bottom left go to correct directory and do dir *.dwg /b > dirlist.txt a list of all the dwgs will be in dirlist.txt. Using word you can search for end of line ^p use this to make rest of script using search & replace, must save as txt file not doc. dgw1 dwg2 replace ^p ^popen now open dwg1 open dwg2 replace ^p imageattach "C:\\path\to\logo\logo.jpg" "0,0" 1 0 close "Y" now open dwg1 imageattach "C:\\path\to\logo\logo.jpg" "0,0" 1 0 close "Y" open dwg2 imageattach "C:\\path\to\logo\logo.jpg" "0,0" 1 0 close "Y" Quote
subodh_gis Posted May 28, 2014 Author Posted May 28, 2014 Thanks for reply. i learned may things from http://www.Lee-mac.com about scripting. but i am facing problem in pasteclip and i don't know how to copy a image from window in scripting. i heard something "shell" but it is not working. Actually I want to copy a image from my window folder and pasteclip in many files of autocad in fix insertion point fix scale and 0 rotation. Quote
BIGAL Posted May 28, 2014 Posted May 28, 2014 Did you read my post ? You just save the jpg somewhere on your hard disk you can make the script simpler and I will again make an offer as a answer. I insert around 40 images in one go as a staff directory for the company all automatic. this is script open dwg1 (load "myinslogo") close y open dwg2 (load "myinslogo") close y open dwg3 (load "myinslogo") close y ; this is code for myinslogo.lsp put somewhere in your search path. (setvar "Ctab" "Model") (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq name "C:\temp\yourlogo.jpg" ) (setq inspt (list x y)) ; put your x y inspoint here (vla-AddRaster mspace name inspt 1.5 0.0) ; scale & rotation change 1.5 & 0.0 Quote
subodh_gis Posted May 28, 2014 Author Posted May 28, 2014 error: bad function: 1033.0 this is script open "C:\Users\subodh\Desktop\Sign pro\Manchitra_Patna\Phulwari_1_1_Panapurtofir_Ka_Kha_Ga.dwg" (load "myinslogo") close y this is myinslogo.lsp (setvar "Ctab" "Model") (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq name "F:\cadastral 2014\cadastral docs\sgnm.jpg" ) (setq inspt (1033.0 289.0)) ; put your x y inspoint here (vla-AddRaster mspace name inspt 0.3 0.0) ; scale & rotation change 1.5 & 0.0 Quote
Lee Mac Posted May 28, 2014 Posted May 28, 2014 You can use this program: Copy to Drawings [ Thank you for the recommendation BIGAL ] Quote
BIGAL Posted May 29, 2014 Posted May 29, 2014 Thought bracket may be problem try this (setq name "F:/cadastral 2014/cadastral docs/sgnm.jpg") or (setq name "F://cadastral 2014//cadastral docs//sgnm.jpg" ) Quote
Dave^ Posted May 29, 2014 Posted May 29, 2014 Put the image in the correct position within the first drawing. Copybase with a basepoint of 0,0,0. Pastebase into all other required drawings with a basepoint of 0,0,0. The above can be put in a script or a lisp. Quote
BIGAL Posted May 30, 2014 Posted May 30, 2014 This is a insert image on multilple layout pages within a dwg for you just remove the code asking for a date. I can not see what the problem is with just saving the image to disk first. ; Put co-ordinators sig on plans (vl-load-com) (setq layold (getvar "clayer")) (setvar "clayer" "TEXT") (setvar "imageframe" 0) (setvar "textstyle" "standard") (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (SETVAR "LUNITS" 2) ; decimal (setvar "aunits" 0) ; dec degrees (SETVAR "ANGBASE" 0.0) ; north up (SETVAR "ANGDIR" 0) ; clockwise (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plotabs (cons (vla-get-name lay) plotabs)) ) (setq plottablist (acad_strlsort plotabs)) (setq len (length plottablist)) (setq x 0) (setq ans (getstring "\n Please enter date of signing..")) (setvar "textstyle" "standard") (repeat len (setq name (nth x plottablist)) (princ name) (if (/= name "Model") (progn (setvar "ctab" name) ;(setvar "imageframe" 0) ; (command "-CHANGE" "L" "" "P" "TR" "0" "") ; change transparency (command "-Insert" "P:/BIGAL" "439,15" 1 "" 0) (setq ts (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE"))))) (if (zerop ts) (command "TEXT" "498,18" "3.5" "0" ans) (command "TEXT" "498,18" "0" ans) ) ) ) (setq x (+ x 1)) ) (setvar "clayer" layold) (setvar "osmode" oldsnap) (setq len nil plotabs nil plottablist nil) (princ) 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.