[solved] Sketch vs Extrude - how sketch is working?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

[solved] Sketch vs Extrude - how sketch is working?

Post by dprojects »

I am trying to create wood part from vertices. The extrude command "pad" object always along axis, so the edges may not be 90 degree if the object is rotated, I mean if the vertices are not at the same axis. So, and this will be the most funny part, I decided to create face and then ;-) create Sketch at that face and pad it from that face ;-)

But there is small problem with the Sketch ;-) The face is created correctly but if I use the face as "DatumPlane", Support, for Sketch this has placement offset at XY. But if I want to create the Sketch at the side the face is correct but the Sketch with the same vertices is broken.

I know there is different logic with attachment of the Sketch but the question is? Is it possible? is there any logic or formula to recalculate object vertices to "Sketch vertices" ? to create Sketch exactly as the real object? to cover all edges with Sketch lines?

Image
Last edited by dprojects on Fri Sep 30, 2022 6:18 pm, edited 1 time in total.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Sketch vs Extrude - how sketch is working?

Post by onekk »

dprojects wrote: Fri Sep 30, 2022 4:04 pm ... The extrude command "pad" object always along axis...

It is not true, you could extrude along some combination of axis, see maybe:
20220930-sketch_pad.py
(4.2 KiB) Downloaded 17 times

Done with:

Code: Select all

pa1 = pd1.newObject('PartDesign::Pad', 'pad1')
pa1.Type = u"Length"
pa1.UseCustomVector = True
pa1.Direction = (0.57, 0.57, 0.57)
pa1.Profile = sk1
pa1.Length = 53 * 0.5

seen from Top.
20220930-sk_pad.png
20220930-sk_pad.png (2.91 KiB) Viewed 580 times
Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Sketch vs Extrude - how sketch is working?

Post by dprojects »

onekk wrote: Fri Sep 30, 2022 4:38 pm pa1 = pd1.newObject('PartDesign::Pad', 'pad1')

No, I mean extrude command from face object, not PartDesign Pad command:

Code: Select all

shape = Part.makePolygon(verticesArray)
face = Part.Face(shape)
....
face.extrude(FreeCAD.Vector(0, 0, "18"))
If you create shape, next face and you extrude the face to get solid object in 3D not face at 2D. The face is 2D object. And I want to Pad it but not along axis but from face... above equally... maybe I am looking for face2sketch... or some kind of tutorial about Sketch placement and vertex logic?

or maybe it is possible to use face.extrude but not like this, along axis, but like it is at PartDesign Pad, above from given face?:

Code: Select all

face.extrude("face1","18")    <= this syntax exists?

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Sketch vs Extrude - how sketch is working?

Post by onekk »

No this is not exist, but you can use the centre of the "destination face" as "destination vector" of extrude.

if you want something different use a Loft provided the face have same edge count.

or ruled surface between the face "sorting edges" to avoid crossing.

Sadly not at my computer now, so no examples.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Sketch vs Extrude - how sketch is working?

Post by dprojects »

onekk wrote: Fri Sep 30, 2022 6:06 pm No this is not exist
I found it ;-) in the TheMarkster script.

@TheMarkster use the Draft.makeSketch command and the Pad is created at face, automatically. The Draft is great workbench, it always impressed me how good API it has !!! I need to play with it little more and read about this command because the panel is not always created in the right place but maybe I will be able to do it like this ;-)

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: [solved] Sketch vs Extrude - how sketch is working?

Post by onekk »

Ah ok.

I use Draft for some functions, and not unusually I steal some code from sources.

It is a good "high level" abstraction from Part.

And is the base of Arch WB one of FC pillars.

TheMarkster code is usually very interesting.

I usually use Part WB so my answers usually don't consider other WB. :)

Thanks for the suggestions.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: [solved] Sketch vs Extrude - how sketch is working?

Post by dprojects »

onekk wrote: Fri Sep 30, 2022 7:17 pm I use Draft for some functions, and not unusually I steal some code from sources.
I think Draft is best workbench from API perspective. The Draft.rotate is the only one working function, currently at FreeCAD to rotate things.
but I was happy too soon ;-) I don't know what to say ;-) this is bug at Sketch? https://forum.freecadweb.org/viewtopic.php?f=22&t=72250

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply