Assembly3 preview

Discussion about the development of the Assembly workbench.
cadcam
Posts: 73
Joined: Thu Apr 02, 2020 10:39 am

Re: Assembly3 preview

Postby cadcam » Wed Oct 28, 2020 7:48 pm

I am not sure if this is the correct forum to be posting but I have been
having a problem with rescaling TechDraw pages. I had thought it was
something to do with some of my code, but then checked it with the
original main stream version I had written it the code for, 21777 , and everything
works. Downloading 22846 and it works, but certainly with recent
A3_Preview versions it doesn't seem to be working. I have attached the simplest
demo file I can show the problem on. Select Page and change the page scale.
On main stream the page automatically updates, on the Link Branch the
scale changes the view doesn't update, even selecting recompute/redraw .
Have I set something which causes a different action with this branch? Or
missed something fundamentally different between the versions

[NB It shows the same behaviour even with deleted user.cfg

Many Thanks for any help




OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2020.10.26.22739 +2702 (Git)
Build type: Release
Branch: LinkStage3
Hash: 82b5884f33de464254b9e116e66ef0e30d5ffe38
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Attachments
simple_scale_demo.FCStd
(16.92 KiB) Downloaded 12 times
catman
Posts: 277
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly3 preview

Postby catman » Wed Oct 28, 2020 10:15 pm

cadcam wrote:
Wed Oct 28, 2020 7:48 pm
Select Page and change the page scale.
On main stream the page automatically updates, on the Link Branch the
scale changes the view doesn't update, even selecting recompute/redraw .
Not sure if that helps, but in 22611 Linux scaling works after selecting recompute. It does not update automatically, though, but that does not strike me as odd - it might have been like that in the last versions.
cadcam
Posts: 73
Joined: Thu Apr 02, 2020 10:39 am

Re: Assembly3 preview

Postby cadcam » Thu Oct 29, 2020 10:33 am

Thank you for the reply, I have now dug out a number of
past versions of the Assembly 3 branch to test and rescaling etc
seems to be working normally
in the release on 20200512 (05.12), but is not working on the
20200602 (06.02), next version I have.
Did anything change between these versions relating to the
redraw in TechDraw?

Many Thanks
EskiBrew
Posts: 67
Joined: Fri Apr 24, 2015 10:21 am

Re: Assembly3 preview

Postby EskiBrew » Sun Nov 01, 2020 1:53 pm

OS: Linux Mint 20 (XFCE/xfce)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2020.10.26.22739 +2702 (Git) AppImage
Build type: Release
Branch: LinkStage3
Hash: 82b5884f33de464254b9e116e66ef0e30d5ffe38
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United Kingdom (en_GB)

If I have an assembly which does solve but which gives the report:
<asm3.sys> sys_slvs.py(63): redundant constraints
<asm3.sys> sys_slvs.py(68): dof remaining: 0

How would I go about working out which are the redundant constraints so I can remove them?

I'm trying to animate an assembly using a python script and it works however it is really really slow, perhaps 1 second per update. I am wondering if it is being slow because of this "redundant constraints" warning.
realthunder
Posts: 1810
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Sun Nov 01, 2020 9:49 pm

cadcam wrote:
Thu Oct 29, 2020 10:33 am
Did anything change between these versions relating to the
redraw in TechDraw?
This is a bug in TechDraw, because of my changes in document recomputation. I have already fixed it. Will make a new release soon.

EskiBrew wrote:
Sun Nov 01, 2020 1:53 pm
If I have an assembly which does solve but which gives the report:
<asm3.sys> sys_slvs.py(63): redundant constraints
<asm3.sys> sys_slvs.py(68): dof remaining: 0

How would I go about working out which are the redundant constraints so I can remove them?

I'm trying to animate an assembly using a python script and it works however it is really really slow, perhaps 1 second per update. I am wondering if it is being slow because of this "redundant constraints" warning.
If you click the 'Solve' button, it should list the involved constraints, but that information is still too coarse to be of much help, but unfortunately that's all I get from the solver.

There are two solve buttons. Doing a 'Quick solve' is much faster than the full 'Solve', especially when there is redundancy. If you want faster animation, do only quick solve. For even faster animation, you can use two passes. The first pass record each parts placement after calling solve in each time step, and then playback in the second pass by simply assign the parts placement without calling solve, and with auto recompute disabled.
Try Assembly3 (latest version 0.11) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
EskiBrew
Posts: 67
Joined: Fri Apr 24, 2015 10:21 am

Re: Assembly3 preview

Postby EskiBrew » Sun Nov 01, 2020 11:00 pm

realthunder wrote:
Sun Nov 01, 2020 9:49 pm
There are two solve buttons. Doing a 'Quick solve' is much faster than the full 'Solve', especially when there is redundancy. If you want faster animation, do only quick solve. For even faster animation, you can use two passes. The first pass record each parts placement after calling solve in each time step, and then playback in the second pass by simply assign the parts placement without calling solve, and with auto recompute disabled.
Thanks - It doesn't seem to work that way for me...
If I click "Solve Constraints" or "Quick Solve" in the workbench gui, I get no response in the report view - i.e. it seems to work fine. If however I enter my python in to the python console (or run it as a macro) to do a loop animation - see python code here for a single move:

Code: Select all

import math
document = FreeCAD.activeDocument()
flywheel = document.getObject("Part__Feature019")
flywheel.Placement.Rotation.Angle = math.radians(120)
FreeCADGui.runCommand('asm3CmdQuickSolve',0)
The part moves as expected and the rest of the constrained parts update their positions but in the report view I see this:
<asm3.sys> sys_slvs.py(63): redundant constraints
<asm3.sys> sys_slvs.py(68): dof remaining: 0
cadcam
Posts: 73
Joined: Thu Apr 02, 2020 10:39 am

Re: Assembly3 preview

Postby cadcam » Mon Nov 02, 2020 1:26 am

realthunder wrote
This is a bug in TechDraw, because of my changes in document recomputation. I have already fixed it. Will make a new release soon.
Very many thanks for the note. I am lookforward to the bug fix, recently I seem to have been trying to track down a whole series of
problems with TechDraw scripts which used to work. Hoping this might be to solution to them, and frustration level decreasing. ;-) .
Thank you for all your work on this branch, exciting and impressive progress
.

