Porting STEP reader to new Part Design

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Porting STEP reader to new Part Design

Post by vejmarie »

Hi,

I have started to play around with the new part design stuff to port our STEP reader using these objects instead of the Compound/Part feature. This shall accelerate the rendering and browsing phase of STEP/IGES etc ...

But I am getting lost, a STEP file is an assembly tree with root nodes which are main assembly and sub assemblies, and shape description. With the new part design I can easily create new part but they can't be included easily to each other using call to addObject(). I started to thought that I needed to create a master Part and then body's but body's can contain only Shape which seems to be created by the sketcher workflow (which is fine to me).
So, what are your recommendation to create a STEP tree structure with the new Part Design stuff.

I can try to build a Part tree, but still do not understand how in C++ I can easily add Part into a Part, an example will be really appreciated !

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

Re: Porting STEP reader to new Part Design

Post by vejmarie »

User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Porting STEP reader to new Part Design

Post by NormandC »

vejmarie wrote:I am based on this drawing
It should be rather the one after labelled v2. ;)
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Porting STEP reader to new Part Design

Post by vejmarie »

NormandC wrote:
vejmarie wrote:I am based on this drawing
It should be rather the one after labelled v2. ;)
Agree my initial pointer is not good :(
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Porting STEP reader to new Part Design

Post by DeepSOIC »

Hi!
vejmarie wrote:part but they can't be included easily to each other using call to addObject()
Please explain. They can, see Part-o-magic.
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Porting STEP reader to new Part Design

Post by vejmarie »

DeepSOIC wrote:Hi!
vejmarie wrote:part but they can't be included easily to each other using call to addObject()
Please explain. They can, see Part-o-magic.
That is a good news. Let me read all this stuff and get back to the forum if I don't find any options.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Porting STEP reader to new Part Design

Post by DeepSOIC »

Code: Select all

asy = App.ActiveDocument.addObject("App::Part", "Assembly")
part = asy.newObject("App::Part", "Part")
result:
nested-part-creation.png
nested-part-creation.png (43.18 KiB) Viewed 2566 times
It is python of course, but in C++ you can something like Base::Interpreter::runString("code") or doCommand(code) or whatever, if you're desperate.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Porting STEP reader to new Part Design

Post by ickby »

In my local branch I fixed a few addObject problems... well I need to finalize that stuff sometime. Butin general it should work to add things to the "Group" property directly.
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Porting STEP reader to new Part Design

Post by vejmarie »

ickby wrote:In my local branch I fixed a few addObject problems... well I need to finalize that stuff sometime. Butin general it should work to add things to the "Group" property directly.
Ok. Will keep you posted tonight (Europe time), but I am still facing issue to transfer one App::Part to another one when both are standing as root node into the graphical tree. I am using in that case something like pcPart->addObject(myparttotransfer) ...
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Porting STEP reader to new Part Design

Post by vejmarie »

Ok, it works. Just issued a PR to integrate that code.
Post Reply