Script for import multiple file

I have a folder full of contour dxf, to open in rhino, but when I drope them in rhino, they are all in the same place: on the origin.
I would like to make a script that allows me to select the starting folder, and the script import all files one by one, I just have to move the files the width of the last between each import.
are they the commands to import a file, or list the files of a folder?
thank you!

can i use this type of code:

Dim filefolder
Set filefolder = FileSys.GetFolder(FolderPath)
Dim i as Integer
'loop through all files in the folder
For i = 1 To filefolder.Files.Count
Dim IFile
Set IFile = filefolder.Files.Item(i)

Hi, sorry I cannot help with vb, but this works in python:

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
from os import listdir
from os.path import isfile, join

path = "C:\\temp\\pyExport\\" #your file path (mind the double backslashes)
files = [f for f in listdir(path) if isfile(join(path, f))]
vec = rg.Vector3d(0,0,0)

if len(files)>0:
    for f in files:
        filename = path + f
        rs.Command("! _-Import " + filename + " _Enter" + " _Enter")
        g = rs.LastCreatedObjects()
        rs.MoveObject(g, vec)
        geo = rs.coercegeometry(g)
        bbox = geo.GetBoundingBox(True)
        vec =  vec + (bbox.PointAt(1,0,0) - bbox.PointAt(0,0,0))
1 Like

thank you David!!! but i don’t know Python, i would like but, i don’t have time to learn it…
to choose the file path, i use:

path= rs.BrowseForFolder(“C:\Program Files\” )???

You need double backslashes or a raw string (r”c:\windows\...”)