Flexibility of sketches for the future of FreeCAD?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Flexibility of sketches for the future of FreeCAD?

Post by onekk »

Hologram wrote: Sat Feb 04, 2023 1:24 pm ...
One of the things that I am not seeing is combining surfaces and solids to create a model.
...

This is not True FreeCAD is capable of doing such things, and much more:

An example of creating surfaces:

viewtopic.php?t=71181

But joining them is another task, as some things could only be approximated, so the surface is not everytime following the "generating curves", so you have to accept an approxximation and extract new boudaries curves to create the other mating surfaces, but also these could lead to approximated edges, that will not match among them, how to solve these mathematical problems?

But many things could be done in actual FreeCAD as example for every solid object you have access to each one of his surface and place things on his UV space.

viewtopic.php?t=72913

Or more general:

https://dev.opencascade.org/doc/occt-7. ... ct_modat_5

But also.

viewtopic.php?t=65722


It is a matter of knowing how it works, sadly most of these things are not easily achievable with the GUI as you have to manipulate "raw data" of surfaces and use some rules to position things.

Some things are doable with "Curves WB", some other with "Reverse Engineering WB", some by hand, using Python Scripts.

How to translate them to some GUI tools, is another thing, and not easily doable without making some assumptions, that could or "could not" work for everyone needs.

So there are some needs of "thinkers" that can make some abstractions and think of some interface to these complex things, but sadly most of them could not be simply copied by "other software" workflows, as they are tightly related to the "modelling engine" that is OCCT.

I have put together a bunch of python code to make things, and I could do many things at this level, as example curve things to adapt to a cylindrical surface as in some of these examples:
20230129-asm1.png
20230129-asm1.png (21.9 KiB) Viewed 971 times
20230129-asm2.png
20230129-asm2.png (26.54 KiB) Viewed 971 times
But as said finding a reasonable GUI to make this sort of things it is not easy to do.

It is not very visible, but you can even put holes that will follow the "normal" of the surface, but some things could be achieved only by "trial and errors" and could not be generalized at lest for me for "generic surfaces" as you have to cope with parametric surfaces that are not the same, as example, working with a sphere is not the same as working with a cylinder.

See as example problems relative to mapping in sense of representing the earth on a paper map, this need a projection and there are many ways to do this type of projection, an example:

https://en.wikipedia.org/wiki/Mercator_projection

Hope I have expressed my though in a clear way. (I have many doubts about :oops: )

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/
Hologram
Posts: 201
Joined: Thu Nov 03, 2022 3:05 pm

Re: Flexibility of sketches for the future of FreeCAD?

Post by Hologram »

@drmacro Thanks for the pointers, much appreciated. Will look at those before getting back to this discussion.
Hologram
Posts: 201
Joined: Thu Nov 03, 2022 3:05 pm

Re: Flexibility of sketches for the future of FreeCAD?

Post by Hologram »

@onekk interesting model! Props for making it all im FreeCAD =b

Yes these things are indeed difficult. Lots of exeptions and corner conditions that GUI tools will have to work around. And indeed the kernel may as well be the limiting factor.
I mean even Rhino users are complaining about their surfacing toolset, which is (much) more advanced than FreeCAD's.

But as said in the previous post, I stand corrected on the modelling paradigm and will dig deeper before getting back to you here.
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Flexibility of sketches for the future of FreeCAD?

Post by onekk »

Hologram wrote: Sat Feb 04, 2023 2:22 pm ...
@onekk interesting model! Props for making it all im FreeCAD =b
...
It is only a part of the whole model, almost finished for some "model maker guy" as a paid job.

se_adv1.png
se_adv1.png (51.37 KiB) Viewed 895 times
se_adv2.png
se_adv2.png (71.49 KiB) Viewed 895 times
All made using scripts and parametric, even assembly is done "by hand" to check for interferences, all pieces are then exported as STL file ready to be printed, glued together and assembled.

I could not post code or STL files.

Some parts have been posted around the forum to solve some problems, with hopefully decent code examples to be useful for others, I usually put working code and not simply pieces of code around, to help others to achieve similar results.

But obviously not all the code, as it is the result of many hours of coding and refining methods and "way of building things", they are cylinders, boxes and similar things, some polygons, for which I have made some helpers methods, and some "helpers methods" to place holes and rivets around using UV parameters, but most of the relevant code for this work is around in linked posts above, most of them are courtesy of some clever people, among them @edwilliams16, @Chris_G, @chrisb, @Roy_043 and some other guys, that I can't thanks enough for their kindness and for they clever answers.

I have tried to condense some of this work in two documents:

https://github.com/onekk/freecad-doc/tr ... nographies

(Hoping they are comprehensible :lol: )

