Mirroring parts

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!
Mindiell

Mirroring parts

Postby Mindiell » Mon Jun 20, 2011 10:55 am

Hello everybody,

I'm a french new user of FreeCad. I'm trying to draw a WorkBench, and I need to draw the four feet. But since I want some holes in each foot, the foot are not exactly the sames. I must invert them in order to have some symmetry. How can I achieve that ?
The mirror tool creates a new part, but can I transform this new part into a specific part, not being modified anymore by some modifications on the first (mirrored) part ?

Thx,
Mindiell
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: Mirroring parts

Postby wmayer » Wed Jun 22, 2011 10:16 am

Mindiell wrote:Hello everybody,

I'm a french new user of FreeCad. I'm trying to draw a WorkBench, and I need to draw the four feet. But since I want some holes in each foot, the foot are not exactly the sames. I must invert them in order to have some symmetry. How can I achieve that ?
The mirror tool creates a new part, but can I transform this new part into a specific part, not being modified anymore by some modifications on the first (mirrored) part ?

Thx,
Mindiell
The mirrored object is parametric which means that if one of the source object changes this object changes, too. So, you want to mirror an object but without making it parametric. This e.g. can be done by exporting and re-importing the mirrored object and then deleting this mirrored object. Alternatively, if you know about Python scripting you can do it this way.

Nevertheless, I think we should add a function to the GUI to make simple, non-parametric copies.
User avatar
tanderson69
Posts: 1548
Joined: Thu Feb 18, 2010 1:07 am

Re: Mirroring parts

Postby tanderson69 » Wed Jun 22, 2011 3:38 pm

wmayer wrote:Nevertheless, I think we should add a function to the GUI to make simple, non-parametric copies.
I think you are right, but I would like to expand on the idea. In UG we had a command that was called remove parameters. It worked on any parametric object and turned it into a "dumb" object (no history). This would work good for this mirror example and would also be applicable in other areas where feature history might not be desired.
User avatar
yorik
Site Admin
Posts: 12065
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Mirroring parts

Postby yorik » Wed Jun 22, 2011 5:30 pm

Actually this is pretty simple to do by script:

Code: Select all

originalObject = FreeCAD.ActiveDocument.ActiveObject
newObject = FreeCAD.ActiveDocument.addObject("Part::Feature",originalObject.Name)
newObject.Shape = originalObject.Shape.copy()
I'll add this to the macros receipes
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: Mirroring parts

Postby wmayer » Fri Jun 24, 2011 9:10 am

tanderson69 wrote:
wmayer wrote:Nevertheless, I think we should add a function to the GUI to make simple, non-parametric copies.
I think you are right, but I would like to expand on the idea. In UG we had a command that was called remove parameters. It worked on any parametric object and turned it into a "dumb" object (no history). This would work good for this mirror example and would also be applicable in other areas where feature history might not be desired.
I had the same idea, too. And it would be pretty easy to realize this. We just need a further boolean property in our object base class. Since this will cause some extra memory for every object and breaks the parametric paradigm somewhat we have to wait for Jürgen's opinion on this.
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Mirroring parts

Postby jriegel » Fri Jul 15, 2011 1:26 pm

Actually I like Yoriks Idea on this. This three lines turn every (also future ones) in a simple object witch no parameter and history.

Another way would be to set such object in an "incactive" mode, which would prevent the recalculation
and preserve the actual state. But thats some kind in-transparent....

In the future I would like to destinguish the different ways to work in different
Workbenches. E.g. the Part-Workbench is all the basic functions basically only mild
parameters and no links and history. The PartDesign-Workbench is full parametric and
history.
Stop whining - start coding!
User avatar
yorik
Site Admin
Posts: 12065
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Mirroring parts

Postby yorik » Fri Jul 15, 2011 2:02 pm

jriegel wrote:In the future I would like to destinguish the different ways to work in different
Workbenches. E.g. the Part-Workbench is all the basic functions basically only mild
parameters and no links and history. The PartDesign-Workbench is full parametric and
history.
But it's tricky because a lot (all?) Part stuff is parametric already: primitives creation, booleans, extrude, etc...

My take is that we could maybe simply merge part and partdesign? why have 2 different ones? Most people who need to do a pocket, for example, will also sooner or later need to do a boolean subtraction...

Another idea could be to leave the Part module with almost no GUI tool, it would be there just as a "supporting" module for the others...
User avatar
tanderson69
Posts: 1548
Joined: Thu Feb 18, 2010 1:07 am

Re: Mirroring parts

Postby tanderson69 » Sun Jul 17, 2011 3:08 pm

Just about all of my models in a finished job are parametric. Only a select small portion are "dumb". But even the dumb ones spent at least some time as a parametric solid. IMHO the system should treat everything parametrically and let the user decide if and when to make it "dumb". Consider the following scenario.

1) build up a compound solid consisting of say... a dozen features.
2) do an associative mirror of that solid.
3) add a couple of features to the mirrored body because it isn't 100 percent symmetrically, but it is close enough that a mirror saves a lot of time and consistency.

at this point I decide that the original solid should be "dumb". So I run Yoriks script. Won't the associative mirror be broke? if so, I will have to redo the mirror and the post mirror features? This scenario might not fit because it looks like the script never deletes the original object. Chances are there will be many situations where I would want the original gone after I made a "dumb" copy where the above scenario might play out.
User avatar
yorik
Site Admin
Posts: 12065
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Mirroring parts

Postby yorik » Sun Jul 17, 2011 8:49 pm

tanderson69 wrote:it looks like the script never deletes the original object.
I figured out that deleting the original object would not be such a problem, but it's easy to make the script delete it too, just add the following line:

Code: Select all

FreeCAD.ActiveDocument.removeObject(originalObject.Name)
But then the children of that object should be deleted too? Dangerous, because they could be children of other objects too...
User avatar
tanderson69
Posts: 1548
Joined: Thu Feb 18, 2010 1:07 am

Re: Mirroring parts

Postby tanderson69 » Sun Jul 17, 2011 11:13 pm

yorikvanhavre wrote:But then the children of that object should be deleted too? Dangerous, because they could be children of other objects too...
That was my point. I think the parameters have to be erased on the original object.