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.
User avatar
easyw-fc
Posts: 2915
Joined: Thu Jul 09, 2015 9:34 am

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

Postby easyw-fc » Tue Jan 31, 2017 10:40 am

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: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

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

Postby vejmarie » Tue Jan 31, 2017 10:55 am

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: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

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

Postby vejmarie » Tue Jan 31, 2017 6:55 pm

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
Posts: 2985
Joined: Wed Oct 05, 2011 7:36 am

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

Postby ickby » Tue Jan 31, 2017 7:36 pm

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: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

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

Postby vejmarie » Tue Jan 31, 2017 8:07 pm

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
Posts: 2985
Joined: Wed Oct 05, 2011 7:36 am

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

Postby ickby » Tue Jan 31, 2017 9:04 pm

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

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

Postby easyw-fc » Tue Jan 31, 2017 10:01 pm

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 906 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: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

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

Postby vejmarie » Tue Jan 31, 2017 10:05 pm

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

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

Postby vejmarie » Tue Jan 31, 2017 10:08 pm

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
Posts: 2915
Joined: Thu Jul 09, 2015 9:34 am

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

Postby easyw-fc » Tue Jan 31, 2017 10:26 pm

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