jonathann3891 Posted June 15, 2022 Posted June 15, 2022 I'm trying to write a program that will open all Advance Steel detail drawings from a model, but I'm a little stuck. So far it will find all the detail drawings, but I'm not sure how to proceed from here. (defun c:DDD (/) (vl-load-com) (setq DwgName (getvar 'DWGNAME) DirPath (strcat (getvar 'DWGPREFIX) (substr DwgName 1(- (strlen DwgName) 4)) "\\Details") );setq (if (vl-file-directory-p DirPath) (setq DwgFiles (vl-directory-files DirPath "*.dwg")) );if ) Quote
Emmanuel Delay Posted June 15, 2022 Posted June 15, 2022 (defun open_file (FileName ReadOnly / ) (vla-Open (vla-get-Documents (vlax-get-Acad-Object) ) FileName (if ReadOnly :vlax-true :vlax-false ) ) ) You can use this. Last I checked this worked. So, something like this. I haven't checked if it works. If it doesn't, then let me know (setq i 0) (repeat (length DwgFiles) (open_file (nth i DwgFiles) nil) (setq i (+ i 1)) ) Quote
mhupp Posted June 15, 2022 Posted June 15, 2022 Might want to have a check (if (> (lenght lst) #) confirm opening all drawings. ;;----------------------------------------------------------------------------;; ;; OPEN DRAWINGS IN FOLDER (defun C:DDD (/ path fp lst) (setq path (strcat (getvar 'DWGPREFIX) "\\Navagate to folder and hit save") fp (getfiled "Block List:" path "" 33) path (vl-filename-directory fp) lst (vl-directory-files path "*.dxf" 1) acDocs (vla-get-documents (vlax-get-acad-object)) ) (if lst (foreach drawing lst (vla-open acDocs (strcat path "\\" drawing)) ) ) ) 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.