Sketcher feature request: "publish" any element

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
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Sketcher feature request: "publish" any element

Post by Pauvres_honteux »

Hi, I guess this one is targeted at
abdullah wrote:ping
.

I'd like to propose a function to make any element in sketcher manually and purposely publicly available outside of the sketcher.
Additionally it would be nice with a function to make a "public profile" out of anything one click on (in an ordered manner). This simplifies the work with skeletons and makes them more versatile.

Example points) All center points in one sketch. One publish them as groups or as individuals. Then one can use the separate group(s) as basis for user defined hole patterns. Odd hole dimensions are manually linked to separate published points. The beauty in this is that one has only one sketch were all relations are easily defined with respect to each other, i.e. change in one place and update everything in one go. This will also be a super nice feature when using Assembly3 and positioning a few hundred screws and their washers and their nuts and.... Extra nice when your colleague changes some hole positions a few zilly-meter without telling you...

Example profiles) A lot of relations between profiles is needed so the simplest way will be to have them in one sketch. One then just starts the profile function and serial-click along until satisfied. Repeat this till intended number of profiles are created. Now these profiles (open or closed) can be used for whatever one pleases outside the sketch. Probably most used for projecting into other sketches for various purposes. At work I usually use them for offsetting after I projected them and then start off from there.

I'd also like to have these "published" elements visible as separate entries in the tree. Selectable of course.
Edit = blue color
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher feature request: "publish" any element

Post by abdullah »

I do not understand the concept, but I will try to imagine it...
Pauvres_honteux wrote: Sun Feb 11, 2018 10:59 am Hi, I guess this one is targeted at
abdullah wrote:ping
.

I'd like to propose a function to make any element in sketcher manually and purposely publicly available outside of the sketcher.
Additionally it would be nice with a function to make a "public profile" out of anything one click on (in an ordered manner). This simplifies the work with skeletons and makes them more versatile.
I am not sure I understand all the implications. A sketch is as public as any other element. A line from one sketch can be linked via external geometry from another sketch.
Pauvres_honteux wrote: Sun Feb 11, 2018 10:59 am Example points) All center points in one sketch. One publish them as groups or as individuals. Then one can use the separate group(s) as basis for user defined hole patterns. Odd hole dimensions are manually linked to separate published points. The beauty in this is that one has only one sketch were all relations are easily defined with respect to each other, i.e. change in one place and update everything in one go. This will also be a super nice feature when using Assembly3 and positioning a few hundred screws and their washers and their nuts and.... Extra nice when your colleague changes some hole positions a few zilly-meter without telling you...
The element defining the center hole can be linked from another sketch, then you can define holes by using circles. I can imagine some functionality may be welcome to automate such an operation (for example, that clicking a shape already creates a new sketch with linked external geometry and circles for hole definitions). From a 3D point of view, a new PDN feature, for example, taking as input an array of circles defining the centers of a pattern could be created to enable this "user defined" pattern replication.

A sketch defines a 2D space, so using it for assembly positioning may lack one dimension in a general case. I generally tend to think that an assembly wb should be able to handle those situations when a hole changes (it changes position on a face or even the depth changes).
Pauvres_honteux wrote: Sun Feb 11, 2018 10:59 am Example profiles) A lot of relations between profiles is needed so the simplest way will be to have them in one sketch. One then just starts the profile function and serial-click along until satisfied. Repeat this till intended number of profiles are created. Now these profiles (open or closed) can be used for whatever one pleases outside the sketch. Probably most used for projecting into other sketches for various purposes. At work I usually use them for offsetting after I projected them and then start off from there.
This limits to 2D relations, as define by a single sketch. The case with the profiles, as I understand it, is what the PDN helix tool does, use a sketch defined profile in an operation. The profile may be defined based on a master sketch by importing external geometry (which brings me back to something I wanted to implement in the sketcher, i.e. that external geometry can be made defining a sketch or not by switching the "construction mode").

There is one major thing I do not quite understand. If a sketch defines a 2D space, what exactly does the publish function do in order to enable it to be projected into a 2D space again?
Pauvres_honteux wrote: Sun Feb 11, 2018 10:59 am I'd also like to have these "published" elements visible as separate entries in the tree. Selectable of course.
Edit = blue color
So now it seems to me that you want to have like datums (point, line, plane) controlled by a sketch. This you can do using the expression engine to map the placement of the datums to a sketch. Automation might be brought in, but it must be defined how.

It is not that I am dismissing your idea, I am trying to be critical so that you understand what I not understanding and better define what you are looking for, which should allow me to understand it. As far as I understand it, you are not asking for a sketcher functionality extension, but something that expands multiple WBs. Such an idea expanding multiple WBs has to be incredibly well defined before creation. Otherwise it is marked for failure. Think of how I replied and try to better define what you want. :)
User avatar
saso
Veteran
Posts: 1924
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Sketcher feature request: "publish" any element

Post by saso »

This idea (or similar) was discuses before several times, here is one example https://forum.freecadweb.org/viewtopic. ... 44#p204644 and I agree that it would probably be very useful for different users.

