Jump to content

Batch PasteClip


subodh_gis

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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" 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"  )

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

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