[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: 26
Joined: Thu Apr 28, 2016 3:19 pm

[Solved] Part Design Part missing "Origin" feature

Postby Will2 » Fri Mar 29, 2019 12:13 am

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
Posts: 18010
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Postby chrisb » Fri Mar 29, 2019 8:00 am

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

1.) Fast, but 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
kisolre
Posts: 1359
Joined: Wed Nov 21, 2018 1:13 pm

Re: Part Design Part missing "Origin" feature

Postby kisolre » Fri Mar 29, 2019 8:09 am

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
Posts: 18010
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Postby chrisb » Fri Mar 29, 2019 8:44 am

Of course it's a bug. I guess it occurs in connection with some undos, where the body is restored, but not the origin.
User avatar
DeepSOIC
Posts: 6951
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Part Design Part missing "Origin" feature

Postby DeepSOIC » Fri Mar 29, 2019 10:18 am

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
Posts: 18010
Joined: Tue Mar 17, 2015 9:14 am

Re: Part Design Part missing "Origin" feature

Postby chrisb » Fri Mar 29, 2019 1:39 pm

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

Re: Part Design Part missing "Origin" feature

Postby Will2 » Fri Mar 29, 2019 4:32 pm

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
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

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

Postby NormandC » Fri Mar 29, 2019 5:01 pm

Will2 wrote:
Fri Mar 29, 2019 12:13 am
Part 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: 26
Joined: Thu Apr 28, 2016 3:19 pm

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

Postby Will2 » Fri Mar 29, 2019 5:16 pm

NormandC wrote:
Fri Mar 29, 2019 5:01 pm
Will2 wrote:
Fri Mar 29, 2019 12:13 am
Part 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.