STEP file read might be crazy long ...

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP file read might be crazy long ...

Post by easyw-fc »

Jee-Bee wrote: So the biggest improvement would be that OCC upgrade their step exporter!!
OCC already have a fast code to read STEP files... CAD Assistance is done by Open Cascade and the loading and displaying time is blazing fast
easyw-fc wrote: CAD Assistant
loading 37.426s
prepared in 196.581
presentation in 81.9969s
tot. 316s
the riddle is if they would share this importer code....
vejmarie wrote:By the way this first step see some 30% improvement.
I would say very good for a first step in MT! :)
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP file read might be crazy long ...

Post by vejmarie »

easyw-fc wrote:
Jee-Bee wrote: So the biggest improvement would be that OCC upgrade their step exporter!!
OCC already have a fast code to read STEP files... CAD Assistance is done by Open Cascade and the loading and displaying time is blazing fast
easyw-fc wrote: CAD Assistant
loading 37.426s
prepared in 196.581
presentation in 81.9969s
tot. 316s
the riddle is if they would share this importer code....
vejmarie wrote:By the way this first step see some 30% improvement.
I would say very good for a first step in MT! :)
You are right. I always thought that Cad Assistant was based on Open Cascade but using external libraries also. Aka thought that they used Open Cascade internally but not for all tasks like reading STEP, but as this is a demo stuff from Open Cascade it should rely on there own code. Let me discuss a little bit with them on that. I also need to check a few other things in FreeCAD before, as I might have missed some stuff
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP file read might be crazy long ...

Post by vejmarie »

ickby wrote:Is there a special reason you use compound instead of the new Part Object, which is exactly intended for such purposes? (Or a special GeoFeatureGroup if no origin is wanted)? As a Compound always douplicates the child shapes this seems very resource intense, both calculation cycles and memory wise. The Part object only shifts objects and hence is very lightweight.

Disclaimer: Currently it is not possible to have a object in multiple places, so references won't work (you would still need to duplicate the shape here). That will be possible with instances in the near future. Also some things regarding Parts are not yet super solid. But would be a good proof of concept if step import would create Parts already.
I had a look, but if I properly understand the way I shall move from STEP assembly to the new Part structure. A part might be able to contain multiple Body. And part can contain multiple parts. I got an issue currently which is when I want to move a body from a part to another it does crash. Is it supposed to work ?
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: STEP file read might be crazy long ...

Post by ickby »

I had a look, but if I properly understand the way I shall move from STEP assembly to the new Part structure. A part might be able to contain multiple Body. And part can contain multiple parts. I got an issue currently which is when I want to move a body from a part to another it does crash. Is it supposed to work ?
It should not crash :) The moving should actually work, but again, still working on it. It is rather rough at the moment. However, as you are working on this now it may be good to use the Parts to not need to make the switch later.

By the way: Bodies are only for PartDesign features. For step import i think you create normal Part::Features. Those can be added directly to Parts (as well as everything else, no restriction)
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP file read might be crazy long ...

Post by vejmarie »

ickby wrote:
I had a look, but if I properly understand the way I shall move from STEP assembly to the new Part structure. A part might be able to contain multiple Body. And part can contain multiple parts. I got an issue currently which is when I want to move a body from a part to another it does crash. Is it supposed to work ?
It should not crash :) The moving should actually work, but again, still working on it. It is rather rough at the moment. However, as you are working on this now it may be good to use the Parts to not need to make the switch later.

By the way: Bodies are only for PartDesign features. For step import i think you create normal Part::Features. Those can be added directly to Parts (as well as everything else, no restriction)
Agree, I will continue to have a look. Do you have a C++ example on how to add a Part to a Part ? This is what I am trying to do currently. With the Compound I am using the Links feature
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: STEP file read might be crazy long ...

Post by ickby »

just call the addObject() function or add the object to the Group property manually.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP file read might be crazy long ...

Post by easyw-fc »

ickby wrote:just call the addObject() function or add the object to the Group property manually.
something like that?
part-sub-parts.png
part-sub-parts.png (155.9 KiB) Viewed 3105 times
but with groups is it possible to assign placement to all the group's parts?
Groups are just a container without a placement, aren't they?

Maurice
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP file read might be crazy long ...

Post by vejmarie »

ickby wrote:just call the addObject() function or add the object to the Group property manually.
Ok will test it.
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP file read might be crazy long ...

Post by vejmarie »

easyw-fc wrote:
ickby wrote:just call the addObject() function or add the object to the Group property manually.
something like that?
part-sub-parts.png
but with groups is it possible to assign placement to all the group's parts?
Groups are just a container without a placement, aren't they?

Maurice
I got a great news ! My latest PR is fixing the STEP file transfer speed issue. The bug was in fact pretty easy to find and very stupid/basic. The progress bar in FreeCAD is updated a crazy amount of time by the file transfer process into OCCT and just updating it's status is slowing down drastically the process.

I just opened a pull request which is fixing this issue and I can read the file now in a faster way on my Mac than with CAD Assistant ! (by using parallel OCCT, otherwise at roughly the same speed)

https://github.com/FreeCAD/FreeCAD/pull/489

The time to render is still longer (about 90s), and this is where I will focus now, but this is a great achievement even if the patch is very small in the end !
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP file read might be crazy long ...

Post by easyw-fc »

vejmarie wrote: I got a great news ! My latest PR is fixing the STEP file transfer speed issue. The bug was in fact pretty easy to find and very stupid/basic. The progress bar in FreeCAD is updated a crazy amount of time by the file transfer process into OCCT and just updating it's status is slowing down drastically the process.

I just opened a pull request which is fixing this issue and I can read the file now in a faster way on my Mac than with CAD Assistant ! (by using parallel OCCT, otherwise at roughly the same speed)
Yeah!!! Fantastic Job!!! 8-) ...looking forward to having both of your patches in the main branch! :D
STEP is real progressing!
Thx
Maurice
Post Reply