Convert multiple .step to .fbx file at once

rizvi07

Looking around for some CAD
In my day to day use I may need to convert multiple files from .step to .fbx, I using asm-xde-load/asm-xde-save-fbx to convert them individually. I wanted to know if there is a way where I can convert multiple step files in a folder to the fbx.
 

Quaoar

Administrator
Staff member
You can prepare a Tcl script for that (and execute it with `source <your-file>`. Smth like that:

Code:
set workdir $env(ASI_TEST_DATA)/data
#set outdir "C:/output"

set filenames []

# Callback on visiting a file.
proc on_visit {path} {
  global filenames
#  puts "Next filename: $path"
  lappend filenames $path
}

# Recursive visiting procedure.
proc visit {base glob func} {
  foreach f [glob -nocomplain -types f -directory $base $glob] {
    if {[catch {eval $func [list [file join $base $f]]} err]} {
      puts stderr "error: $err"
    }
  }
  foreach d [glob -nocomplain -types d -directory $base *] {
    visit [file join $base $d] $glob $func
  }
}

# Procedure to find files of a certain type.
proc find_files {base ext} {
  visit $base *.$ext [list on_visit]
}

# Find files with a speciifc extension.
find_files [lindex $workdir 0] "stp"
find_files [lindex $workdir 0] "step"
find_files [lindex $workdir 0] "brep"

# Avoid memory leaks because of collecting undo deltas for meshes
# in the data model (project) of Analysis Situs.
disable-transactions

# Load each model and check.
foreach inFilename $filenames {
  puts "Next model to process: $inFilename"
  clear

  # YOUR CODE GOES HERE
}

enable-transactions

puts "Processed [llength $filenames] file(s)."
 
Top