PartDesign Next: Links to external geometry in Sketcher

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
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

PartDesign Next: Links to external geometry in Sketcher

Post by DeepSOIC »

Hi!
I'm very very disappointed in that free sketch-to-sketch linking is blocked again.
Example.
1. In sketcher workbench, make a new sketch, draw rectangle, close.
2. Deselect the new sketch, and create a new free-standing sketch
3. try to link an edge.
Says "Not allowed". :evil:
4. PartDesign workbench, create a new
5. Move sketches into Part (by dragging them in tree view).
6. Try to link from one sketch to other.
"Not allowed" again :evil:
7. Create a new body, and create a sketch there (from within PartDesign)
8. Try to link to Sketch's edge. Now, finally, I see something like "hold Ctrl to allow", and it's linked.
I think, since links between parts are allowed, the links must be allowed from anywhere when holding Ctrl. Otherwise it totally doesn't make any sense to me! I want to use sketches for Part workbench, for Lattice, for Draft, ... for almost everything! Please!! Don't lock sketcher goodness to PartDesign!
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Next: Links to external geometry in Sketcher

Post by ickby »

hello,

There was actually no general intend to block it, this is a bug actually. With local coordinates in place and the new PartDesign structure it does not make sense anymore to not allow the complex links. I think the best behavior is to allow all links within the same coordinate system by default and require ctrl for links outside of the used coordinate system just to avoid accidental confusing complex dependency structures.

Can you create a ticket and assign it to me?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PartDesign Next: Links to external geometry in Sketcher

Post by DeepSOIC »

ickby wrote:There was actually no general intend to block it
Phew, what a relief!! :)
issue #0002514
I can't seem to be able to assign bugs. And by the way, the latest FreeCAD version allowed to select is 0.15 :| Mantis needs a fix ;)
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: PartDesign Next: Links to external geometry in Sketcher

Post by NormandC »

ickby wrote:Can you create a ticket and assign it to me?
ickby, very few people can assign bugs, it depends on their role. Regular reporters can't. Possibly even developers... I'm not sure.
DeepSOIC wrote:And by the way, the latest FreeCAD version allowed to select is 0.15 :| Mantis needs a fix ;)
I tried to set 0.16 as published and create 0.17. 0.16 is still not published. That Mantis thing is as intuitive as phpBB admin. :roll:
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Next: Links to external geometry in Sketcher

Post by ickby »

NormandC wrote: ickby, very few people can assign bugs, it depends on their role. Regular reporters can't. Possibly even developers... I'm not sure.
Ah didn't know that, thanks

@DeepSOIC: I enabled the linking from sketches to other coordinate systems in my lokal bugfix branch. However, this kind of cross-referencing somewhat breaks the whole coordinate system structure. Crosslinks always use the local CS of the part they link to and don't respect CS transformations. This makes sense IMHO within PartDesign with the special shapebinder and datum tools which could explain such behavior as special feature and where it is quite handy modeling wise. But everywhere else it seems very arbitrary, even faulty. Also what would be the purpose, why would one link from sketch in a part to a sketch in annother? Woudn't it make sense to than enforce sketches to be in the same part? Seems like it would not loose any usefullness. Than on the other hand this would be hardly be achievable as the use can drag/drop the sketches after creation everywhere. What do you think about that?
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Next: Links to external geometry in Sketcher

Post by ickby »

After thinking longer about this It may be best if crossreferences between CS always respect coordinate system transformations. Than one can use the datum/shapebinder tools if one wants the transformationless local geometry and crossreferences if one wants the transformed one. This makes sense and is consistent. Also it than allows to move sketches between CS while beeing consistent.

Using crossreferences leads than to the behavior that moving one cs will change things in the other, exactly what we tried to pprevent in 016. But as the user has the choice now if he wants this behavior or another this is IMHO OK.

This requires quite some coding effort (Datums need to go int part, infrastructure for CS handling and links needs to be updated), so we need to be sure this is a good way to go.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PartDesign Next: Links to external geometry in Sketcher

Post by DeepSOIC »

I see a problem.
Let's have this:
Sketch1 in Part1 and Sketch2 in Part2
Sketch2 wants to use geometry from Sketch1
Result: Graph not DAG, because to make things proper, we need to introduce a dependency of Sketch2 on placements of both Part1 and Part2. -> Sketch2 depends on Part2 and Part2 depends on sketch.

Conclusion: cross-linking with respecting coordinate systems is impossible. Or we need to introduce special handling of that in recompute logic, because there is no actual circular dependencies. It is circular on object level abstraction, but it's not in "property level" abstraction.

I'm OK with obligatory use of shapebinder for cross-part links.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Next: Links to external geometry in Sketcher

Post by ickby »

I see your point, but IMHO the implementation of coordinate systems etc. must not rely on links at all, that is not a general implementation. IMHO there must be code in the main system that allows to calculate relative placements between multiple coordinate systems by walking the local CS tree. the individual object cannot know at all in which CS it is used and how many of them are stacked.

For your example this would result in sketch2 be dependend on Sketch1 only. When execute Sketch2 does something like this pseudo code:

Code: Select all

shape = sketch1->getShape()
transform = document()->getTransformBetween(sketch1, sketch2);
shape = transform*shape;
This requires 2 things:
1. The CS walking infrastructure to calculate transformations between CS
2. Update of the recompute logic to also recalculate sketch2 if the transformation between sketch1 and sketch2 changed

That is than basicly the whole infrastructure needed for assembly :) Most likely too much for the PartDesign work we are currently doing, best to make this work properly first.

So I support your idea to enforce the datum/shapebinder approach for now and dissallow all crossreferences. We can enable that when the infrastrucure is available.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PartDesign Next: Links to external geometry in Sketcher

Post by DeepSOIC »

I would love if we could change this:

Code: Select all

shape = sketch1->getShape()
transform = document()->getTransformBetween(sketch1, sketch2);
shape = transform*shape;
to this:

Code: Select all

shape = sketch1->getShape(context)
, and getShape will automatically include all transformations into the result.
This is because the code needs to be updated in almost everywhere to account for transformations.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PartDesign Next: Links to external geometry in Sketcher

Post by DeepSOIC »

ickby wrote:So I support your idea to enforce the datum/shapebinder approach for now and dissallow all crossreferences.
I think it originally was your idea that I didn't like back then :mrgreen:

More thoughts.
* This linkage problem is universal. It's not just sketcher. What if I try to fuse a box from Part1 with a cylinder from Part2.
* introducing implicit dependencies to avoid circular dependencies sounds like a quick hack that may have very serious consequences in the future. It is a dependency after all. And imagine, how hard will it become to find a problem if this dependency will happen to be a chain of a real dependency loop?
* Part-to-Part geometry links can be limited to be able to include ONLY placement of Part1, but not of Part2. If the user still wants that dependency, it may be possible to invent a workaround. Like: placement of Part2 is linked to Placement object (like Lattice Placement). Then, user applies an inverse transformation of that Placement to shapebinder to arrive to the wanted result. Now, the loop is avoided, but Part2 is not freely moveable anymore (one has to move Placement object to move Part2).
Post Reply