Copying features and feature scope variables

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
wesbrooks
Posts: 35
Joined: Thu Aug 13, 2015 8:10 am

Copying features and feature scope variables

Post by wesbrooks »

Hi all,

I've got five features that are nearly identical save from the centre location, and offset of a couple of features in sub sketches. In python if I had a 5 modules that were this similar I'd create a master module and send variables to alter the modules behaviour to suit.

At the moment I have to create the five features (thankfully can copy sketches) and then edit the sketches to refer to specific variables in a spread sheet.

Can someone please point me towards a tutorial that would help save me a tonne of time here? I mainly work in part design work bench.

Using freecad-daily on 64bit Ubuntu. Thanks in advance for any help!
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Copying features and feature scope variables

Post by kisolre »

You could use Carbon Copy and then change the expressions to the appropriate spreadsheet cells. Which probably is what you are already doing with your copy process. How is that different from typing "Sketch015(Spreadsheet012.Val1, Spreadsheet012.Val2, Spreadsheet012.Val3, Spreadsheet012.Val4, Spreadsheet012.Val5,...)" or do I not understand what you want?
wesbrooks
Posts: 35
Joined: Thu Aug 13, 2015 8:10 am

Re: Copying features and feature scope variables

Post by wesbrooks »

Carbon copy - is this just crtl+c ctrl+v? If so when I tried that I gained something called base feature in my object tree rather than just appearing as another feature.

My issue is the feature comprises of a swept loft of 5 scetches each needing to be centred at a specific point. If I could have a spreadsheet in the feauture namespace then this would hold the centre values and then when the feature is copied with ot's vontained feature the sheet would he wrapped up. With this all I would need to do is adjust two values in the spread sheet rather than 2 values in 5 sub scetches.

Another way of doing this would have the coordinate system of the feature offset (including offsetting all contained sketches) from the main part coordinate system. Is that possible?
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Copying features and feature scope variables

Post by kisolre »

Features dont have positions an so you can not offset them. You coul ofset the things that features are based on. If you want a position for a feature (sweep) you cuold link the skethes positions to a spreadsheet and then when the spreadsheet is changed al sketches and thus the feature will move accordingly.
(spr.X, spr.Y, spr.Z)
sk1.placement.X = spr.X+OffsetSk1X; sk1.placement.Y = spr.Y+OfsetSk1Y; sk1.placement.Z = spr.Z+OfsetSk1Z
sk2.placement.X = spr.X+OffsetSk2X; sk2.placement.Y = spr.Y+OfsetSk2Y; sk2.placement.Z = spr.Z+OfsetSk2Z
.
.
.
wesbrooks
Posts: 35
Joined: Thu Aug 13, 2015 8:10 am

Re: Copying features and feature scope variables

Post by wesbrooks »

Ok, so using the sketches placement coordinates to offset the sketches is neater.

I like that and will adopt it as it removes two constraints per sketch. But each copy would still need two coordinates on each sketch adjusting so same number of edits and more importantly scope for error?
Post Reply