[Solved] Part Design Part missing "Origin" feature

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!
Will2
Posts: 33
Joined: Thu Apr 28, 2016 3:19 pm

[Solved] Part Design Part missing "Origin" feature

Post by Will2 »

I've just been working on a new file and made quite a bit of progress between saves so I don't have a backup save without this issue.

Something happened and I managed to delete the "Origin" feature in a Part Design part (the container that holds the X, Y, Z planes and axis). Is there a way to get this back? It not being there seems to have broken a few things such as any time a sketch is moved.

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16093 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 690774c0effe4fd7b8d2b5e2fb2b8c8d145e21ce
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
Last edited by Will2 on Fri Mar 29, 2019 4:34 pm, edited 1 time in total.
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Post by chrisb »

I only know of two ways, and none of them is really fun.

1.) Fast, but no guarantee for success:
- Create another file with a similar body.
- unzip both files or use Tools->Project utility to unpack.
- Look through Document.xml in both files, search for "Origin" and try to restore it.
- repack the zip file
- open in FreeCAD and perforem a full recompute

2.) Slower but safer
- Create a new body,
- transfer everything from the old body into the new
- If you don't succeed to transfer the features you almost always can reuse the sketches.
- rebuild dependencies to other bodies
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Part Design Part missing "Origin" feature

Post by kisolre »

There is something buggy here. I just tried to delete Origin and all its components and FreeCAD refuses to do so. On a plane that has sketches it warns for the dependency but then nothing happens. So it should not be possible to remove Origin. And when it happens there is a bug somewhere. To bad that it is not easily reproducible.
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Post by chrisb »

Of course it's a bug. I guess it occurs in connection with some undos, where the body is restored, but not the origin.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part Design Part missing "Origin" feature

Post by DeepSOIC »

Will2 wrote: Fri Mar 29, 2019 12:13 am Is there a way to get this back?

Code: Select all

origin = App.ActiveDocument.addObject('App::Origin', 'Origin')
App.ActiveDocument.Part.Origin = origin #replace "Part" with the internal name of your Part.
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Post by chrisb »

DeepSOIC wrote: Fri Mar 29, 2019 10:18 am

Code: Select all

origin = App.ActiveDocument.addObject('App::Origin', 'Origin')
App.ActiveDocument.Part.Origin = origin #replace "Part" with the internal name of your Part.
Faster than my fast way and safer than my safe way :) .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Will2
Posts: 33
Joined: Thu Apr 28, 2016 3:19 pm

Re: Part Design Part missing "Origin" feature

Post by Will2 »

I used DeepSOIC's method and it worked right away, I think it's all good now, thank you very much! It may help track down the bug but I believe this happened around the time I selected all the features of a particular part and hit "Duplicate selected object" to make a copy of it. Though I don't have any other information other than that currently. I believe I did an "undo" after the duplicate because I made a mistake in it. I could not duplicate the same problem after I fixed the file.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Solved] Part Design Part missing "Origin" feature

Post by NormandC »

Will2 wrote: Fri Mar 29, 2019 12:13 amPart Design Part
The Part container is not a PartDesign element. It's a general "standard" element. Its toolbar icon is found in *all* workbenches along with the Group icon, not only in PartDesign. It was in PartDesign only in the very beginning of 0.17 development, but it was changed nearly 2 years ago.

Std Part

If you look for this command in the source code, you will not find it in the PartDesign workbench but in /src/Gui.

https://github.com/FreeCAD/FreeCAD/sear ... q=Std_Part
Will2
Posts: 33
Joined: Thu Apr 28, 2016 3:19 pm

Re: [Solved] Part Design Part missing "Origin" feature

Post by Will2 »

NormandC wrote: Fri Mar 29, 2019 5:01 pm
Will2 wrote: Fri Mar 29, 2019 12:13 amPart Design Part
The Part container is not a PartDesign element. It's a general "standard" element. Its toolbar icon is found in *all* workbenches along with the Group icon, not only in PartDesign. It was in PartDesign only in the very beginning of 0.17 development, but it was changed nearly 2 years ago.

Std Part

If you look for this command in the source code, you will not find it in the PartDesign workbench but in /src/Gui.

https://github.com/FreeCAD/FreeCAD/sear ... q=Std_Part
Good point. Though maybe I'm doing something wrong. I've been mostly using the blue "body" icon and not the yellow "part" icon. I was confused when I first started using the part design workbench and I guess I just stuck to using the blue "body" icon.
User avatar
davidhbrown
Posts: 19
Joined: Fri Jan 12, 2018 6:08 am

Re: Part Design Part missing "Origin" feature

Post by davidhbrown »

DeepSOIC wrote: Fri Mar 29, 2019 10:18 am

Code: Select all

origin = App.ActiveDocument.addObject('App::Origin', 'Origin')
App.ActiveDocument.Part.Origin = origin #replace "Part" with the internal name of your Part.
Thank you! Still working great in version 20.26858 :-) I managed to need this after having deselected too many things when copying a part body to another document.

One tweak I'm not sure was necessary... I changed the second addObject() parameter from 'Origin' to 'Origin001' because there was already a body with an "Origin" in the document.
Post Reply