Assembly 4 workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Assembly 4 workbench
A little advancing in Scripting Asm4 WB.
Essentially is working in a decent flawless manner.
I have to find a more GUI way to set angles, and modify them.
I have some doubt about the correctness of some "helpers methods", as they are derived from Zolko Asm4 code, without a deep knowledge of what they are doing in reality.
But without proper documentation, this is the best I could achieve.
I hope this will be helpful for some users.
As usual, comment and code improvements or quirks are welcomed.
Regards
Carlo D.
Essentially is working in a decent flawless manner.
I have to find a more GUI way to set angles, and modify them.
I have some doubt about the correctness of some "helpers methods", as they are derived from Zolko Asm4 code, without a deep knowledge of what they are doing in reality.
But without proper documentation, this is the best I could achieve.
I hope this will be helpful for some users.
As usual, comment and code improvements or quirks are welcomed.
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Assembly 4 workbench
I understand better. But that raises other questions: the function create_asm4_model(asm_doc) seems to create a new assembly. Did you try to call
Code: Select all
Gui.runCommand('Asm4_newAssembly')
The logic behind the way Asm4 is coded is that 1 command is 1 file which includes all helper functions and the UI. Except for functions that are called in many places, then it goes into the Asm4_libs file to be available for all. And I tried to avoid global variables (and functions/classes) as much as I could.
Re: Assembly 4 workbench
Thanks for reply.
IMHO if the whole Activated code will be exposed in a proper method, that will be usable both by the Activated gui.command and by a script most of the helper methods would not needed.
Same for create link command.
I had to copy and paste the whole code to make things works with new version of ASM4.
code changes was only related to the fact that I pass the FreeCAD doc where I want to put the "Assembly".
Technically speaking self is not used in the code so it will be not a big work.
This way it will be usable if placed in Asm4libs even when using "FreeCAD as a library" or from freecadcmd.exe (only to give an idea).
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Assembly 4 workbench
OK, why not. Would you make a proposal (a PR) to show what you have in mind ?
Re: Assembly 4 workbench
Ok i will try to make a PR.
EDIT: see below
Regards
Carlo D.
Last edited by onekk on Sun May 07, 2023 2:43 pm, edited 1 time 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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Assembly 4 workbench
Hello, I've made a PR.
This modified code will work with the PR proposed:
my code to make a link is a mix of insertLink and placeLink so it is probably more difficult to separate them without some refactoring of your code.
But as it is a mere guess on how things are working, (But It seems to work most of the time.) probably some revision is needed.
Kind Regards
Carlo D.
This modified code will work with the PR proposed:
my code to make a link is a mix of insertLink and placeLink so it is probably more difficult to separate them without some refactoring of your code.
But as it is a mere guess on how things are working, (But It seems to work most of the time.) probably some revision is needed.
Code: Select all
def create_link(r_Asm, l_Name, l_Obj, at_by, at_to):
"""Create a App::Link."""
obj = r_Asm.newObject('App::Link', l_Name)
obj.LinkedObject = l_Obj
# If the name was already chosen, and a UID was generated:
if obj.Name != l_Name:
# we try to set the label to the chosen name
obj.Label = l_Name
Asm4.makeAsmProperties(obj)
obj.AttachedBy = at_by
obj.AttachedTo = at_to
#obj.AssemblyType = "Part::Link"
obj.LinkTransform = False
obj.SolverId = "Asm4EE"
(a_Link, sep, a_LCS) = obj.AttachedTo.partition('#')
if a_Link == 'Parent Assembly':
a_Part = None
else:
a_Part = obj.Document.getObject(a_Link).LinkedObject.Document.Name
l_Part = obj.LinkedObject.Document.Name
if obj.AttachedBy[0] == "#":
l_LCS = obj.AttachedBy[1:]
else:
l_LCS = obj.AttachedBy
expr = Asm4.makeExpressionPart(a_Link, a_Part, a_LCS, l_Part, l_LCS)
# print(expr)
obj.setExpression('Placement', expr)
# update the link
obj.recompute()
return obj
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Assembly 4 workbench
Hello,
I would like to rotate the belt around the pulleys. Currently I managed to produce this movement on the sketch002 (Courroie) with the LCS5. I can't associate it with the belt. I don't know if that's the way to do it. Could one of you help me?
Thank you in advance for this beneficial help for my understanding of ASM4.
I would like to rotate the belt around the pulleys. Currently I managed to produce this movement on the sketch002 (Courroie) with the LCS5. I can't associate it with the belt. I don't know if that's the way to do it. Could one of you help me?
Thank you in advance for this beneficial help for my understanding of ASM4.
- Attachments
-
- Capture d'écran 2023-05-08 090026.png (29.02 KiB) Viewed 1919 times
-
- ASM4-AnimCourroie.FCStd
- (356.72 KiB) Downloaded 32 times
Re: Assembly 4 workbench
Some great news: thanx to @leoheck, there is now (or rather: will be with the next release) an interference check for assemblies. This is a fundamental function for an assembly tool ! This is for now only in the development branch, and for those who know how to use that branch, it would be very nice if you could test this function and give your feedback. There are still errors left and it would be cool to smoothen them out. Please be aware that the check can take long time, depending on the complexity of your assembly.
Usage is very simple (as per Asm4 habit) : click the button. You can hide the ShapesCopy folder and use the measurement tool to measure the interference dimensions between objects. To get back to normal workflow, simply delete the Interferences folder and un-hide the assembly.
EDIT: added link to forum post
Usage is very simple (as per Asm4 habit) : click the button. You can hide the ShapesCopy folder and use the measurement tool to measure the interference dimensions between objects. To get back to normal workflow, simply delete the Interferences folder and un-hide the assembly.
EDIT: added link to forum post
Last edited by Zolko on Mon May 08, 2023 6:54 pm, edited 1 time in total.
Re: Assembly 4 workbench
@Zolko
A quick throwback
I just installed the new version of Assembly4 today 0.50.2 and the "Check Intereferences" icon is not visible; is not in the Assembly drop-down menu
Ok for Delete variable icon is here.
A quick throwback
I just installed the new version of Assembly4 today 0.50.2 and the "Check Intereferences" icon is not visible; is not in the Assembly drop-down menu
Ok for Delete variable icon is here.