Moving Origin Point

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!
browntoastjam
Posts: 37
Joined: Fri Aug 20, 2021 9:51 pm

Moving Origin Point

Post by browntoastjam »

Hello All,
I noticed that on a downloaded IGS part, the origin is not at the body [shown here with the green bounding box] centre.
Image

How do I move the origin to the body part itself?
The data for the part looks like this:
Image

Code: Select all

OS: Ubuntu 20.04.2 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2021.717.24301 +3627 (Git) AppImage
Build type: Release
Branch: LinkStage3
Python version: 3.9.6
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.2
Locale: English/United States (en_US)
Thank you,
BK
edwilliams16
Veteran
Posts: 3180
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Moving Origin Point

Post by edwilliams16 »

browntoastjam
Posts: 37
Joined: Fri Aug 20, 2021 9:51 pm

Re: Moving Origin Point

Post by browntoastjam »

edwilliams16 wrote: Fri Aug 20, 2021 10:09 pm https://wiki.freecadweb.org/Macro_MoveToOrigin may help.
1. I opened the step file
2. Selected the object, then selected a vertex and ran the macro.
3. I don't see the origin moved. Still is off-center.

On my report view I see this:

Code: Select all

19:58:11  Traceback (most recent call last):
  File "/home/user/.FreeCAD/Macro/moveorigin.FCMacro", line 126, in <module>
    shift = mom.multiply(1./vol)  # global!
<class 'ZeroDivisionError'>: float division by zero
Here is the file I am trying to align to origin:

https://media.digikey.com/pdf/3D%20Mode ... -00-BK.IGS
edwilliams16
Veteran
Posts: 3180
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Moving Origin Point

Post by edwilliams16 »

Works for me.

OS: macOS High Sierra (10.13)
Word size of FreeCAD: 64-bit
Version: 0.20.25429 (Git)
Build type: Release
Branch: master
Hash: acce57a25d82b0408fa07b9452ed31c8a06c7a1b
Python version: 3.9.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: C/Default (C)


Make sure you are actually (EDIT ONLY) selecting a vertex by checking the python console. You should see something like

Code: Select all

 Gui.Selection.setPreselection(App.getDocument('Unnamed1').getObject('_001_1_2_21_00_BK'),'Vertex1012',tp=2)
Lines and faces worked for me too.
browntoastjam
Posts: 37
Joined: Fri Aug 20, 2021 9:51 pm

Re: Moving Origin Point

Post by browntoastjam »

edwilliams16 wrote: Sat Aug 21, 2021 1:11 am Works for me.

OS: macOS High Sierra (10.13)
Word size of FreeCAD: 64-bit
Version: 0.20.25429 (Git)
Build type: Release
Branch: master
Hash: acce57a25d82b0408fa07b9452ed31c8a06c7a1b
Python version: 3.9.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: C/Default (C)


Make sure you are actually (EDIT ONLY) selecting a vertex by checking the python console. You should see something like

Code: Select all

 Gui.Selection.setPreselection(App.getDocument('Unnamed1').getObject('_001_1_2_21_00_BK'),'Vertex1012',tp=2)
Lines and faces worked for me too.

OK. I am not sure what I am doing wrong.
I selected the point. Then ran the macro.
Now I see the message in the console and report view.
However, when I then try to transform, the origin is still away.

Image
edwilliams16
Veteran
Posts: 3180
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Moving Origin Point

Post by edwilliams16 »

If you look at Placement|Position in the report view you will see that is x=-92.033, y= -69.476 z= 5.6 which says that the object has been translated so that your selected point is now at the global origin. If you want further adjust its position you can edit the Placement directly or via Edit|Placement with Apply Incremental Changes checked.
I personally don't use the Transform tool, so I can't comment on that.
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Moving Origin Point

Post by TheMarkster »

You can create a new copy of the object with the origin somewhere on the object, but first you have to move the object to the origin.

Display the axis cross (shortcut keys: A,C) or view menu -> toggle axis cross.

Zoom out until the object and the axis cross are both in view:
Snip macro screenshot-5480a8.png
Snip macro screenshot-5480a8.png (9.67 KiB) Viewed 12203 times
Right click on object, choose Transform. The dragger tool is on the axis cross, but the object is off in the distance. We need to drag the object to the origin. Easiest way is to do one axis at a time. Click the icon to view the scene from the top (shortcut key: 2).

Drag on the red arrow until the object is lined up with the axis cross's green arrow:
Snip macro screenshot-bf324e.png
Snip macro screenshot-bf324e.png (17.11 KiB) Viewed 12203 times
Now do the same with the green arrow. Drag until the object is in alignment with the axis cross:
Snip macro screenshot-f8db9d.png
Snip macro screenshot-f8db9d.png (17.97 KiB) Viewed 12203 times
Now switch to left view (shortcut key: 6) and do the same, this time dragging the blue arrow. Object should be on the axis cross in isometric view (shortcut key: 0).


Snip macro screenshot-0cccb1.png
Snip macro screenshot-0cccb1.png (33.46 KiB) Viewed 12203 times
Now to make the copy with the new origin point.

Switch to Part workbench. Select the object and in Part menu -> compound -> make compound.

You can stop here and do all further actions on the compound if you like or you can make a copy of the compound. In part menu -> create a copy -> create a simple copy. The new copy object is on the origin with its placement at the default position (all zeros except axis on Z=1).
Snip macro screenshot-6af7be.png
Snip macro screenshot-6af7be.png (66.33 KiB) Viewed 12203 times
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Moving Origin Point

Post by thomas-neemann »

browntoastjam wrote: Fri Aug 20, 2021 9:56 pm
i do it like this



https://www.youtube.com/watch?v=4LkPG5slRT0

phpBB [video]
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
domad
Veteran
Posts: 2094
Joined: Mon Jun 22, 2020 12:16 pm

Re: Moving Origin Point

Post by domad »

Greetings to the Community!
To reset the origin point, simply translate the object to the new point in 3D space and export it in the same format * .igs, or * .iges (or in another format BREP) and then re-import it.
Attachments
reset_origin.png
reset_origin.png (260.71 KiB) Viewed 12132 times
drmacro
Veteran
Posts: 8984
Joined: Sun Mar 02, 2014 4:35 pm

Re: Moving Origin Point

Post by drmacro »

domad wrote: Sun Aug 22, 2021 2:47 pm Greetings to the Community!
To reset the origin point, simply translate the object to the new point in 3D space and export it in the same format * .igs, or * .iges (or in another format BREP) and then re-import it.
Yes, but be aware; If you move it before you drag it into a Body to create a BaseFeature, the BaseFeature is placed at the otiginal position.

For the same reason as before.

:geek:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Post Reply