Read and Save Parametric 2D Geometry for Sketches

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Read and Save Parametric 2D Geometry for Sketches

Post by catman »

The image shows two custom sketches for connector cutouts. It makes sense to re-use the shapes, e.g. saved in separate files next to the models of the parts that should go into the cutouts.

ExampleCutouts.png
ExampleCutouts.png (90.42 KiB) Viewed 4083 times


This is possible in FreeCAD using the new (green) subShape binder and drag and drop a sketch from another file to it. I use a standard FreeCAd with the cutout sketch only.
For example I have a 3D model EmergencyStopButton.FCSTD and E-StopCutout.FCSTD. For making the panel I only load the StopCutout file and access the sketch with a shape binder. I used DFX export/import before, but that way all Sketcher constraints, dimensions and line connections are lost so it was not a good approach.

Although the SubShapeBinders work pretty well it tends to clutter the tree. Since using Assembly3 my trees tend to be several pages long and I seek ways to shortem them. One would be to load the parametric 2D geometry directly into a sketch.
Thinking about this I find more and more use cases where saving and loading parametric 2D in a native FeeCAD format would be really useful.

Is there a specific reason why FreeCAD does not have a way to save native parametric 2D geometry from Sketcher?
Or is there some simple way to do that with Python like this (in Pseudocode)
GetCurrentDocument().GetSketch() > MySketch.x
GetCurrentDocument().GetSketch() < MySketch.x
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Read and Save Parametric 2D Geometry for Sketches

Post by adrianinsaval »

I'm confused, how is a subshapebinder more clutter than a sketch? It's just one object in the three
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: Read and Save Parametric 2D Geometry for Sketches

Post by chrisb »

You can copy/paste sketches. This is not parametric though.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Read and Save Parametric 2D Geometry for Sketches

Post by catman »

adrianinsaval wrote: Mon Aug 16, 2021 2:56 pm I'm confused, how is a subshapebinder more clutter than a sketch? It's just one object in the three
In an body the shape binder ist one leaf and an operation as pocket on it is another one. With a sketch the sketch moves as sub-leaf under the pocket.
But I was referring to something else: when a file is opened that uses external shape files all dependet files are also listed in the tree. For example above, it would open a Sub-D9_Cutout.FCSTD and a Connector_Cutout-FCSTD. When I would be using sketches no files would pop up, because there is not link.
chrisb wrote: Mon Aug 16, 2021 3:06 pm You can copy/paste sketches. This is not parametric though.
Very nice! I was not aware that worked between different files.
But it is parametic. At least it retains its construction geometry, constraints and dimensions. Its even better that within a single file because this awful selection box is not shown.
A good alternative to the shape binder approach.
Thanks
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Read and Save Parametric 2D Geometry for Sketches

Post by adrianinsaval »

catman wrote: Mon Aug 16, 2021 6:49 pm In an body the shape binder ist one leaf and an operation as pocket on it is another one. With a sketch the sketch moves as sub-leaf under the pocket.
Ah, I see your point now.
But I was referring to something else: when a file is opened that uses external shape files all dependet files are also listed in the tree. For example above, it would open a Sub-D9_Cutout.FCSTD and a Connector_Cutout-FCSTD. When I would be using sketches no files would pop up, because there is not link.
You could try using the single document mode for the tree view so other files won't be shown
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: Read and Save Parametric 2D Geometry for Sketches

Post by chrisb »

catman wrote: Mon Aug 16, 2021 6:49 pm But it is parametic.
I meant it is not parametric in the sense when you change the source where you copied from, then the target will not change. It is rather like a template then.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Read and Save Parametric 2D Geometry for Sketches

Post by catman »

chrisb wrote: Mon Aug 16, 2021 9:27 pm
catman wrote: Mon Aug 16, 2021 6:49 pm But it is parametic.
I meant it is not parametric in the sense when you change the source where you copied from, then the target will not change. It is rather like a template then.
Whatever the correct term for that is, I am glad that this is not the case, because it can be a very troublesome feature when you get changes to an existing project due to the change to anothe file stored elsewhere, especially when the link characteristic is not visible from both sides.
Post Reply