Jump to content

Library


rengised

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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