Lee Mac Posted August 24, 2009 Posted August 24, 2009 Is there an attribute inside your titleblock to be used as the layout name? And what is the block name of your titleblock? Quote
Biscuits Posted August 25, 2009 Posted August 25, 2009 Is there an attribute inside your titleblock to be used as the layout name? And what is the block name of your titleblock? X-REFBTITLE1 is our page one titleblock with a block inside called "DWGATTRIBUTES" using a tag called "PG1". This is to be assigned to layout "01". X-REFBTITLE2 is the name for all remaining titleblocks with a block inside called "DWGATTRIBUTES2" using a variety of tag names. (So much for CAD standards)to be assigned to layouts "02", "03", etc. It would probably be best to distinguish between these title blocks by the already assigned model named views "1", "2", etc. Therefore moving everything from View "1" to Layout "01", View "2" to Layout "02"etc. Hope this helps Quote
KLKSMILE Posted April 21, 2010 Author Posted April 21, 2010 Hi again! Your lisp routine has help so much!! I was wondering if you know of a way to take all the split up files and insert them all into one file? Quote
Lee Mac Posted April 21, 2010 Posted April 21, 2010 I haven't looked at the code in ages, I'll have to see what I can do. Quote
Lee Mac Posted April 21, 2010 Posted April 21, 2010 Firstly, here is a preliminary. I have rewritten the original code to hopefully make it much faster. It still has the same functionality, and cuts to separate files, but should be noticeably faster. Give it a try and we'll proceed from there: ;; Drawing Cutter V4, by Lee McDonnell 27.04.2009 ;; Updated ~ (Lee Mac) ~ 21.04.10 (defun c:DwgCut (/ *error* BLST CENT DENT DOC DSS ENT EXISTINGFILES FNAME ILST ISS LL N NME OBJ PATH SPC SS TMP TOFF UR WBSS WINLST) (setq tOff 0.9428) (vl-load-com) (defun *error* (msg) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq doc (vla-get-ActiveDocument (setq acadd (vlax-get-acad-object))) spc (GetActiveSpace doc)) (or (tblsearch "LAYER" "DATESTAMP") (vla-put-color (vla-add (vla-get-Layers doc) "DATESTAMP") acYellow)) (if (setq dSs (ssget "_X" '((0 . "*TEXT") (8 . "DATESTAMP")))) ( (lambda ( k ) (while (setq dent (ssname dss (setq k (1+ k)))) (entdel dent))) -1)) (vla-ZoomExtents acadd) (if (and (setq ss (ssget "_X" '((0 . "INSERT") (2 . "BORDER")))) (setq path (DirDialog "Select Location for New Files..." nil 0))) (progn (setq ExistingFiles (mapcar (function vl-filename-base) (vl-directory-files path "*.dwg" 1))) ( (lambda ( i ) (while (setq ent (ssname ss (setq i (1+ i)))) (vla-getBoundingBox (setq Obj (vlax-ename->vla-object ent)) 'll 'ur) (setq bLst (mapcar (function (lambda ( p ) (trans p 0 1))) (mapcar (function vlax-safearray->list) (list ll ur)))) (if (setq Nme nil iLst nil iSs (ssget "_C" (car bLst) (cadr bLst))) ( (lambda ( j ) (while (setq cent (ssname iss (setq j (1+ j)))) (setq iLst (cons (vlax-ename->vla-object cent) iLst)) (if (and (eq "TITLETEXT" (strcase (cdr (assoc 8 (entget cent))))) (vl-position (cdr (assoc 0 (entget cent))) '("TEXT" "MTEXT"))) (setq Nme (cdr (assoc 1 (entget cent))))))) -1)) (or Nme (setq Nme "Drawing1")) (setq tmp Nme n 1) (while (vl-position (strcase tmp) ExistingFiles) (setq tmp (strcat Nme "(" (itoa (setq n (1+ n))) ")"))) (setq Nme tmp fname (strcat path "\\" Nme ".dwg")) (setq iLst (cons (AddText spc (DStamp Nme) (polar (car bLst) pi (- tOff 0.86)) (/ pi 2.) "DATESTAMP") iLst)) (vla-Additems (setq WBss (MakeSelectionSet doc "wBss")) (MakeVariant iLst vlax-vbobject)) (vla-wBlock doc fname wBss) (vla-delete (itemp (vla-get-SelectionSets doc) "wBss")) (setq ExistingFiles (cons (strcase Nme) ExistingFiles)))) -1))) (princ)) (defun DStamp ( DWGName / toDate ) (defun toDate ( var format ) (menucmd (strcat "m=$(edtime,$(getvar," var ")," format ")"))) (strcat "DRFT: KLK FILE: " DWGName " DATE: " (strcase (toDate "DATE" "MON DD")) ", " (toDate "DATE" "YYYY") " TIME: " (toDate "DATE" "H:MM AM/PM"))) (defun DirDialog (msg dir flag / Shell Fold Path) ; Lee Mac ~ 07.06.09 (setq *acad (cond (*acad) ((vlax-get-acad-object)))) (setq Shell (vla-getInterfaceObject *acad "Shell.Application") Fold (vlax-invoke-method Shell 'BrowseForFolder (vla-get-HWND *acad) msg flag dir)) (vlax-release-object Shell) (if Fold (progn (setq Path (vlax-get-property (vlax-get-property Fold 'Self) 'Path)) (vlax-release-object Fold) (and (= "\\" (substr Path (strlen Path))) (setq Path (substr Path 1 (1- (strlen Path))))))) Path) (defun AddText ( block string point rotation layer / o ) (vla-put-rotation (setq o (vla-AddText block string (vlax-3D-point point) (getvar 'TEXTSIZE))) rotation) (vla-put-layer o layer) o) (defun GetActiveSpace (doc) (if (or (eq AcModelSpace (vla-get-ActiveSpace doc)) (eq :vlax-true (vla-get-MSpace doc))) (vla-get-ModelSpace doc) (vla-get-PaperSpace doc))) (defun MakeVariant (data datatype) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray (eval datatype) (cons 1 (length data)) ) data ) ) ) (defun Itemp (collection item / result) (if (not (vl-catch-all-error-p (setq result (vl-catch-all-apply (function vla-item) (list collection item) ) ) ) ) result ) ) (defun MakeSelectionSet (doc ref / SelSets SelSet) (if (setq SelSet (itemp (setq SelSets (vla-get-SelectionSets doc) ) ref ) ) (vla-delete SelSet) ) (vla-add SelSets ref) ) Quote
KLKSMILE Posted April 21, 2010 Author Posted April 21, 2010 Hi! Thanks!! Ok - so that new program works just fine...I didn't really notice that much of a difference in speed - they both split the the files up pretty fast. But everything works. Quote
Lee Mac Posted April 21, 2010 Posted April 21, 2010 Excellent - it would probably be more noticeable for larger files, but I'll give the inserting part a go. Quote
KLKSMILE Posted April 22, 2010 Author Posted April 22, 2010 You are correct...I tried it on a really large file and it makes a very noticeable difference....thanks!!! The inserting function would be so helpful too. Quote
Lee Mac Posted April 22, 2010 Posted April 22, 2010 About that - the program currently splits up all the different borders into separate files - I can't see the advantage of inserting them all back into one file again? Isn't this going backwards? Quote
KLKSMILE Posted April 22, 2010 Author Posted April 22, 2010 The reason it would be helpful is because when I am finished working on a project, I split the file up and have to submit the seperated files. When I have to do more work on that project, the customer gives me the files back with their modifications included and I can either open and work on each individual file one at a time, or I can copy all the contents of each file and paste them into one big file. Working in one file saves so much time. When I am through with the project I just use the dwgcut lisp again and re-submit the files. Quote
Lee Mac Posted April 22, 2010 Posted April 22, 2010 Ok, how about a separate program that takes all files in a directory and inserts them into the Active Drawing? Quote
Lee Mac Posted April 22, 2010 Posted April 22, 2010 Try this, it will include blocks in subdirectories as well. Insert All at Origin.lsp Quote
KLKSMILE Posted April 22, 2010 Author Posted April 22, 2010 How do I call up the lisp? If I try to type the name "Insert All..." the insert function box appears. Quote
KLKSMILE Posted April 22, 2010 Author Posted April 22, 2010 Ok, figured it out... insall It works great. Any way it could offset each file that it inserted so that they are not all on top of each other? All of my files are 40x28. It would be great if they were in a grid or a line. If not, i can move them myself. Quote
KLKSMILE Posted July 14, 2010 Author Posted July 14, 2010 Something weird has been happening with the LISP routine and I can't figure out the reason behind it. When I run the lisp routine, it leaves some stuff out the cut files. For example, when I run lisp on the attached dwg file, the drawing number in the bottom right of the template disappears on the second drawing. I have tried everything I can think of, and it still keeps deleting it from the cut drawing. This is not the only instance, a lot of times it cuts like the last line of text from a table, or deletes the revision block text from ½ the files I cut up. It’s so bizarre. Can you help me figure out what is going on? I have attached the LISP routine as well. Since I just a script to move all the cut files to 0,0 and then re-tag them. Is there any way you could remove the Tagging in the DWGCUT Lisp? problem example.dwg DwgCut.LSP 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.