Best Wishes
User avatar
M4x
Posts: 281
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Assembly3 preview

Postby M4x » Mon Nov 02, 2020 9:35 am

Hey everybody,

I'm currently working on an assembly where I've mainly used PlaneCoicident to constrain the assembly. Now I've discovered, that all constraints which I'd used changed to Locked!
Snip macro screenshot-1025fb.png
Backup from 2020-08-03
Snip macro screenshot-1025fb.png (17.94 KiB) Viewed 311 times
Snip macro screenshot-ec8d78.png
Backup from 2020-10-28
Snip macro screenshot-ec8d78.png (12.9 KiB) Viewed 311 times

The last backup which still mainly has the PlaneCoicident constraint is from 2020-08-03. I've continued to work on this project at the end of October. The file from 2020-10-28 has the Locked constraint only (expect for the constraints which are belonging to two parts I've added at the end of October - that's the change regarding the assembly which I've made).
Snip macro screenshot-25cf77.png
Change made at the end of October
Snip macro screenshot-25cf77.png (7.17 KiB) Viewed 311 times

Unfortunately, I'm not able to reproduce this at the moment.

I tend to use the up to date 0.19_pre version (or close to up to date). This is the version I'm currently using:
OS: Ubuntu 20.04.1 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22846 (Git) AppImage
Build type: Release
Branch: master
Hash: 1f46b72491a0008384a6db4f2615a656249f6f08
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)

Did this happen to anybody else? Do you have an idea what could have happened?

Thank you!
ToniTen
Posts: 46
Joined: Fri Sep 04, 2020 10:11 am

Re: Assembly3 preview

Postby ToniTen » Tue Nov 03, 2020 10:31 am

Assembly3 is really shaping well!

I have an issue though, and maybe it's me, or maybe it's something that needs to be added. In my workflow, I often have to put cylinders through holes (either shafts or screws) and the first part is easy, add an AxialAlignment restriction. This removes 4 degrees of freedom (X, Y, Pitch and Yaw) . However, to finish placing them, I need to constrain Z though, but PlaneCoincident won't do it, since the holes are rarely at the centre of the face. Here's a very simple example:
assembly.zip
(41.22 KiB) Downloaded 4 times
Also, all parts here were made within FreeCad, but often the parts come in STEP format from different manufacturers (screws, motors, etc).

I've tried other constraints, but none seem to do what I want: I need a constraint similar to PointDistance, that takes 2 faces, and constraints only the distance from closest point to closest point, that is, that removes only one DoF. That is, unless there's another better way that I'm not seeing.

This was done in the latest appimage

Code: Select all

OS: Ubuntu 18.04.5 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22894 (Git) AppImage
Build type: Release
Branch: master
Hash: 9eb080488d970d313c538473e7272117ea0a7cd1
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Spanish/Spain (es_ES)
realthunder
Posts: 1810
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 preview

Postby realthunder » Tue Nov 03, 2020 1:22 pm

EskiBrew wrote:
Sun Nov 01, 2020 11:00 pm
Thanks - It doesn't seem to work that way for me...
If I click "Solve Constraints" or "Quick Solve" in the workbench gui, I get no response in the report view - i.e. it seems to work fine. If however I enter my python in to the python console (or run it as a macro) to do a loop animation - see python code here for a single move:
The 'Solve' / 'Quick Solve' button only does a solve if there is any changes to your assembly. The 'Quick solve' command will only print the warning, while 'Solve' command will print out detail constraints.

Removing the redundancy will improve speed. But if you really want smooth animation, you'll need a preprocessing stage, where you perform the solve and record all part's placement. See the following code for a rough example. Remember to disable 'Auto recompute'.

Code: Select all

import math
document = FreeCAD.activeDocument()
flywheel = document.getObject("Part__Feature019")
placements = []
assembly = document.getObject('Assembly').Proxy
for i in range(1, 100)
	flywheel.Placement.Rotation.Angle = math.radians(120 + i * 5)
        FreeCADGui.runCommand('asm3CmdQuickSolve',0)
        pla = []
	for part in assembly.getPartGroup().Group:
	    pla.append(part.Placement)
	placement.append(pla)
The above code assuming you do use link array, and no intermediate plain group inbetween, otherwise the code is a bit more complex. The second stage would be simple playback by assigning the placements without recomputation

Code: Select all

import time
for pla in placements:
  for p,obj in zip(pla, assembly.getPartGroup().Group):
    obj.Placement = p
  time.sleep(0.1)
Try Assembly3 (latest version 0.11) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal