Unlimited references to external geometry

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

Unlimited references to external geometry

Post by DeepSOIC »

Hi!

I can't stop myself from doing it because I need it BAAAD! I have disabled checks in references to external geometry in Sketcher, so now I can link sketches to anything. It seems to work well. Beware circular references!

I feel like there is a reason why this wasn't done in master by now. I guess this is probably because of future plans for object container and assembly workbench. So, should one decide to use this, beware, that your files may fail to work in future FreeCADs.

Here's the branch:
https://github.com/DeepSOIC/FreeCAD-ell ... _externals
And a teaser (works in master, you can check without compiling anything :mrgreen: ):
link-between-sketches-test.FCStd
(7 KiB) Downloaded 91 times
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Unlimited references to external geometry

Post by bejant »

When I try to Pad a Sketch, no matter which one I select, it is always the rectangle that Pads. But, maybe my FreeCAD version is incompatible...
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unlimited references to external geometry

Post by DeepSOIC »

bejant wrote:When I try to Pad a Sketch, no matter which one I select, it is always the rectangle that Pads.
Thanks for pointing that out, it is the same in my branch.

I guess it's because of the bug mentioned here: Wrong sketch gets padded, issue #1854.
I'll try to fix it.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unlimited references to external geometry

Post by DeepSOIC »

git commit f04225c4d466cbe528667029f1332717ef0790ee
Fixed.
I'll make a pull request for the fix.
atzensepp
Posts: 100
Joined: Tue Feb 24, 2015 9:37 pm

Re: Unlimited references to external geometry

Post by atzensepp »

Question related to this:
DeepSOIC wrote: I have disabled checks in references to external geometry in Sketcher, so now I can link sketches to anything. It seems to work well. Beware circular references!
Does this mean that one could use external references to surfaces of more than one object?
If yes: are there plans to implement it in the official releases?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unlimited references to external geometry

Post by DeepSOIC »

You can link to vertices and edges of any number of objects in the document (except meshes). But if you create a reference that forms a loop in dependency graph, FreeCAD's recompute mechanism locks up completely (I even thought on using it to disable recomputes temporarily :lol: ).
atzensepp
Posts: 100
Joined: Tue Feb 24, 2015 9:37 pm

Re: Unlimited references to external geometry

Post by atzensepp »

Hello DeepSOIC,

Trying out the build with unlimited external references, I can say that I would be extremely glad if it would be incorporated into the main release since it
would ease up parametric modelling a lot without weird work arounds. If it is regarded as "dangerous" it might be an idea to provide a toggle-off switch for it. But IMHO sooner or later this is a must.

Nevertheless I encountered some strange behaviour that may be worth a closer investigation:
In some cases the external geometry picker shows the edge but not the vertices. I have uploaded an example:
Haus5.fcstd
(19.59 KiB) Downloaded 76 times
.

The other problem (also in standard FreeCAD) is that when a solid based on a sketch is recalculated - e.g. due to a resize operation - the references to vertices and edges get lost.
Haus5.fcstd
(19.59 KiB) Downloaded 76 times
Constraint solver mourns with "undetermined degrees of freedom"
Attachments
Haus5b.fcstd
(30.29 KiB) Downloaded 55 times
After changing the length of the house (x position of clone) the right roof section is recalculated breaking references of the left roof
After changing the length of the house (x position of clone) the right roof section is recalculated breaking references of the left roof
Hausi2.png (145.33 KiB) Viewed 3577 times
The external reference (green edge) on the right side is lacking the vertex points.
The external reference (green edge) on the right side is lacking the vertex points.
Hausi1.png (23.18 KiB) Viewed 3581 times
atzensepp
Posts: 100
Joined: Tue Feb 24, 2015 9:37 pm

Re: Unlimited references to external geometry

Post by atzensepp »

A parametric toy house.
Huas5c.fcstd
Parametric House
(45.1 KiB) Downloaded 62 times
The side walls can be parametrized with the first Sketch.
The length of the house via x-position of the first clone.
"Clone of Extrude010" is the first floor. It's z-position is the ceiling height.
(B.t.w. is there a way to give names to the objects?)
Attachments
Parametric House.png
Parametric House.png (75.21 KiB) Viewed 3571 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unlimited references to external geometry

Post by DeepSOIC »

OK, I found what's going on with that green edge. Edge7 fails to link because there already is another link to "Edge7" of something else in this sketch. It is a check against adding the same reference twice, which assumes that only links to one object are possible, thus not checking object equality. I'll fix that. Thanks for reporting!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unlimited references to external geometry

Post by DeepSOIC »

Fixed ;)
Post Reply