Jump to content

Recommended Posts

Posted

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
  )
    

 

Posted
(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))
)


 

Posted

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

 

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