This is a real examples of something similar, but they are really "steam engines" made of brass, iron, and lot and lot of work.

https://www.homemodelenginemachinist.co ... ctor.3838/

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/
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

Re: Flexibility of sketches for the future of FreeCAD?

Post by Lonfor »

Hologram wrote: Sat Feb 04, 2023 10:29 am To summarise, what do people think about:
1. Leaving sketches in a sketch folder within a part
2. Leave sketches untouched by feature creation
saso wrote: Sat Feb 04, 2023 11:27 am 1. FC already allows you to do all of that
>PD_sketches_in_group.jpg
Well, I tried to do that (to have a Sketch Group inside a Body), and I failed miserably before. But Sasso just posted an image and file showing that is possible indeed. :shock: :shock: :shock:
Looking at the file, the solution is deep hidden and I'm sure for most newies like me almost impossible to find.
So allow me to share the complete solution:

After creating a Group, which will be placed outside the Body, the next step is to get it inside the Body. Dragging the Group inside the Body won't work, so the esoteric sorcery is :
1- Select the Body
2- On the Property "Group" click the 3 dots (...)
3- In the dialog add the Group just created (it is called "Sketches" in the sample file) by using the Ctrl key to add it to the selection. Click OK.
4- Drag the Sketches into the Group folder.
5- Done. Now is possible to reuse those sketches for PartDesign operations.
Attachments
Screenshot_20230205_050938.png
Screenshot_20230205_050938.png (164.73 KiB) Viewed 723 times
Hologram
Posts: 201
Joined: Thu Nov 03, 2022 3:05 pm

Re: Flexibility of sketches for the future of FreeCAD?

Post by Hologram »

@Lonfor thanks for posting the solution. That's quite involved actually. I'm pretty sure most people wouldn't come up with this solution unless they knew that it was possible to do somehow. It would be helpful if you could already get the sketch inside the body or part by default during its creation (e.g. through a preference setting or an interface checkbox). That would shave off some steps and help make it more discoverable.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Flexibility of sketches for the future of FreeCAD?

Post by saso »

Lonfor wrote: Sun Feb 05, 2023 10:12 am 5- Done. Now is possible to reuse those sketches for PartDesign operations.
Yes and No... I made the example in PD specially for the reason to show that it is also possible to do it in PD and yes this is how it was done and no I also don't think that this is how it should work :) BUT NO, you don't have to do this (use / add a group) to reuse the sketch, this is only if you want to have the sketches, or other things, grouped in the tree, you can reuse the sketch much more easily by just selecting it from the tree and use it again... Here however users actually most of the time want a different thing, use only part of the same sketch for different operations... This is indeed not yet possible in standard FC (workaround is to use a "sketch on sketch" technique, with a master sketch and then separate sketches with referenced external geometry from the master sketch) but it has been implemented in realthunders version in two ways, as direct selection and as sketch exports...

sketch_reuse.jpg
sketch_reuse.jpg (6.46 KiB) Viewed 662 times
Attachments
sketch_reuse.FCStd
(23.8 KiB) Downloaded 10 times
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

Re: Flexibility of sketches for the future of FreeCAD?

Post by Lonfor »

saso wrote: Sun Feb 05, 2023 10:40 am ....
Your help is much appreciated. :D
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Flexibility of sketches for the future of FreeCAD?

Post by drmacro »

saso wrote: Sun Feb 05, 2023 10:40 am
Lonfor wrote: Sun Feb 05, 2023 10:12 am 5- Done. Now is possible to reuse those sketches for PartDesign operations.
Yes and No... I made the example in PD specially for the reason to show that it is also possible to do it in PD and yes this is how it was done and no I also don't think that this is how it should work :) BUT NO, you don't have to do this (use / add a group) to reuse the sketch, this is only if you want to have the sketches, or other things, grouped in the tree, you can reuse the sketch much more easily by just selecting it from the tree and use it again... Here however users actually most of the time want a different thing, use only part of the same sketch for different operations... This is indeed not yet possible in standard FC (workaround is to use a "sketch on sketch" technique, with a master sketch and then separate sketches with referenced external geometry from the master sketch) but it has been implemented in realthunders version in two ways, as direct selection and as sketch exports...


sketch_reuse.jpg
Is is possible in standard FC. With the Subshapbinder, External geometry, and the WireFilter macro (in Addon manager).
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Flexibility of sketches for the future of FreeCAD?

Post by saso »

drmacro wrote: Sun Feb 05, 2023 11:24 am Is is possible in standard FC. With the Subshapbinder, External geometry, and the WireFilter macro (in Addon manager).
Uf, yes, I actually know about Subshapbinder :oops: , but WireFilter macro is new also for me... External geometry I guess is what I have described as a workaround or is there also another way with it?
Post Reply