JMG1 / ExplodedAssembly

FreeCAD workbench to create exploded views and animations of assemblies
GNU Lesser General Public License v2.1
115 stars 27 forks source link

Unable to use the align to edge tool #34

Open dannystaple opened 8 months ago

dannystaple commented 8 months ago

The tool help suggests that I select the edge of an object to align, then an edge as a reference. So I select an edge from part 1, and holding command (MacOS) select an edge from part 2.

I then click the "Align to Edge" button in Exploded Assembly

The edges were both straight edges on the parts.

Screenshot 2024-01-11 at 22 49 12

What I expected to happen

The two edges would be mated, perhaps without changing the orientation of the parts, since I saw no way to specify the orientation for this.

What actually happens

'Part.Line' object has no attribute 'EndPoint'Running the Python command 'AlignToEdge' failed:
Traceback (most recent call last):
  File "/Users/danielstaple/Library/Application Support/FreeCAD/Mod/ExplodedAssembly/EAInit.py", line 386, in Activated
    va = (edgeA.Curve.EndPoint - edgeA.Curve.StartPoint).normalize()

Console output:

>>> # Gui.Selection.addSelection('fitting_distance_sensor','Body','Pocket003.Edge40',-22.5046,-97.5,3)
>>> # Gui.Selection.addSelection('fitting_distance_sensor','Part','Body001.Pocket001.Edge13',-10.6663,-89.25,35)
>>> # Gui.runCommand('AlignToEdge',0)

About my FreeCAD

I am running v0.21.1:

[code]
OS: macOS 12.6.8
Word size of FreeCAD: 64-bit
Version: 0.21.1.33694 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
Locale: C/Default (C)
Installed mods: 
  * A2plus 0.4.60k
  * ExplodedAssembly
[/code]
JMG1 commented 7 months ago

This could happen that one of the edges is not a line. As for the function of this tool, it makes the edges face the same orientation but does not place them together.