As said before, Lattice2 -> SubLink is a very similar tool, the idea here is however that this elements would be managed (create, edit, remove) from inside the sketch, similar for example to how we manage and "publish" named constraints of a sketch. In the tree I guess it could look something like the following image, note that this "published" elements are represented as children of the sketch (ps, I just quickly modified this image in gimp to represent the idea, I don't know if this elements should actually be the same type as shown here, eg from the draft wb).

Untitled.png
Untitled.png (4.78 KiB) Viewed 4746 times
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Sketcher feature request: "publish" any element

Post by realthunder »

I have implemented a new type of shapebinder in my branch that can "publish" internal elements of a sketch. Maybe it's not the best way, but at least shall give you some idea. It is currently using the fragile element type + index references, but can be easily changed to use the sketch internal uuid for linking. In fact, I think I'll do just that.

Image
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Sketcher feature request: "publish" any element

Post by realthunder »

Here we go. More robust reference of 'private' elements of a sketch,

Image

abdullah wrote: Wed Feb 14, 2018 1:34 pm ping
Any particular reason you want to use uuid as tag? IMO, an incremental index can serve the same purpose, and saves a lot of typing in expression.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Sketcher feature request: "publish" any element

Post by Pauvres_honteux »

realthunder wrote: Sat Feb 17, 2018 2:06 am ... More robust reference of 'private' elements of a sketch...
Ok, now you're officially among the fastest coders around! Applause!!

So now I think it's time for you to test if my idea have a chance to work. I made a file containing a model of a screw in one Part and one hole center pattern in another Part. I deliberately moved/transferred the hole patterns Body a few millimeters in all direction and put the whole thing on a plane not parallel to the screw heads contact plane.
.
Hole_pattern_1.png
Hole_pattern_1.png (8.36 KiB) Viewed 4264 times
abdullah wrote: ... A very big thank you for your latest "hide/show constraints"...
.
Hole_pattern_2.png
Hole_pattern_2.png (45.72 KiB) Viewed 4264 times
.
Pattern_test_Hole_centers.png
Pattern_test_Hole_centers.png (47.86 KiB) Viewed 4264 times
.
Now the different point groups shall be made visible and selectable in the tree, that is, outside of the sketch.
.
Pattern_test_Hole_centers_Tree_view.png
Pattern_test_Hole_centers_Tree_view.png (17.73 KiB) Viewed 4264 times
.
The_very_file___Pattern_test_Hole_centers.fcstd
(45.45 KiB) Downloaded 64 times
.
Somehow (datum?) lines shall be connected to these points and be normal to a surface of choice, in this case the same plane as the sketch is attached to. This gives the direction normals/vectors for the screws. I think these normals/vectors shall be grouped as well, for easy selection later and "easy" change of content (when your boss comes and yells at you to change some directions and positions).

Next are the "pièce de résistance" screws easily positioned with some magic strike of your wand! :D
saso wrote: Thu Feb 15, 2018 8:54 am ... Lattice2 -> SubLink is a very similar tool, the idea here is however that this elements would be managed (create, edit, remove) from inside the sketch, similar for example to how we manage and "publish" named constraints of a sketch. In the tree I guess it could look something like the following image, note that this "published" elements are represented as children of the sketch...
You managed to decode my cryptography!!! :lol:
This was exactly how I originally imagined it !
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Sketcher feature request: "publish" any element

Post by Pauvres_honteux »

Above done with
Pattern_test_done_with_FreeCAD_version.png
Pattern_test_done_with_FreeCAD_version.png (12.08 KiB) Viewed 4264 times
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Sketcher feature request: "publish" any element

Post by realthunder »

Pauvres_honteux wrote: Sat Feb 17, 2018 11:08 am So now I think it's time for you to test if my idea have a chance to work.
Well, your idea is kind of complicated. You actually want a circle in this case, which conveys both the position and normal information. You don't need any other datum objects. This is a pretty trivial use case for an assembly workbench. I wanted to demo this on my asm3, but find it a bit tedious to have to manually create elements and all. So, I adopt saso's idea. Here we are, ta dah...

Image
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Sketcher feature request: "publish" any element

Post by realthunder »

Let's complete this proof of concept attempt. One benefit of using sketch export is that you can have robust reference to geometries. Instead of those Edge1, Vertex2, SketchExport uses uuid. Previously, this uuid is only used internally. If you select the exported geometry in 3D view, you still have Edge1 and stuff. Now I made uuid reference work in 3D selection too. I'd say a sketch export is now as good as a datum object. As I shown in the following screencast, you can see that the original sketch selects with generic type + index when not editing, but the export uses uuid instead.

abdullah wrote: ping again
I still think this uuid reference adds too much verbosity. Any chance to change it to incremental indices?

Image
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher feature request: "publish" any element

Post by microelly2 »

Is it possible to extend the data model to add a Label attribute to the geometries?
The uuid is not realy human readable.
Post Reply