SheetMetal WB migration to 0.17

Need help, or want to share a macro? Post here!
User avatar
shaise
Posts: 377
Joined: Thu Jun 11, 2015 8:11 am

SheetMetal WB migration to 0.17

Postby shaise » Sat Feb 18, 2017 9:19 am

Hi,

I would like to migrate my SheetMetal workbench to work correctly with 0.17.
As of now, if you try to work with SheetMetal on 0.17, the function will work, but the created feature will leave the parent Body, and no longer it is possible to add part design features. (cant attach new sketches for example)
To reproduce the issue: make a rectangle sketch, pad it to 2mm, select SheetMetal workbench, select a side face, add a bend. You can no longer add sketches.
I have tried to add the new created feature back to the body, but it did not work:

Code: Select all

>>> App.activeDocument().Body.addObject(App.activeDocument().Bend)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.FreeCADError: FreeCAD exception thrown (Body: object is not allowed)
Can any one give me some hints on how to make the SheetMetal generated features be compatible with 0.17 PartDesign and the new introduced Part and Body?

Thanks!

shai
ickby
Posts: 2995
Joined: Wed Oct 05, 2011 7:36 am

Re: SheetMetal WB migration to 0.17

Postby ickby » Sat Feb 18, 2017 10:11 am

Body allows only PartDesign features. It is not intended to be used by other workbenches. You hence have two possibilities:

1. Make your features all derive from PartDesign::Feature and only work within a body. But this means you need to follow all Part design guidelines and workflows etc.
2. Don't add anything to the body and just work outside of it. for example you can simply use the body itself to bend it instead of a feature inside.

By the way: in the future it will be not possible to link to the features inside the body, as this is a cross - coordinate-system link.
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: SheetMetal WB migration to 0.17

Postby triplus » Sat Feb 18, 2017 2:19 pm

ickby wrote:Body allows only PartDesign features. It is not intended to be used by other workbenches.
Not cool. 8-)
User avatar
shaise
Posts: 377
Joined: Thu Jun 11, 2015 8:11 am

Re: SheetMetal WB migration to 0.17

Postby shaise » Sat Feb 18, 2017 2:51 pm

Thanks.

Sheet metal workflow involves adding bends and then cut holes using sketches and pockets. Hence it is quite essential for it to be compatible with Part Design.
ickby wrote: Make your features all derive from PartDesign::Feature and only work within a body. But this means you need to follow all Part design guidelines and workflows etc.
Is there anywhere I can find documentation for Part design guidelines and workflow?

shai
ickby
Posts: 2995
Joined: Wed Oct 05, 2011 7:36 am

Re: SheetMetal WB migration to 0.17

Postby ickby » Sat Feb 18, 2017 3:10 pm

Is there anywhere I can find documentation for Part design guidelines and workflow?
No, unfortunately not. But this may be a good point starting some writeup how tools should behave in PartDesign. A few things that pop directly in my mind, but that may not be the complete list:

1. Document object are derived from PartDesign::Feature, and ViewProviders from the equivalent part design view provider
2. Everything gets added to the body, and never outside of a body. So all your tool need to check for the active body and omit a warning if non available (or create a new one automatically)
3. Linear feature lineup. No deep nesting (child of child of child etc.) but every feature has a "Base" object which it manipulates. So a feature takes a base as input and manipulate it so that it becomes part of the features output. It can also use helper objects like sketches or datums. If you play with PArtDesign you will see what I mean with that
4. You need to handle the tip of the body. So a new feature must set the tip correctly.
5. No placement in the features. Placement is taken from the base feature and global placement s done via the body.
6. They should accept Origin axes/planes and datums as inputs if relevant
7. Only solids. No shells, no faces etc, only solid bodies.
User avatar
shaise
Posts: 377
Joined: Thu Jun 11, 2015 8:11 am

Re: SheetMetal WB migration to 0.17

Postby shaise » Sat Feb 18, 2017 3:35 pm

Thanks!

Looks a bit intimidating, but I will take a look. Hopefully it can all be done by python scripting.

meanwhile I found the following workaround, don't know if its a correct workflow: after creating a SheetMetal feature (Bend), I select the object then press the "New body" button. It creates a new Body over the Bend, and now I can add part design features.

shai
User avatar
easyw-fc
Posts: 2928
Joined: Thu Jul 09, 2015 9:34 am

Re: SheetMetal WB migration to 0.17

Postby easyw-fc » Sat Feb 18, 2017 5:25 pm

shaise wrote: shai
Hi @shai,
you may find interesting Part-o-Magic
https://forum.freecadweb.org/viewtopic. ... 98#p160150
BTW thanks for your nice and very useful WB! :D
Maurice
User avatar
shaise
Posts: 377
Joined: Thu Jun 11, 2015 8:11 am

Re: SheetMetal WB migration to 0.17

Postby shaise » Sat Feb 18, 2017 5:30 pm

Maurice,
Great, Thanks!
Looks like a good place to look for code hints.

shai
Marco_T
Posts: 221
Joined: Mon Jan 11, 2016 11:58 pm

Re: SheetMetal WB migration to 0.17

Postby Marco_T » Sat Feb 18, 2017 10:37 pm

shaise wrote:Hi,
I would like to migrate my SheetMetal workbench to work correctly with 0.17.
Hi shaise!
thanks for your contribution!
I often use the SheetMetal workbench (in FreeCAD 0.16) with excellent results.
I hope it will work well also in FreeCAD 0.17.
Keep it up!

--
Marco_T
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: SheetMetal WB migration to 0.17

Postby NormandC » Sun Feb 19, 2017 12:16 am

Hello shai,

I've used your sheet metal workbench a little too, and I'm very glad it exists to provide missing functionality in FreeCAD. Thanks for your work! :)

Of course the approach you take is your own decision, but if you'll allow my opinion ;), my preference would go to ickby's first option (to derive from PartDesign::Feature).
ickby wrote:3. Linear feature lineup. No deep nesting (child of child of child etc.)
And I would like that as well. I prefer all the features to be listed in sequence one after the other on the same level, and find it hard to get into the history of a model by going through multiple nested levels. That's why I love PartDesign so much.

Unfortunately as an end user, I can't be of help.

Good luck!