Plane Coincident Constraint Error

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
DBulmer
Posts: 1
Joined: Sat Aug 21, 2021 5:15 pm

Plane Coincident Constraint Error

Post by DBulmer »

I am very new to FreeCAD and I assume I have something configured wrong but can not figure it out.
I am working in the A2plus V0.4.54b workbench trying to mate 2 parts. This is the first mate in the assembly but returns an error.
I have one face on each part selected and I receive the following error when I press the Plane Coincident button.

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)

Code: Select all

13:29:07  Running the Python command 'a2p_PlaneCoincidentConstraintCommand' failed:
Traceback (most recent call last):
  File "C:\Users\Doug\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_constraintcommands.py", line 319, in Activated
    cvp = a2p_constraintDialog.a2p_ConstraintValuePanel(
  File "C:\Users\Doug\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_constraintDialog.py", line 932, in __init__
    self.cvw = a2p_ConstraintValueWidget(
  File "C:\Users\Doug\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_constraintDialog.py", line 74, in __init__
    self.initUI()
  File "C:\Users\Doug\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_constraintDialog.py", line 150, in initUI
    user_qty, user_unit = userPreferred.split(' ')

not enough values to unpack (expected 2, got 1)
tap
Posts: 1
Joined: Tue Oct 12, 2021 4:40 am

Re: Plane Coincident Constraint Error

Post by tap »

I, too, have a problem similar to this. I am using freecad 0.19 and a2plus 0.4.54b. If I make a small extruded rectangle in another file, import and copy it, and then select two faces, the buttons for planar constraints activate. If I select a coincident plane constraint I get an error in the console complaining:

=====================================================
not enough values to unpack (expected 2, got 1)Running the Python command 'a2p_PlaneCoincidentConstraintCommand' failed:
Traceback (most recent call last):
File "/home/user/.FreeCAD/Mod/A2plus/a2p_constraintcommands.py", line 321, in Activated
'createConstraint'
File "/home/user/.FreeCAD/Mod/A2plus/a2p_constraintDialog.py", line 935, in __init__
mode
File "/home/user/.FreeCAD/Mod/A2plus/a2p_constraintDialog.py", line 74, in __init__
self.initUI()
File "/home/user/.FreeCAD/Mod/A2plus/a2p_constraintDialog.py", line 150, in initUI
user_qty, user_unit = userPreferred.split(' ')

not enough values to unpack (expected 2, got 1)
=====================================================

No dialog appears. I am not sure how to proceed to understand the problem. Any suggestions would be appreciated.

-Todd
jimbroni
Posts: 1
Joined: Tue Jan 25, 2022 4:59 am

Re: Plane Coincident Constraint Error

Post by jimbroni »

I came across this error, too. I think it's a bug in A2plus. If you look at the error, it's attempting to split a string e.g. "5 mm" apart into its components ("5" and "mm") using the space to do the split, but the error suggests the string is globbed together like "5mm".

Some theories:
  • I think when using a spreadsheet to do parametric design, it drops spaces(?), which would explain this error.
  • Something to do with the extra spaces that appear in imperial units. (Switching from imperial building units to mm/cm fixes it.)
Switching to mm/cm is just a workaround, though. Pretty annoying.
Photodraft
Posts: 8
Joined: Wed Jul 08, 2020 5:12 pm
Location: Peacehaven, England

Re: Plane Coincident Constraint Error

Post by Photodraft »

Thank you jimbroni. This has been very perplexing for me. I couldn't work out how I'd managed to assemble some rather complex models before, but not now. Your answer explained how, when I modelled from some elderly drawings and was working in imperial, nothing would align, (whereas earlier all my work was in SI units and connected very nicely!)
- I thought I was going daft.

The problem of Assembly2plus not coping with imperial measurements isn't restricted to 19.3, it occurs in 20.27422 and 20.27518 too.

I have to learn to code and try helping.

Cheers,

Bob

AMD Ryzen 7 3700X 8-Core Processor 3.59 GHz
RAM 64.0 GB 64-bit operating system, x64-based processor
Windows 10 Pro for Workstations
kisolre
Veteran
Posts: 4162
Joined: Wed Nov 21, 2018 1:13 pm

Re: Plane Coincident Constraint Error

Post by kisolre »

Because in "Building US" there is no space between value and " symbol. In the other unit systems there is always?!? space between the value and the unit. Not sure if it is requirement.
evanbung
Posts: 2
Joined: Wed Mar 04, 2020 10:27 am

Re: Plane Coincident Constraint Error

Post by evanbung »

During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same.

To see what line is causing the issue, you could add some debug statements like this:

if len(line.split()) != "xx":
print line

This will resolve the value error.
Post Reply