View Issue Details

IDProjectCategoryView StatusLast Update
0002659DraftFeaturepublic2016-08-15 13:49
Reporteryorik Assigned Toezzieyguywuf  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformPCOSDebianOS VersionTesting 64bit
Summary0002659: Allow to make sketch from draft object that is not in the XY plane
Description1) Give the created sketch the same placement as the Draft object
2) When adding geometry to the sketch, it must be first converted to the sketch coordinates (apply inverse placement)
TagsNo tags attached.
FreeCAD Information

Activities

ezzieyguywuf

2016-08-05 12:27

developer   ~0007248

I will work on this bug. I figured out the "Placement" bit, still figuring out the Geometry piece.

Since the user can select multiple Draft objects to convert to sketch, each of which may be on different working planes, I propose that if Draft objects with multiple working planes are selected, a dialog pops up asking the user if they wish to create multiple sketches or to abort the operation.

Alternatively, I could just have it make multiple sketches silently.

yorik

2016-08-05 13:25

administrator   ~0007250

Great! I'll upgrade you to "developer" so you can attribute bugs to yourself. If you wish, take this one for you! ;)

I suppose you already figured out where this all happens, Draft.py in the makeSketch() function.

For the geometry, once you have the placement, it's just a matter of applying its inverse to all the geometry that needs to be added to the sketch, for ex:

- you have an edge
- you have the placement, you take its inverse (Placement.inverse)
- you add to the sketch not the edge itself, but a copy of the edge whose placement is multiplied by the inverse above. That will have the effect of expressing the same edge in the coordinates system of the placement.

About the problem you mention, indeed I thought about hat problem too... There is also the problem that the tool can convert not only Draft objects to sketches, but any part object. And for some of them you might no be able to get a placement (for example a single line, "floating" in space, what is its normal?).

I think I would go the incremental way, that is, do the placement/geometry transformation above only if we are in a clear case, that is, we have one 2D object (isDervivedFrom("Part::Part2DObject"), which is the case of all Draft objects, or many objects that are coplanar. For all other cases, I wouldn't bother much and leave things as they are for now...

ezzieyguywuf

2016-08-05 14:35

developer   ~0007251

Yes, I agree with you on the incremental approach. I'll work on doing as you've outlined. I understand completely what you're saying, that shouldn't be too hard to code, but I want to spend some time understanding what's going on under the hood. It would seem to me that I'd want to apply a transformation to the Curve object before adding it to the sketch, so I want to understand how this Placement thing works and why it does what it does.

Thanks for upgrading me to Developer I feel so fancy!

ezzieyguywuf

2016-08-05 14:36

developer   ~0007252

I can confirm that this is an issue.

ezzieyguywuf

2016-08-05 20:40

developer   ~0007253

@Yorik: using your suggesting I was able to solve the bug for the case of Rectangle and Circle, however for Arcs and Lines it is doing some funny stuff. I'm going to spend some time diving in a bit deeper, but if you have any suggestions I'm open to hearing them.

ezzieyguywuf

2016-08-15 13:49

developer   ~0007277

This issue has been fixed with pull request[247](https://github.com/FreeCAD/FreeCAD/pull/247)

Issue History

Date Modified Username Field Change
2016-08-04 18:18 yorik New Issue
2016-08-04 18:18 yorik Status new => assigned
2016-08-04 18:18 yorik Assigned To => yorik
2016-08-04 18:18 yorik Project FreeCAD => Draft
2016-08-05 12:27 ezzieyguywuf Note Added: 0007248
2016-08-05 13:25 yorik Note Added: 0007250
2016-08-05 14:35 ezzieyguywuf Note Added: 0007251
2016-08-05 14:36 ezzieyguywuf Assigned To yorik => ezzieyguywuf
2016-08-05 14:36 ezzieyguywuf Note Added: 0007252
2016-08-05 14:36 ezzieyguywuf Status assigned => confirmed
2016-08-05 20:40 ezzieyguywuf Note Added: 0007253
2016-08-15 13:49 ezzieyguywuf Note Added: 0007277
2016-08-15 13:49 ezzieyguywuf Status confirmed => closed
2016-08-15 13:49 ezzieyguywuf Resolution open => fixed