Bug or I am just a noob?

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
thebruuu
Posts: 10
Joined: Mon Sep 05, 2022 7:54 pm

Bug or I am just a noob?

Post by thebruuu »

Hello

This occurs in A2plus, using python on selected part and constraints.
So First.
I have a group containing 3 imported Parts.
Those parts have constraints between themselves

I select all the parts and constraints in the group, as per picture
Image 002.png
Image 002.png (22.75 KiB) Viewed 946 times
Then I create a copy of the selected elements (copy and paste od "Duplicate Selection" command in the Edit Menu)
Image 013.png
Image 013.png (37.92 KiB) Viewed 946 times
The copied parts have wrong constraints : the constraints point to the original elements in the group Group
To try to have the constraint correcly repluged to the right parts I tried to run this code:

Code: Select all

obj1=FreeCADGui.Selection.getSelection()[0]
obj2=FreeCADGui.Selection.getSelection()[1]
obj1.Object1=obj1.ParentTreeObject.Name
obj1.Object2=obj2.Name
where first I select the constraint and then I select the 2nd part it should refer to, as the first part is directly obtained from the object tree
...
Unfortunately this code does not work as expected:
Yes, i am able to replug the constraint correctly
BUT randomly, some of the original constraints are modified too
In the below example, I selected the constraint axisCoincident_001__tubo_MEDIO_Corrente_002 and the part tubo_MEDIO_Corrente_002
And as per picture, the constraint axisCoincident_001__tubo_BASSO_Corrente_001 has been modified too

Image 004.png
Image 004.png (43.23 KiB) Viewed 946 times
Any explanation will be welcome, on why the code does not work
Thank You
chrisb
Veteran
Posts: 53943
Joined: Tue Mar 17, 2015 9:14 am

Re: Bug or I am just a noob?

Post by chrisb »

Don't crosspost in parallel to different subforums.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
thebruuu
Posts: 10
Joined: Mon Sep 05, 2022 7:54 pm

Re: Bug or I am just a noob?

Post by thebruuu »

Hello

Sorry,
After having posted in the python forum, I got no answer... this is why i tried the coding forum.
Feel free to delete my post If you think it's not in the right place.

On my side I will stop cross posting of course
chrisb
Veteran
Posts: 53943
Joined: Tue Mar 17, 2015 9:14 am

Re: Bug or I am just a noob?

Post by chrisb »

The developer forum was definitely the wrong place. I will move it to Assembly.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Bug or I am just a noob?

Post by dan-miel »

thebruuu wrote: Wed Sep 21, 2022 7:31 pm Any explanation will be welcome, on why the code does not work
Thank You
Just a fast observation: You have two constraints named axisCoincident_001.
Which one did you change, and which one is the solver reading?
Dan
Post Reply