rengised Posted June 3, 2010 Posted June 3, 2010 Hey guys, need some help regarsing the libraries what i have made. I have one file with lots of blocks and i want to save every blocks in individual files, is it possibe? any autolisp can provide? instead of saving as on by one. thanx in advance. Quote
alanjt Posted June 3, 2010 Posted June 3, 2010 Step through each block definition and WBlock it out. All you would have to do is specify a directory once and use the block name as the filename. Quote
gilsoto13 Posted June 3, 2010 Posted June 3, 2010 Hey guys, need some help regarsing the libraries what i have made. I have one file with lots of blocks and i want to save every blocks in individual files, is it possibe? any autolisp can provide? instead of saving as on by one. thanx in advance. WBA.LSP... you'll need to write down the target folder where the blocks will be stored.... you can copy - paste it from the windows explorer address bar. wba.lsp Quote
gilsoto13 Posted June 3, 2010 Posted June 3, 2010 What's cruel? Maybe I missundertood, but, aren´t you proposing to wblock each block one by one? I think that the guy just wants to avoid doing it that way... Quote
alanjt Posted June 3, 2010 Posted June 3, 2010 Maybe I missundertood, but, aren´t you proposing to wblock each block one by one? I think that the guy just wants to avoid doing it that way... He was asking about code. I was telling him how he could accomplish it (with code). It's the same principal as what you provided, I just wasn't providing any actual code, just the method by which I and/or anyone else would do it. I didn't mean for him to select and WBlock each block the long way. Quote
gilsoto13 Posted June 3, 2010 Posted June 3, 2010 He was asking about code. I was telling him how he could accomplish it (with code). It's the same principal as what you provided, I just wasn't providing any actual code, just the method by which I and/or anyone else would do it. I didn't mean for him to select and WBlock each block the long way. I thought about that for a few seconds... but then I missunderstood. ok... Quote
Kerry Brown Posted June 3, 2010 Posted June 3, 2010 You could try something like this : ;;;---------------------------------------------------------------------------- ;;;---------------------------------------------------------------------------- ;;; ;; Demand load Doslib ... ;; from [url]http://download.rhino3d.com/en/McNeel/1.0/doslib/[/url] (command "Doslib") ;;; (defun c:KDUB_blocktovendor (/ blockobj newblockname blockname) (if (and (setq blockobj (kdub:objsel "Select Block to write to Server " '("INSERT") nil ) ) (setq *folderName (dos_getdir "Browse for folder" (if *folderNname *folderName "F:\\VENDOR\\") "Select a folder to use" t ) ) (setq newblockname (cdr (car (dos_proplist "Save Block To Server" "Confirm BlockName" (list (cons "BlockName" (setq blockname (cdr (assoc 2 (entget (car blockobj)) ) ) ) ) ) ) ) ) ) ) (vl-cmdf "-WBLOCK" (strcat *foldername newblockname ".DWG") blockname ) ) (princ) ) ;;;---------------------------------------------------------------------------- ;;;---------------------------------------------------------------------------- (princ) Library stuff .. ;;;------------------------------------------------------------------ ;;;------------------------------------------------------------------ ;; (kdub:objsel "Select" '("LINE" "POLYLINE") T) ;; (kdub:objsel "Select" nil T) (defun kdub:objsel (promptmsg ; typelist ; List of entity types allowed to be selected nentselflag ; If true nentsel permitted , otherwise use entsel. / pickok returnvalue tmp ) (setq promptmsg (strcat "\n" (cond (promptmsg) ("Select object") ) " : " ) ) (while (not pickok) (setvar "ERRNO" 0) (setq returnvalue (if nentselflag (nentsel promptmsg) (entsel promptmsg) ) ) (cond ((= (getvar "ERRNO") 52) ; enter ;; skip out (setq pickok t) ) ((= (getvar "ERRNO") 7) (princ "Nothing found at selectedpoint. ") ) ((and (setq tmp (entget (car returnvalue))) ; object type typelist (not (member (cdr (assoc 0 tmp)) (mapcar 'strcase typelist))) ) ; wrong type (alert (strcat "Selected object is not" "\na " (apply 'strcat (cons (car typelist) (mapcar '(lambda (x) (strcat "\nor " x)) (cdr typelist) ) ) ) ". " ) ) ) ;; skip out ((setq pickok t)) ) ) returnvalue ) ;;;------------------------------------------------------------------ ;;;------------------------------------------------------------------ ;;; Quote
rengised Posted June 4, 2010 Author Posted June 4, 2010 hey guys thanks all for the help i appreciate it. gilsoto the lsp it works well.. thanks:) 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.