Origin changes on stl import
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 3
- Joined: Mon Feb 10, 2020 8:04 pm
Re: Origin changes on stl import
Thank you all. Yes, the original was not at 0,0,0. I corrected it now...
Re: Origin changes on stl import
I had a similar issue where the STL file that I was importing had an origin that was not (0,0,0). This made it very difficult to modify and work within Freecad because sketches would not overlay on the object correctly due to the coordinate miss match. Freecad is an awesome tool, but sometimes not the correct tool. I would suggest importing you STL into a program like Blender that is better setup for modifying STLs. In Blender you can reset the Origin of the STL to the Volume of the STL (Hit "T" -> right click on STL -> Set Origin -> Origin to Geometry -> Then in side window set origin to (0,0,0)). Export this STL from Blender. Then re-import into Freecad and you origin will be (0,0,0) which will allow you to work with it using the correct coordinates. Hope this helps!
Re: Origin changes on stl import
Thanks so much for the tip to reset coordinates of stl files in Blender!
It seems that things downloaded off of Thingiverse can be pretty random and that slicers such as Cura automagically translate them usefully, hiding the issue...
And then I tried importing them into FreeCAD for rework and have spent hours working through this issue. Very glad to be making progress!
It seems that things downloaded off of Thingiverse can be pretty random and that slicers such as Cura automagically translate them usefully, hiding the issue...
And then I tried importing them into FreeCAD for rework and have spent hours working through this issue. Very glad to be making progress!
-
- Veteran
- Posts: 3192
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Origin changes on stl import
You could also make use of this macro. https://wiki.freecadweb.org/Macro_MoveToOrigin
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Origin changes on stl import
Here is a macro to move a mesh to the origin. It does't rotate it, but most of the time the meshes are already orthogonal to the origin.
Usage: Select the mesh, run the macro. Undo should work to put the mesh back in its former location if you change your mind.
Usage: Select the mesh, run the macro. Undo should work to put the mesh back in its former location if you change your mind.
Code: Select all
doc = FreeCAD.ActiveDocument
def moveMesh(mesh):
center = mesh.Mesh.BoundBox.Center
mesh.Placement.Base.x -= center.x
mesh.Placement.Base.y -= center.y
mesh.Placement.Base.z -= center.z
sel = Gui.Selection.getSelectionEx()
if len(sel) == 1:
if sel[0].Object.TypeId == "Mesh::Feature":
mesh = sel[0].Object
doc.openTransaction("Move Mesh")
moveMesh(mesh)
doc.commitTransaction()
else:
FreeCAD.Console.PrintError("Select a mesh object and try again.\n")
Re: Origin changes on stl import
The macro works nicely for me.
Much easier than using Blender just for this step.
Thanks for the replies.
Much easier than using Blender just for this step.
Thanks for the replies.
Re: Origin changes on stl import
G'day guys
Just thought I would mention another idea.
A long term FreeCAD developer, Kieth Sloan, has made an add on workbench named "toSketch" which contains various interesting tools that have been asked for over time.
One of those tools is "to Reset Origin". He made that because for a while we were seeing a lot of STEP files exported from other CAD applications that when imported into FreeCAD had unexpected local co-ordinate origin of the solid, so the solid was somewhere way off from Global Origin in FreeCAD.
The tool was originally created to work on a solid, I don't recall of it also works with an imported STL. I made the icons for him.
Here is a screen shot showing the "to Reset Origin" tool in "toSketch" workbench.
Jim
edit, here is a link to a topic where he was talking about the toSketch workbench.
https://forum.freecadweb.org/viewtopic. ... ch#p530793