Jump to content

Recommended Posts

Posted

Please find the attached screenshot. I need to remove the reference path using lisp.

 

I used a lisp, in that it will attach the reference path and get inserted all the dwgs from the reference path into one file dwg.

 

 

I want a lisp that need to add the reference path and inserted all drawings from the path save as with the folder name then remove the reference path

test.png

Posted

Try this code -

 

 

(defun RemoveDevPath (DevPaths / IAcadPreferencesFiles pathsString DevPaths)
 (vl-load-com)
 (setq    IAcadPreferencesFiles
    (vla-get-files
      (vla-get-preferences (vlax-get-acad-object))
    )
   pathsString
    (vla-get-supportpath IAcadPreferencesFiles)
 )
 (foreach path    DevPaths
   (setq pathsString (vl-string-subst "" path pathsString))
 )
 (vla-put-supportpath IAcadPreferencesFiles pathsString)
 (princ)
)

Posted (edited)

How to append the above routine to this lisp

(defun c:iab () (c:insertalldirectory))
(defun c:insertalldirectory (/ DirPath filens)
 (setq DirPath (acet-ui-pickdir))
 (VL-LOAD-COM)
 (SETQ ACADOBJ (VLAX-GET-ACAD-OBJECT))
 (SETQ FILES (VLA-GET-FILES (VLA-GET-PREFERENCES ACADOBJ)))
 (SETQ OLDSUPPORT (VLA-GET-SUPPORTPATH FILES))
 (SETQ NEWPATH (STRCAT OLDSUPPORT ";" DirPath ";"))
 (VLA-PUT-SUPPORTPATH FILES NEWPATH)
 (setq filens (vl-directory-files DirPath "*.dwg"))
 (foreach file filens
   (command "-INSERT" file '(0 0 0) "" "" "")
   )
 (command "Zoom" "e" "")
 (setvar "qaflags" 1)
 (command "explode" "all" "")
 (setvar "qaflags" 0)
 (command "_.saveas" "" DirPath (getvar 'dwgprefix) "dwg" 1))
(command "filedia" "1")
(command "cmddia" "1")
(princ)

Edited by SLW210
ADD Code Tags!
Posted (edited)

You need a to enclose the Code (

CODE GOES HERE[/i]

).

 

You missed the [/code] at the end.

 

 

 

(vl-load-com)
(defun c:iab () (c:insertalldirectory))
(defun c:insertalldirectory (/ DirPath filens)
(setq DirPath (acet-ui-pickdir))
(SETQ ACADOBJ (VLAX-GET-ACAD-OBJECT))
(SETQ FILES (VLA-GET-FILES (VLA-GET-PREFERENCES ACADOBJ)))
(SETQ OLDSUPPORT (VLA-GET-SUPPORTPATH FILES))
(SETQ NEWPATH (STRCAT OLDSUPPORT ";" DirPath ";"))
(VLA-PUT-SUPPORTPATH FILES NEWPATH)
(setq filens (vl-directory-files DirPath "*.dwg"))
(foreach file filens
(command "-INSERT" file '(0 0 0) "" "" "")
)
(command "Zoom" "e" "")
(setvar "qaflags" 1)
(command "explode" "all" "")
(setvar "qaflags" 0)
(command "_.saveas" "" DirPath (getvar 'dwgprefix) "dwg" 1))
(command "filedia" "1")
(command "cmddia" "1")
(princ)[/Code]

Edited by SLW210
Corrected CODE TAGS!

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