[new feature] sketcher carbon copy

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

[new feature] sketcher carbon copy

Post by abdullah »

Hi!

Just an indication of a new sketcher tool called carbon copy just recently merged.

The aim of this tool is to allow a smart copy of sketch geometry from one sketch to another. The smart part is related to the fact that dimensional constraints are linked (via the expressions engine), so that any change in the value of a constraint in the original sketch propagates to all the carbon copies.

So, better to understand with an example. We start with this sketch:
cc1.png
cc1.png (26 KiB) Viewed 11284 times
We pad it and select the top face to make another sketch there (I have hidden the pad and shown the original sketch in the background):
cc2.png
cc2.png (17.97 KiB) Viewed 11284 times
The carbon copy tool is sensitive to the construction mode. So now I toggle to construction geometry mode and select the carbon copy tool (ugly icon between the add external geometry and the toggle construction geometry). And with it I am going to click on the geometry of the original sketch shown in the background:
cc3.png
cc3.png (30.51 KiB) Viewed 11284 times
The original sketch with all its constraints and dimensions automatically appears. This time as construction lines, because I selected construction mode on.

Now I toggle to normal mode and I am going to make a couple of holes coincident with the slot circle diameters. I use the carbon copied geometry just as a reference:
cc4.png
cc4.png (36.79 KiB) Viewed 11284 times
And I pocket through all.
cc5.png
cc5.png (25.94 KiB) Viewed 11284 times
Now I am going to make a new sketch on the top face of the pad and I am going to carbon copy the previous sketch I used for pocketing:
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] sketcher carbon copy

Post by abdullah »

cc6.png
cc6.png (19.98 KiB) Viewed 11282 times
cc7.png
cc7.png (37.68 KiB) Viewed 11282 times
As you can see all the geometry is copied also the construction geometry. We are going to toggle the construction geometry to normal:
cc8.png
cc8.png (27.46 KiB) Viewed 11282 times
Now we are going to make a new sketch mapped to translate and we are going to move it somewhere up in Z and rotate it.
cc9.png
cc9.png (24.43 KiB) Viewed 11282 times
cc10.png
cc10.png (39.01 KiB) Viewed 11282 times
In order to allow the sketch, that is not parallel and aligned to be imported, you need to press ALT (you are advised to do so in the status bar).

Now you loft the last two sketches:
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] sketcher carbon copy

Post by abdullah »

cc11.png
cc11.png (53.06 KiB) Viewed 11281 times
Now I am really unhappy with the result, so I modify the slot in the first sketch:
cc12.png
cc12.png (24.38 KiB) Viewed 11281 times
I exit edit mode and:
cc13.png
cc13.png (43.76 KiB) Viewed 11281 times
The end

Caveats:

1. All the glue between sketches is the constraints and expression engine. It is advised to fully constraint your sketches, or part of the sketch may repositioned properly and the rest not.
2. There are two modifiers CTRL to allow to link sketches outside of the PD Body and ALT to remove the direction/parallel plane checks. There is bug I just discovered, if in trouble use ALT+CTRL.

Happy CC-ing!!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: [new feature] sketcher carbon copy

Post by triplus »

Short review available here:

https://forum.freecadweb.org/viewtopic. ... 20#p169484

Although in the past i rather did such things manually i do see myself using Carbon Copy in some use cases to speed things up. Especially when the result of doing it manually would equal the one produced by Carbon Copy.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: [new feature] sketcher carbon copy

Post by sgrogan »

abdullah wrote:Happy CC-ing!!
Very cool.
Could this be leveraged to fix issue #2804
"fight the good fight"
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] sketcher carbon copy

Post by abdullah »

sgrogan wrote:
abdullah wrote:Happy CC-ing!!
Very cool.
Could this be leveraged to fix issue #2804
Thanks!!

I will take a look to that issue ;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] sketcher carbon copy

Post by abdullah »

sgrogan wrote:
abdullah wrote:Happy CC-ing!!
Very cool.
Could this be leveraged to fix issue #2804
https://github.com/FreeCAD/FreeCAD/pull/692
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: [new feature] sketcher carbon copy

Post by paullee »

abdullah wrote: Mon Apr 10, 2017 4:25 pm Hi!

Just an indication of a new sketcher tool called carbon copy just recently merged.

The aim of this tool is to allow a smart copy of sketch geometry from one sketch to another. The smart part is related to the fact that dimensional constraints are linked (via the expressions engine), so that any change in the value of a constraint in the original sketch propagates to all the carbon copies.

Now I am going to make a new sketch on the top face of the pad and I am going to carbon copy the previous sketch I used for pocketing:
Hi, this is a terrific feature! I thought there maybe some problem recently in carbon copy and I have make a post below ....after testing and re-reading this post, I understand only dimensional constraints are 'carbon copied' (see other remark on list 2 below).

https://forum.freecadweb.org/viewtopic. ... 10#p191610

Now there is a few issues in my mind-
  • the strange part remains is there is a 'Circular Dependency' error message in the status bar :?: in my test which i still do not understand
  • is this 'carbon copy' feature able to be extend to copy all constraints? Currently, more precisely, it is the 'dimension' part of a 'dimensional constraints is referenced.
  • Survive Topological Naming Problem?
- Understanding the inherent 'mechanism' of Carbon Copy, I think I used to do / test something similar 'manually', with uncertainty about topological naming as in my other post https://forum.freecadweb.org/viewtopic.php?f=8&t=23867

- my 'manual method works something like this, e.g. in original sketch, i put a Optional Name to e.g. 1 point Horizontal Constraints and Vertical Constraints. This is referenced in another sketch so the original constraints change, the referenced constraints get updated (i think not the other way around)

- As i 'hard-coded' the exact point I want to reference, even I add or remove lines in original sketch ( and the edges number in FC or OCC i don't know) and it recalculate, it would (seems should) survive. But I am not too sure.

- I understand the 'link to external geometry' would have problem when the original geometry have added or remove lines etc.

- I see in 'Carbon Copy' ....constraints is .....Sketch.Constraints[xx]... Is it a numbers and if there is constraints added or removed, would the numbers referenced be frustrated?

Thanks for any hints to understand how this works in more details! :)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] sketcher carbon copy

Post by abdullah »

paullee wrote: Sat Sep 16, 2017 1:08 am Hi, this is a terrific feature! I thought there maybe some problem recently in carbon copy and I have make a post below ....after testing and re-reading this post, I understand only dimensional constraints are 'carbon copied' (see other remark on list 2 below).
I do not have much time ATM but I somehow looked into it.

I see that most has been clarified in your linked post. See also my reply for the remaining bit:

https://forum.freecadweb.org/viewtopic. ... 26#p191826
Post Reply