Copying a Sketch Issue

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!
Post Reply
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Copying a Sketch Issue

Post by bejant »

When a Sketch is copied, it still retains a link to its parent object. To explain the issue I'll use a simple example:
  • Go to the Part Design WB
  • Click File, then New
  • From the Tasks tab select Cube
  • Select the top face of the cube, then select Create Sketch
  • Sketcher a circle, then close the Sketch
  • Select Pocket, then click OK
  • Select the Model tab, then expand "Pocket"
  • Select "Sketch"
  • Ctrl + C to copy it
  • Select "No" in the Object Dependencies pop-up window so the unselected dependency is not also copied.
  • Ctrl + V to Paste, creating "Sketch001".
Which brings us to the issue. "Sketch001" is still Mapped to "Cube". So if someone edits "Sketch001" and makes another Pocket, the model is now forked.

We can Pocket two holes at once from the same Sketch (IIRC some time ago we couldn't) so now I'm thinking that when a Sketch is copied it should not have a link to its parent. The user should have to Map (in this example "Sketch001") to the desired face before an additive or subtractive operation can be performed. "Sketch001" would have to be Mapped to a different face anyway (I can't think of a good reason why two different Sketches would be Mapped to the same face, but that doesn't mean a good reason doesn't exist).

To me it seems less objectionable to have to Map a Sketch to a face (a Remap would have to be done anyway) than allowing the user to inadvertently fork the model and I would like to know other opinions about this.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Copying a Sketch Issue

Post by wmayer »

The copy&paste mechanism is part of the core system of FreeCAD and all what it does is to serialize the selected objects and restore them. It's true that in certain cases something undesired happens but there is no way for the mechanism to determine this.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Copying a Sketch Issue

Post by jriegel »

As Werner said, the copy/paste mechanism is at the moment relatively class agnostic. For the future we will sure need a paste mechanism located in certain workbenches (e.g. PartDesign) and certain classe (e.g. Body) to handle special cases. Only the application logic of the a certain workbench can deal with such cases (like rebasing sketches or other heavy linked objects).

In Assembly branch I started already a more general cut/copy/past/drag/drop interface to ViewProvider and Workbenches which can handle such application specific cases.
Stop whining - start coding!
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Copying a Sketch Issue

Post by wmayer »

In Assembly branch I started already a more general cut/copy/past/drag/drop interface to ViewProvider and Workbenches which can handle such application specific cases.
Why there and not in a separate branch?
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Copying a Sketch Issue

Post by jriegel »

So far I need it for Assembly. But it can also be used later on to do special treatment for all kind of objects....
Stop whining - start coding!
Post Reply