Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by onekk »

Hello.
Zolko wrote: ....
I'm referring to this page:

https://github.com/Zolko-123/FreeCAD_Ex ... /README.md

Something is changed, as If I do the passages in:

Document "bearing"

But with Assembly4 0.12.4 when importing the STEP file, I obtain already and App::Part, but now I can't get to follow the example, as if I select the "Bearing" object and the edge of the newly created part Bearing_20x37x9, that I have moved under the main part, I obtain:

Code: Select all

PartDesign::CoordinateSystem: Link(s) to object(s) 'Part__Feature015' go out of the allowed scope 'LCS_1'. Instead, the linked object(s) reside within 'Bearing'.
This is the file with the error:
bearing.FCStd
(29.57 KiB) Downloaded 38 times
This the resulting file with the two LCS added to "Bearing" leaving Bearing_20x37x9 as a separate part, and this gave no error, but I doubt it is correct.
bearing_corr.FCStd
(29.62 KiB) Downloaded 37 times
Any help would be appreciated.

Regards

Carlo D.

EDIT: forgotten to post proper FC info. Sorry.

Code: Select all

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.1.29410 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20.1)
Hash: f5d13554ecc7a456fb6e970568ae5c74ba727563
Python 3.10.5, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: Italian/Italy (it_IT)
Installed mods: 
  * Assembly4 0.12.4
  * toSketch 1.0.1
  * Curves 0.5.8
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by Zolko »

onekk wrote: Sat Sep 24, 2022 12:51 pm https://github.com/Zolko-123/FreeCAD_Ex ... /README.md
...
But with Assembly4 0.12.4 when importing the STEP file, I obtain already and App::Part, but now I can't get to follow the example
yes, well, it's a new behavior in FreeCAD not Assembl4 : when you import a STEP file and it contains multiple solids, an App::Part container is created, making some steps in that tutorial unecessary. So what you do is to create a new document, import the STEP file, and use the Std_Part that is created as-is, without going the extra step to create another container.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by onekk »

Zolko wrote: Sun Sep 25, 2022 4:42 pm ...
Thanks but for the LCS creation error, do you have some hints?

As I've told probably in another post I'm trying to script the whole tutorial.

https://forum.freecadweb.org/viewtopic. ... 26#p628526

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by Zolko »

onekk wrote: Sun Sep 25, 2022 6:08 pm Thanks but for the LCS creation error, do you have some hints?
yes, try what I have proposed: don't create an extra Part

As I've told probably in another post I'm trying to script the whole tutorial.
I've seen that, but frankly I don't understand what you want to do, sorry
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by onekk »

Zolko wrote: Sun Sep 25, 2022 6:35 pm yes, try what I have proposed: don't create an extra Part
So I have to use directly the imported bearing and create the LCS_1 and LCS_2 here?

Zolko wrote: Sun Sep 25, 2022 6:35 pm I've seen that, but frankly I don't understand what you want to do, sorry
It is an exercise born trying to answer a question on the forum.

Trying to produce complex files using scripting but with a final product that is the same of a GUI produced file, so it is usable in "both world".

And maybe a good way to learn something about Assembly4 and Part Design.

Regards.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by onekk »

Zolko wrote: Sun Sep 25, 2022 6:35 pm I've seen that, but frankly I don't understand what you want to do, sorry
I want to replicate the asm4_tut1 behaviour, but I'm stuck on placing the bearing, I've put together this script that will create the three files and populate them:

See amended code in post below

I can't get to replicate the behaviour of the "import Part" "Asm4_Insertlink" command, when placing objects.

I have seen that probably the Placement is calculated as following the tutorial with the Gui I obtain using the "Send to Python Console" command a lnk object on which there is this ExpressionEngine content:

Code: Select all

lnk.ExpressionEngine
[('Placement', 'Axis.Placement * axis#LCS_0001.Placement * AttachmentOffset * bearing#LCS_1.Placement ^ -1')]
But the property is read only, so I'm missing the "magic" to move the object in place.

Any Help will be appreciated.

Regards.

Carlo D.
Last edited by onekk on Mon Sep 26, 2022 5:53 pm, edited 2 times in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by Zolko »

onekk wrote: Mon Sep 26, 2022 10:09 am

Code: Select all

lnk.ExpressionEngine
[('Placement', 'Axis.Placement * axis#LCS_0001.Placement * AttachmentOffset * bearing#LCS_1.Placement ^ -1')]
I think what you're looking for is makeExpressionPart() in Asm4_libs
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Assembly4 WB - Example asm4_tut1: Problem with 0.12.4 version of the WB

Post by onekk »

Zolko wrote: Mon Sep 26, 2022 1:05 pm ...

Ok I analyzed sources and put together a modified code that is working:

20220925-asm4_tut1.py
(10.54 KiB) Downloaded 38 times

The only drawback is that I have to position and rotate the bearing:


Strange enough bear3 is correctly rotated

Code: Select all

bear1_obj = createLink(
    rootAssembly, 'bear1', doc3.getObject('Bearing_20x37x9'),
    "LCS_2", "Axis#LCS_0")
bear1_obj.AttachmentOffset = Placement(
    Vector(-9, 0, 0), Rotation(Vector(0, 1, 0), 90.00))

...


bear2_obj = createLink(
    rootAssembly, 'bear2', doc3.getObject('Bearing_20x37x9'),
    "LCS_2", "Axis#LCS_0")
bear2_obj.AttachmentOffset = Placement(
    Vector(-18, 0, 0), Rotation(Vector(0, 1, 0), 90.00))

...

bear3_obj = createLink(
    rootAssembly, 'bear3', doc3.getObject('Bearing_20x37x9'),
    "LCS_1", "Axis#LCS_0001")
Probably I have not taylored in a correct way my createLink() method.

It has some refinements to be done like changing variable names but it produce a decent result.

Any help or comment will be greatly appreciated.

Kind Regards.

Carlo D.


Please note Copyright notice and License in the file posted and in this post

I don't permit to use my code for free in closed source or in program used "to make money in broad sense".

Professional Help as to be payed

The above code is released as:

Copyright: 2022
Licence: CC BY-NC-ND 4.0


EDITED Post Sorry for any inconvenience occurred between the editing, I have preferred to post results and not "doubt and assumptions".
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply