question

Tomi Kosunen avatar image
1 Like"
Tomi Kosunen asked Phil BoBo edited

Can FlexSim read FreeCad files?

Hi

I have tried to read FreeCad file into FlexSim as object geometry. FlexSim does not support FreeCad native format, but there are many formats I can export. In my experience, .obj format is good for exporting geometry and color. For some reason, FlexSim cannot read .obj file exported from FreeCad. Do you have any idea why? Microsoft 3DBuilder can read the .obj file easily so the file should be ok. (pls find test10.obj attached)

cad filesobj file format
test10.obj (22.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

David Seo avatar image
2 Likes"
David Seo answered Phil BoBo edited

@tomi.kosunen

FlexSim can read obj format file like captured.

I attached the file.

Drag and drop Shape object from Visual group in the library and set the obj file in the filename like above captured.

test-obj.fsm

You can import the file as flowitem and replace the fixed resource with it.


2018-09-06-203010.png (227.9 KiB)
test-obj.fsm (27.6 KiB)
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Tomi Kosunen avatar image Tomi Kosunen commented ·

Thanks @david.seo

I did some research. I had done like you wrote but all I got on the FlexSim screen was an empty yellow frame. I noticed that .obj file is linked to a .mtl file when obj file is exported from cad. I had missed the mtl file from my first post. The mtl file contains materials and colors. If the mtl file exists, then FlexSim cannot read the obj file.

The FreeCad has slightly different .mtl file than 3DBuilder. I compared the mtl files (from FreeCad and 3DBuilder) and the difference is the FreeCad has two extra lines "d 0" in lines 5 and 7. If I manually remove those lines in text editor, then FlexSim can read the original .obj file with colors.

Do you know what are those extra lines? Is it something that FlexSim should read.

You can find the original (incorrect) mtl file and the fixed mtl file from the attached zip.

test10.zip

1 Like 1 ·
test10.zip (7.3 KiB)
Tomi Kosunen avatar image Tomi Kosunen commented ·

Hi again.

mtl file specification says that "d 0" means transparent and "d 1" means fully opaque (default value is 1). So FlexSim reads the file correctly, only the object is invisible and I have to find out why.

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Tomi Kosunen commented ·

If FreeCad is putting d 0 on that material and it isn't supposed to be fully transparent, then that sounds like a bug in FreeCad's obj exporter.

It sounds like FlexSim's obj importer is correctly parsing the material file and rendering that material as fully transparent (invisible).

1 Like 1 ·
David Seo avatar image David Seo Tomi Kosunen commented ·

@tomi.kosunen

mtl format file has material and color attribute as you said. And FlexSim shows only the shape of obj file without color without the mtl file.

FlexSim can read obj file and display the shape without or with mtl file.

The reason to show only yellow box in your model is FlexSim can't search the obj file in your model folder. If you set the obj file with the folder name like 'D:\working\14209-test10.obj', FlexSim display the shape of obj file not showing only yellow box.

0 Likes 0 ·