Hi all,
Like the title mentions, I’m looking for a way to import .dxf / .obj / .fbx with grasshopper.
I’ve seen some mentioned and tried a few solutions but unfortunately without any succes, hoping for some help with this post.
I’ve tried out this solution.
Script down below:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
def importToGrasshopper(fileType, fileName, filePath):
# check the input data
if fileType:
if fileType.startswith("."):
pass
else:
fileType = "." + fileType
supportedFileTypes = [".3dm", ".3ds", ".sat", ".ai", ".dwg", ".dxf", ".dae", ".cd", ".x", ".emf", ".gf", ".pm", ".kmz", ".gts", ".igs", ".iges", ".udo", ".fbx", ".obj", ".csv", ".x_t", ".pdf", ".ply", ".txt", ".pov", ".raw", ".rib", ".skp", ".step", ".stl", ".tsm", ".tss", ".vda", ".wrl", ".vmrl", ".gdf", ".wmf", ".x3dv", ".xaml", ".xgl", ".zpr"]
if fileType in supportedFileTypes:
pass
else:
print "File type %s is not supported" % fileType
return
else:
print "Please input fileType"
return
if fileName:
pass
else:
print "Please input fileName"
return
if filePath:
if filePath.endswith("\\"):
pass
else:
filePath = filePath + "\\"
else:
return
print "Please input filePath"
# geometryTypes functions
fileNameAndType = fileName + fileType
finalPath = filePath + fileNameAndType
commandString = "_-Import " + finalPath + " _Enter _Enter _Enter"
done = rs.Command(commandString)
if done:
print "%s file successfully imported from: %s" % (fileNameAndType, filePath)
if Import:
importToGrasshopper(fileType, fileName, filePath)
The script has some problems with the white spaces in the file path and can not import anything because of it.
Thank you