Jump to content

import Multiples Dgn's to single Dwg


rk25134

Recommended Posts

Please suggest how to change the code accordingly

 

(VL-LOAD-COM)

(defun C:D2D (/path dgnfile SDI_Mode)

(setq path

((setq DirPath (acet-ui-pickdir))

(setq ref (vlax-get-acad-object))

(SETQ FILES (VLA-GET-FILES

(VLA-GET-PREFERENCES ref)))

(SETQ OLDSUPPORT (VLA-GET-SUPPORTPATH FILES))

(SETQ NEWPATH (STRCAT OLDSUPPORT ";" DirPath ";"))

(VLA-PUT-SUPPORTPATH FILES NEWPATH));;Default path for DGN files location.

DGNIMPORTMODE 0 ;;Imports the DGN file in a new drawing file.

SDI_Mode SDI ;;Save Current SDI MODE

SDI 1 ;;SET Single Drawing Mode for AutoCAD.

)

(setq files (vl-directory-files path "*.dgn"))

(foreach dgnfile files

(command "-dgnimport" (strcat path dgnfile) "" "" "" "y" (strcat path dgnfile ".dwg"))

)

)

Link to comment
Share on other sites

Adjusted but not tested

 

(VL-LOAD-COM)
(defun C:2D (/path dgnfile SDI_Mode)
(setq path (setq DirPath (acet-ui-pickdir)))
(setq ref (vlax-get-acad-object))
(SETQ FILES (VLA-GET-FILES (VLA-GET-PREFERENCES ref)))
(SETQ OLDSUPPORT (VLA-GET-SUPPORTPATH FILES))
(SETQ NEWPATH (STRCAT OLDSUPPORT ";" DirPath ";"))
(VLA-PUT-SUPPORTPATH FILES NEWPATH);;Default path for DGN files location.
(setvar "DGNIMPORTMODE" 0) ;;Imports the DGN file in a new drawing file.
(setq SDI (getvar "SDI_Mode"))  ;;Save Current SDI MODE
(setvar "SDI_mode"  1) ;;SET Single Drawing Mode for AutoCAD.
(setq files (vl-directory-files path "*.dgn"))
(foreach dgnfile files
(command "-dgnimport" (strcat path dgnfile) "" "" "" "y" (strcat path dgnfile ".dwg"))
) ; foreach
) ; defun

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