create a tool to allow editing non-parametric shapes

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft wire and spline edit mode errors

Post by yorik »

I am always lazy to touch that editmode :) the code is pretty messy
Actually one of these days it could be extended to work on full (non-parametric) 3D objects too... It wouldn't be that hard, just note which vertex has moved, then recalculate all the faces with that new vertex position...
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Draft wire and spline edit mode errors

Post by jmaustpc »

yorik wrote:I am always lazy to touch that editmode :) the code is pretty messy
Actually one of these days it could be extended to work on full (non-parametric) 3D objects too... It wouldn't be that hard, just note which vertex has moved, then recalculate all the faces with that new vertex position...
Hi Yorik
That could be a real cool feature. On simple things I imagine that would not be very difficult. How hard it would be on more complex shapes though? If you could make it work well, think of how useful that could be when importing legacy files and the like. If someone only gave you a step file, you could import it, and perhaps some times the simplest way to edit it would be something similar to what you are talking about here? That is, note the change in the edited vertex then recalculate what is effected by that changed in vertex...or recalculate the whole shape. For complicated shapes and edits, I could imagine this being difficult and buggy, but for simple things it sounds interesting....

Jim
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft wire and spline edit mode errors

Post by yorik »

Yes, it would obviously give a hell of a complication in complex shapes, with curves, etc. But for simple, prismatic objects, why not? Basically the way I see it it would imply this:

in Draft Edit:
- check if the object has no curves (all edges are derived from Part Line):
- get the position of an original vertex and its new position

in a new Draft function:
- find the vertex that has the original position
- find all faces that have that vertex
- redo these faces with the new vertex
- rebuild a shell from all faces
- rebuild a solid from the shell, if the original one was a solid

possible extension:
- instead of eding the original shape, create a new parametric feature, that links to the original object and its vertex, and has a "delta" property. This would allow to elso edit parametric objects, and keep the edit.

I created an issue on the tracker for this ( issue #1367 ). If someone wants to work on this before me (no time before a couple of weeks), feel free!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Draft wire and spline edit mode errors

Post by jmaustpc »

yorik wrote:in Draft Edit:
- check if the object has no curves (all edges are derived from Part Line):
- get the position of an original vertex and its new position
As an extension to the above, couldn't we look at the edges, list any that are "problematic" due to being a curve or any other reason, and refuse to edit only their associated vertices and thus still allow editing of straight sections of the shape even if it has curves that would not be effected by the vertex edit being performed?
yorik wrote:possible extension:
- instead of eding the original shape, create a new parametric feature, that links to the original object and its vertex, and has a "delta" property. This would allow to elso edit parametric objects, and keep the edit.


that's a good idea.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

create a tool to allow editing non-parametric shapes

Post by jmaustpc »

This is split of another topic.

was originally here where we began to hi-jack the topic.

viewtopic.php?f=10&t=5369
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft wire and spline edit mode errors

Post by yorik »

jmaustpc wrote: As an extension to the above, couldn't we look at the edges, list any that are "problematic" due to being a curve or any other reason, and refuse to edit only their associated vertices and thus still allow editing of straight sections of the shape even if it has curves that would not be effected by the vertex edit being performed?
Hm maybe, but I'm not sure we can recompose the solid with 100% precision in that case... That needs to be tested.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: create a tool to allow editing non-parametric shapes

Post by jmaustpc »

I've been wondering if it might make more sense to make this a "vertex" editor for non-parametric objects. The idea being you can only move one vertex at a time.

You would select a vertex of the shape
Part a)
1) test if the shape associated with the selected vertex is a vertex only or a line only, and if so allow total freedom of movement for the vertex.
Part B)
2) if it is a surface of shell or solid, then list all edges associated with that point, if they are straight lines, allow editing of the position of that vertex.
3) read the other end points/vertices of those straight lines, use their position values x y z to define a maximum valid range of new location available for that vertex such that it would not destroy or add edges to the shape
4) then rebuild the shape, or a copy of the original shape, to the new vertex.

Does that make sense?

Jim
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: create a tool to allow editing non-parametric shapes

Post by yorik »

Yes, but once we have vertex editing, it can be very easy to extend so you can move or rotate edges or faces (just move all their vertices)

About your workflow, if we have an object made only of straight edges, I'm pretty sure we can "explode" and "recompose" it reliably (it works with Draft downgrade + upgrade, for example), but if that object contains curves, even if you are moving a vert that is not directly connected to a curved edge, I'm not totally sure it'll work reliabley... This needs to be tested before.
Post Reply