Moldflow Insight Forum
Welcome to Autodesk’s Moldflow Insight Forums. Share your knowledge, ask questions, and explore popular Moldflow Insight topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

automatic import of many bdf meshes in moldflow - how could this work

1 REPLY 1
SOLVED
Reply
Message 1 of 2
phammer
412 Views, 1 Reply

automatic import of many bdf meshes in moldflow - how could this work

Hi everybody,

 

I want to add some meshes to a study. Yes i can do this by hand with the add command, but I don't want to do this with mare than 20 meshes.

 

I was thinking of if there would be a possibility to write a script that imports bdf files in a folder to a study. Would this be possible?

 

Greetings Philipp

1 REPLY 1
Message 2 of 2
nordhb
in reply to: phammer

Hi,

this should be possible.

 

You need to use File System Object
Set fso = CreateObject("Scripting.FileSystemObject")

to collect files from a folder.

 

You can then loop through the files and use:

StudyDoc.AddFile

 

Here is an example:

'Creating File System Object 
Set fso = CreateObject("Scripting.FileSystemObject")   

'Getting the Folder Object 
'Only the files to be added in this folder
Set ObjFolder = fso.GetFolder("C:\Temp\add_files")   

'Getting the list of Files 
Set ObjFiles = ObjFolder.Files   

'Getting the Path and Name of each File and Add
SetLocale("en-us")
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "Metric" 
i=0
 Set ImpOpts = Synergy.ImportOptions()
 Set StudyDoc = Synergy.StudyDoc()
 'ImpOpts.MeshType "3D"
 'ImpOpts.Units "mm"
For Each ObjFile In ObjFiles     
 StudyDoc.AddFile ObjFile.Path, ImpOpts, False
 i = i + 1
Next  

MsgBox "Files Added: " & i ,, "Information"

 The import options are outprompted, but might need to be adjusted for your purpose.

 

You can copy above code to a text-file and save as vbs.

Change path or copy bdf-files to folder as in script, and give it a try.

 

Hope this helps.

 

Regards,

Berndt

 

 

 



Berndt Nordh

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

Post to forums  

Autodesk Design & Make Report