Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Importing Multiple files in a batch (FBX)

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
3675 Views, 8 Replies

Importing Multiple files in a batch (FBX)

Has anyone discovered a way to import multiple files in one batch. We are currently using the import commandto bring in FBX files as blocks.It would be great to automate this process and allow multiple selection. Icing on the cake is assigning automagically to layers based on the name of the FBX file being brought in.

 

-David S. Perkins

8 REPLIES 8
Message 2 of 9
pendean
in reply to: Anonymous

http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775920
or
I believe you can drag and drop from Windows Explorer straight into an open AutoCAD session for a basic insert.
Message 3 of 9
Anonymous
in reply to: pendean

I just attempted, unfortunately it does not work. I tried dragging multiple fbx's into an open drawing's model space, as well as the design center window.

Dragging multiple DWG's opens them in seperate tabs. Thanks for the idea though!

Message 4 of 9
pothied
in reply to: Anonymous

You could try writing a script that you can run inside of AutoCAD to import the files. I don't have any fbx files to try this with so I don't know the exact steps that you would need. You would have to turn off FILEDIA to do this so your script would start with:

(setvar "filedia" 0)

(command "import" "filename" ..... ) don't know the exact steps - an enter is double quotes ""

(command "import" "filename" ..... )

(command "import" "filename" ..... )

(setvar "filedia" 1)

 

Hope this helps



David Pothier

Message 5 of 9
Anonymous
in reply to: pothied

That would work if I need to import the same FBX files each time. The time it would take to edit this script for each use is about the same as importing each by hand one at a time. Is there a way I can add this as a feature request to allow multiple selection in the import window. I'm sure other users would benefit from batch importing.

Message 6 of 9
pothied
in reply to: Anonymous

Here is a link for providing Autodesk with suggestions for improvements to the software.

 

 

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1109794



David Pothier

Message 7 of 9
Anonymous
in reply to: Anonymous

This is a small utility tool developed with AutoLisp which import drawings files of different types in to AutoCAD and create drawing files in the folder. No matter how the directory structure is, it will still import all the files and move the original files to a sub-folder. In the upcoming videos, we will see more in importing descriptively in to AutoCAD.

AutoCAD 2018 supports these format files,
("*.ste" "*.stp" "*.step" ".dxf" "*.iges" "*.igs" "*.fbx" "*.sat" "*.ipt" "*.iam" "*.model" "*.session" "*.CATProduct" "*.dgn" "*.ij" "*.prt" "*.asm*" "*.3dm" "*.sldprt" "*.asm" "*.sldasm" "*.g" "*.x_b" "*.x_t" )

More on this https://www.gsunitedtechnologies.com/cad/stepimport/?referer=forums-autodesk
Import CAD format files recursively to AutoCAD - Visual Lisp

 

https://www.youtube.com/watch?v=5jv7v5Rivi4

Message 8 of 9
tstorzuk
in reply to: Anonymous

Your supplied code at the web page link is non-functional.

All that happens when running the code is an error;

 

Command: SFIMPORT
; error: no function definition: ALE_BROWSEFORFOLDER

 

Does someone out there have a function that actually works?

 

Here's the non-functioning code from the provided link;

(defun c:sfimport()
   (setq path (ale_browseforfolder "Select directory to get files:"))
    (setq ftype "*.step") (setq flist (getfolders path ftype T))   ; change nil to T to get sub folders (alert "\n\n Click OK to continue SFImport..")
   (stepImportRecursive flist)
    (princ)
)
Message 9 of 9

The only problem is the stepImportRecursive command I couldn't replicate as the website is not inactive however this is what I came up with as I have over 1000 step files to reproduce for Plant 3D HDPE parts

(defun c:sfimport(/ ALE_BrowseForFolder path ftype flist fname GetFolders extensiontype )
;; Original BrowseForFolder by Tony Tanzillo
    (defun ALE_BrowseForFolder (PrmStr / ShlObj Folder FldObj OutVal)
        (vl-load-com)
        (setq
            ShlObj (vla-getInterfaceObject
                       (vlax-get-acad-object)
                       "Shell.Application"
                   )
            Folder (vlax-invoke-method ShlObj 'BrowseForFolder 0 PrmStr 0)
        )
        (vlax-release-object ShlObj)
        (if Folder
            (progn
                (setq
                    FldObj (vlax-get-property Folder 'Self)
                    OutVal (vlax-get-property FldObj 'Path)
                )
                (vlax-release-object Folder)
                (vlax-release-object FldObj)
                OutVal
            )
        )
    )
 (defun GetFolders (path / l c)
  (if (setq l (vl-directory-files path nil -1))
	(apply 'append (mapcar
		(function (lambda (x) (cons (setq c (strcat path "\\" x)) (GetFolders c))))
			(vl-remove "." (vl-remove ".." l))
		)
	)
  )
 )
	(setq path (ale_browseforfolder "Select directory to get files:"))
	(setq extensiontype ".step")
	(setq ftype (vl-directory-files path "*" extensiontype ))
	(setq flist (getfolders path)); get sub folders
	(alert "\n\n Click OK to continue SFImport..")
	;;; build your own stepImportRecursive
		(foreach 3DModel ftype
			(command "_import" (strcat path "\\" 3DModel) )
			(setq fname (substr 3DModel 1 (- (strlen 3DModel) (+ ((strlen extensiontype) 1)))))
			;;;export imported blockname possible wblock???
		)
;;; end stepImportRecursive
(princ)
)

I can only assume that it would use flist and for each directory actually use (setq ftype (vl-directory-files path "*.step"))

the above works at the moment 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost