Sketch mapping enhancement [merged to assemblyMergeMaster]

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
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement

Post by DeepSOIC »

jeno wrote:I would vote for mapping a sketch to the center line of a rotation-symmetric objekt.
Obtaining that is not easy.
So it will probably be made like that: select a circular edge. The mapping will have Y sketch axis along the normal to the circle, going through its center. Where should X axis be pointing - I don't know... Having it point randomly isn't great :(
jeno
Veteran
Posts: 1854
Joined: Sun Jun 29, 2014 10:41 am

Re: Plans for sketch mapping enhancement

Post by jeno »

Maybe I expressed me imprecise.
My intention was to get the x-axis in direction of the center line and the y-axis at the intersecion point of the center line and the center of the arc. The origin is then at the center point of the front face of the cylinder.
I voted for that, because until now one need a "helper" object to use the groove tool. Interestingly with the revolve tool it is not necessary to use a helper object. I do not understand why is it different, because when I want to make a undercut at a shaft I can make a revolve of the geometry and afterwards I do an boolean section and get my undercutted shaft. If I want to use the groove tool I should get the same in one step, but here I need the helper object. Maybe this might be the topic of another discussion.
Back to my vote. I think it is a common use case for mechanical enineering to modify zylinders away from the the "world" axis. As an example I would mention a crank shaft.
I hope this clarifies my point.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement

Post by DeepSOIC »

Development started, in branch SketchMapping1. Added a property to control mapping mode. Currently, two of three mapping modes are (slightly) functional (there's no UI for normal-to-edge mapping yet, support can be set via python).
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement [in progress]

Post by DeepSOIC »

Some progress.
Mapping modes so far:
"Deactivated" (just allows links to support)
"To Flat Face", (old mode)
"Tangent plane", (sketching on a plane tangent to a face at a vertex)
"Normal to path", (with adjustable parameter)
"FrenetNB", (sketch plane contains frenet-serret frame axes N and B (nurmal and binormal))
"FrenetTN", (T-tangent axis)
"FrenetTB",
"CenterOfCurvature" (same as FrenetNB, but sketch origin is at center of curvature)
All modes more-or-less work, but there's still no UI for setting up the support. I do it in console like so:

Code: Select all

App.ActiveDocument.Sketch001.Support = [App.ActiveDocument.Sketch, "Edge1"]
It is very important to settle on details... Once they get merged, changing them will become a problem...
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement [in progress]

Post by DeepSOIC »

After adding yet another mode (on three points), I feel like I am a bit of in trouble to make a UI for this many modes :|
Sometimes I begin to feel I will implement a whole assembly workbench going this way :ugeek: .
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement [in progress]

Post by DeepSOIC »

A small teaser.
Attachments
map_3points.png
map_3points.png (89.24 KiB) Viewed 1799 times
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Plans for sketch mapping enhancement [in progress]

Post by ickby »

Hello,

how does the example you showed work? You map a sketch to the three points, but what is the dwire in the tree? and where is the second sketch mapped to then?

Apart from that the result looks like an invalid solid, the connection of the two parts is non-manifold at the three vertices. I suppose you are trying to create separate objects depended on each other. However, principles of the part design workbench include the "linear feature dependencies" and the "one solid" rule. It should actually by design not be possible to create multiple solids in Part Design from one feature tree. The one-solid rule is not yet enforced by all tools, but in theory the revolution should not create a solid at all in this situation and this working must be considered a bug. Other tools, like the patterns, enforce this. Also not letting individual Part Design solids depend on each other was a deliberate design decision in view of a structure aimed at (body container)

So IMHO adding more mapping modes are a good thing, but this should not change the defined Part Design behaviour. One could add more work to the part design features enforcing the given rules, than the user can decides if he want to use part features with the mapped sketch to create a new part from the sketch.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement [in progress]

Post by DeepSOIC »

:cry: OK, consider it, that I'm working on Sketcher and Part, and don't touch PartDesign directly. Because I just don't get the purpose of that one independent solid restriction, it doesn't make any sense to me. Maybe it's because I'm no mechanical engineer.

Now, to the teaser.
DWire is doing nothing there. Just a bit of junk. Should have deleted it.
You are seeing two separate solids that depend on each other.
Sketch001 is mapped to an edge of Sketch. PartDesign revolve seems to be ignoring that Sketch is not a solid, and instead of failing, it just creates a new solid. According to you, this is a bug. I don't want this bug fixed, all I see is an opportunity to use it for making something I want.
ickby wrote: One could add more work to the part design features enforcing the given rules, than the user can decides if he want to use part features with the mapped sketch to create a new part from the sketch.
If it is anyway possible, why ban PartDesign from doing it?

Anyway, that doesn't relate much to what I'm doing...
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Plans for sketch mapping enhancement [in progress]

Post by tanderson69 »

IMHO: I think this work should abstracted away into another object/objects. Allow something like a datum coordinate system to be built from 3 points(or other constraint combinations). Then let the sketcher use a datum coordinate system as input. This ability to establish systems will have a larger scope than just sketcher.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Plans for sketch mapping enhancement [in progress]

Post by DeepSOIC »

Tanderson, your suggestion is interesting, but do you have a more specific idea of how this should be organized?
Here's how I see it:
a) body container, that contains a set of objects and has its own placement with the attachment modes.
b) a mapping functionality built into Placement.
c) a mappable Coordinate Subsystem object, that sketches can be mapped to (but not any other object unless the mapping is programmed explicitly)
d) a hybrid of b and c, ability to link to Coordinate System objects from Placement

All options sound too serious, and probably need to be discussed with main developers. And I don't feel myself ready to implement it (too much work).
Post Reply