[New feature] Shapestrings in PartDesign or Sketcher

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!
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

chrisb wrote: Fri Jan 01, 2021 10:42 pm Having a ShapeString and a line of a sketch I can attach the ShapeString to that line, e.g. normal to an end of the line. If I want to align it along the line, I turn it by 90°. If I want it to be in the middle, I set MapPath to 0.5. Etc.
That is what I was afraid of! :D
Well if somebody wants that style of tool there is the perfect feature in the Draft workbench.

Personally I think it is a really un-intuitive and tedious way (for a beginner like me at least. I guess with experience you can get used to anything). In my view the sketch and its constraint solver are the central element in the PartDesign workflow. It makes sense to define the text position there, using the constraints that we all know and love.

The ShapeString works like a primitive in how it works. The primitives in PD actually feel alien to me, I wonder how many people use them.
chrisb
Veteran
Posts: 53938
Joined: Tue Mar 17, 2015 9:14 am

Re: Shapestrings in PartDesign or Sketcher

Post by chrisb »

davidosterberg wrote: Fri Jan 01, 2021 11:34 pm I wonder how many people use them.
I use them.

I don't say it is the best way to do it as described above. But it conforms to the current workflow. It may be sensible to redesign PartDesign, but then it should not be done solely for ShapeStrings - which by the way are not really main construction elements. If you want to do placement and such in Sketcher, then do it at least for other primitives too.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

I have started working on a PR
https://github.com/FreeCAD/FreeCAD/pull/4255

There is still a lot of work to be done on this though.
chrisb
Veteran
Posts: 53938
Joined: Tue Mar 17, 2015 9:14 am

Re: Shapestrings in PartDesign or Sketcher

Post by chrisb »

davidosterberg wrote: Fri Jan 01, 2021 11:34 pm The ShapeString works like a primitive in how it works.
Does your plan include that all ShapeString geometry is available for sketching? That would sort of make a difference to other primitives. But then external geometry references may suffice. I'm not sure about the other way round though, where you position the ShapeString by applying geometric constraints to arbitrary pieces of it, can be achieved by appropriate attachment.

We should Abdullah include in the discussion
Abdullah wrote:ping
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

chrisb wrote: Thu Jan 07, 2021 11:22 am Does your plan include that all ShapeString geometry is available for sketching? That would sort of make a difference to other primitives.
My idea is that it will work like the PartDesign->Hole, And PartDesing->Revolution

1) Make a sketch. In this sketch you make a construction line where you want your text to be (this idiom exist in Revolution tool, and Hole tool)
2) Select sketch and press text tool icon
3) In text tool you can chose font and size, padding direction, padding length
3) The text will appear like in the screenshot

I am considering if it is possible for the tool to offer to instead generate a new sketch. That way the user could edit the sketch and pad it himself / or revolve or whatever. But that would be like an advanced option, And I am not sure how to make the users edits to the sketch parametric.

Edit:
The main use cases I see for this feature is when you want some kind of simple text on your part.
E.g an item number, an engraving, or perhaps a simple sign. My main priority is that the tool is both fast and self explanatory for this use case.

Stuff like sweeping and revolving is a bit gimmicky (I will not optimize the workflow for these usecases, although I don't mind supporting them in some way)
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Shapestrings in PartDesign or Sketcher

Post by hyarion »

It feels like your implementation will only support one type of operation, pad/pocket and extending it to other types would require creating new tools or make one huge tool that does too many things.
If new features are added to the pad/pocket tools then it would also need to be added to this text-pad/pocket one.

I think it would be better to create the text on a 2d level to allow all tools that generate 3d geometries will be able to generate text as well.

The most intuitive way for me would to have this functionality in sketcher, but limit what the sketcher and solver can interface with to only the base line

In other words:
1. create a sketch on a body
2. create a text object in the sketch, but only expose the base line to the solver
3. close the sketch
4. pad the text-sketch

(this could also be extended to allow creating text on an arc)


You might be correct that 95% will only be straight text that is extruded but I think designing for that case only will make it a headache later. (other workbenches and macros might use your tool which makes it really difficult to adjust in the future)
chrisb
Veteran
Posts: 53938
Joined: Tue Mar 17, 2015 9:14 am

Re: Shapestrings in PartDesign or Sketcher

Post by chrisb »

davidosterberg wrote: Thu Jan 07, 2021 11:45 am My idea is that it will work like the PartDesign->Hole, And PartDesing->Revolution
Sorry I was still on the include-in-Sketcher-trip. This sounds like a good extension to me, similar to the helix, which can be seen as a shortcut for already existing tools. You may consider this in a second variant as a subtractive (i.e. pocket-like) feature too.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

Small demo:
demo1.gif
demo1.gif (569.16 KiB) Viewed 3808 times
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

hyarion wrote: Thu Jan 07, 2021 12:35 pm
The most intuitive way for me would to have this functionality in sketcher, but limit what the sketcher and solver can interface with to only the base line

In other words:
1. create a sketch on a body
2. create a text object in the sketch, but only expose the base line to the solver
3. close the sketch
4. pad the text-sketch

(this could also be extended to allow creating text on an arc)
This this is actually close to my first idea for this tool. But I discarded it as too complex for me at the moment.

Edit:
After Sketcher has been refactored so that new geometry types (and perhaps a sub type in this case) can be added without touching every single function, I agree that this would be very nice.
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: Shapestrings in PartDesign or Sketcher

Post by davidosterberg »

chrisb wrote: Thu Jan 07, 2021 12:38 pm This sounds like a good extension to me, similar to the helix, which can be seen as a shortcut for already existing tools. You may consider this in a second variant as a subtractive (i.e. pocket-like) feature too.
Exactly! Regarding the subractive/additive I am on the fence. On the one hand I want to follow the existing metaphor in PD, with separate subractive and additive tools. On the other hand I would like to try out how it feels to just have one tool that does both. I don't have a strong opinion.
Post Reply