MarcoW Posted April 19, 2010 Posted April 19, 2010 Hi there, I have saved all my blocks to a specific folder. If you open one it is all lines / circles / etc. + attribute definitions. As it should be... I would like to make some kind of batch operation that does following: 1. Select folder with *.dwg (blocks) 2. Select output folder where the BMP is stored For each drawing: 3. Open drawing 4. Set background to color any RGB color (ie. 254,252,240) (or that I can do manually before processing all dwg's) 5. Erase all attribute definitions 6. Select all entities in drawing 7. Convert all entities to Pline 8. Set all entities Pline with to 0.2mm 9. Change color of all entities to black 10. Rectancle from (getvar "extmin") to (getvar "extmax") 11. Scale the rectangle from mid between (getvar "extmin") - (getvar "extmax") factor 25 12. BMP out all (name = dwgname.bmp) 13. CLose without save! next dwg.... The result is a folder with all BMP's of the blocks. These images can be used when making toolpalettes etc. The background and pline changes are needed to keep the bmp clear. This is my start but I got several problems right away, like "how to filter only for the attribute definititons" and how to use the BMPOUT command since the -BMPOUT does not work... (defun c:b2b ( / ) (setq Attributes (ssget "X" '((0 . "[color=red]INSERT[/color]"))) ) (command "_.erase" Attributes "") (command "_.zoom" "e") (setq LowerLeft (getvar "extmin") UpperRight (getvar "extmax") ); end of setq (command "_.rectangle" LowerLeft UpperRight) (command "_.scale" "_L" "" "m2p" LowerLeft UpperRight "30") (princ) ); end of defun (princ) The red part is wrong for shure, but there is no filter for attribute definitions I believe. Any help / thoughts are much appreciated. Quote
MSasu Posted April 20, 2010 Posted April 20, 2010 Use the below code to select all attributes defined in drawing (stand-alone, that aren't included in block definitions): (setq Attributes (ssget "X" '((0 . "ATTDEF")))) Regards, Quote
MSasu Posted April 20, 2010 Posted April 20, 2010 Regarding the BMPOUT command try to set the FILEDIA system variable on Off (0) to ensure dialog on prompter. Don’t forget to restore it just after: (setq OldFileDia (getvar "FILEDIA")) ;retain current state (setvar "FILEDIA" 0) ;enable dialog on prompter (command "_BMPOUT" MyPathForBMP MySelectionSet) (setvar "FILEDIA" OldFileDia) ;restore previous state Regards, Quote
fuccaro Posted April 20, 2010 Posted April 20, 2010 Long time ago I wrote a Lisp to batch purge my drawings. It can be modified to suit your needs. See here. Quote
MSasu Posted April 20, 2010 Posted April 20, 2010 To list, respectively modify the background color of Model tab by AutoLISP use the code below: (vl-load-com) (setq theModelBackground (vla-get-GraphicsWinModelBackgrndColor (vla-get-Display (vla-get-Preferences (vlax-get-acad-object))))) (vla-put-GraphicsWinModelBackgrndColor (vla-get-Display (vla-get-Preferences (vlax-get-acad-object))) theModelBackground) Regards, 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.