Assembly 4 workbench

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Assembly 4 workbench

Post by ppemawm »

Zolko wrote: Sat Jan 25, 2020 10:45 pm Done: the description is visible as tool-tip when the mouse hoovers above the variable name.
Thank you for your quick response. This is exactly what I was hoping for.
"It is a poor workman who blames his tools..." ;)
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

catman wrote: Sun Jan 26, 2020 11:40 am Another usefult thing would be a kind of "switching" App:Link. Maybe something like this already exists?
yes I know, and it doesn't exist. We have called that variant link or configurations. This will need some core FreeCAD support, not only some Python scripts. I would also like to make this compatible with exploded assembly.

So this will probably wait for FreeCAD v0.20

As for the rest of the requests, please note that this is for me also a free-time involvement. You probably know the saying:

We have done the urgent, we're doing the impossible, for miracles please be patient.

On the other hand, and I don't know if you can see this statistics: there are 20 downloads of this workbench a day. While I'm very happy — and proud — that people like what I've be doing, some help could be appreciated.

traffic.png
traffic.png (89.7 KiB) Viewed 1813 times
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: Assembly 4 workbench

Post by OficineRobotica »

We have done the urgent, we're doing the impossible, for miracles please be patient.
This is the motto of open source software :) . There are so many requests because of your ability to gather all the new functionalities of FC 0.19 in one place and thus opening a world of possibilities previously unknown to the FC community. And for that we're all grateful.....I mean sincerely grateful. It's only that we get excited with the new functionalities and we keep asking for more witbought a real knowledge of the amount of programing work behind the scenes.

As they say: It's done when it's done. We promise to be patient.
As a free time project, I can say that it hit quite a bit with the community and I can only wish that my free time projects could be so successful.

Cheers and thank you for a great add-on.
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

I tested the LCS placement feature with the following file. Its a standard STEP body extended to be a Assembly4 libraray parts with just 5 LCS.

The first LCS works fine because nothing is selected. I pressed: 1. LCS-Button, 2. OK for the name 3.the shape of the hole, 4. concentric in the mapping dialog and 5. OK in the mapping dialog

For the second LCS the button still does nothing. In the image you can see that the first solid of the body is selected (its the plate with the holes).
Misumi_CSPJ75-R_D75_H95_LCS-PlacementTest.png
Misumi_CSPJ75-R_D75_H95_LCS-PlacementTest.png (77.56 KiB) Viewed 1778 times
Here is the file I used
Misumi_CSPJ75-R_D75_H95.FCStd
(56.29 KiB) Downloaded 53 times

I noted that your specific function "New Hole LCS" works very well. When selecting 1. the shape of the hole 2. NewHole LCS the LCS is already inserted. Then continuing with the next shape works fine. To me it looks as if the correct behaviour is already there in the NewHole LCS function,



Zolko wrote: Sun Jan 26, 2020 6:53 pm
catman wrote: Sun Jan 26, 2020 11:40 am Another usefult thing would be a kind of "switching" App:Link. Maybe something like this already exists?
yes I know, and it doesn't exist. We have called that variant link or configurations. This will need some core FreeCAD support, not only some Python scripts. I would also like to make this compatible with exploded assembly.
Cool, I was not aware what is going on behind the scenes. I understood the configuration table feature, but variants stuff.

Zolko wrote: Sun Jan 26, 2020 6:53 pm As for the rest of the requests, please note that this is for me also a free-time involvement. You probably know the saying:
I am aware. Please do not take my remarks as "requests", I am happy to get a feedback (as above). Often it happens that there are ways, workarounds I am not aware. Or it helps to know if you agree to an idea or even if its already on the roadmap.

Zolko wrote: Sun Jan 26, 2020 6:53 pm On the other hand, and I don't know if you can see this statistics: there are 20 downloads of this workbench a day. While I'm very happy — and proud — that people like what I've be doing, some help could be appreciated.
I am sure that will be rising 8-)
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

catman wrote: Sun Jan 26, 2020 11:40 am If you check out A2plus, you will not that they have 2 Import buttons for assemblies:
  • the full document
  • only parts of a document
Currently I have the case that I have constructed a part that needs to be used as a left and right hand version. The only difference are the counterbores. In one for the left side use they have to be left, for the right side use they have to be right. I am thinking at what level I am splitting the parts in two documents. It would rather use sketch cross-references to build the two version in the Parts folder and link them into the Assembly4 Model with different LCS (one for left and one for right attachment points). But that way I can not put them into the top assembly, because I only can connect the whole file to one single LCS.
This is already implemented :D (I was just too stupid to realize it :o )

Here is an example
Test_Assy4_DocumentWith2Parts.jpg
Test_Assy4_DocumentWith2Parts.jpg (51.34 KiB) Viewed 1771 times


The upper document contains 2 separate parts in the Parts folder- They have several LCS defined in those folders as well. In the Assembly4 Model they are imported. It was not required to import their local Datums to the Model's root level.

The other document should import the 2 parts as separate entities. This is done with the "Link an external Part" button. In the dialog there are three options listed.
1. ...#Model This imports the whole document as one item. You need to have the LCS on the root level to be able to select it for attachment
2. ...#Part1 This imports only one of the two parts. You can select only the LCS on the root level of that part. Not the LCS on the root level of Model
3. ...#Part2 Same as for #Part1. Import this by pressing the "Link an external Part" button again and select ...#Part2. Also here you only have access to the parts own LCS.

The result is that you have a Document with 2 different parts linked in from the same external document. That way one can build up a large FreeCAD document with similar parts, or different version (all derived from the same base sketches) and Link in only what is required. The A2plus workbench has 2 separate buttons for that, here it is in combined in one button.

Actually it is mentioned in the readme in the button text, I just had not realiszed what it meant at the time I read the document :oops: .
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

catman wrote: Sun Jan 26, 2020 10:00 pm I tested the LCS placement feature with the following file. Its a standard STEP body extended to be a Assembly4 libraray parts with just 5 LCS.

The first LCS works fine because nothing is selected. I pressed: 1. LCS-Button, 2. OK for the name 3.the shape of the hole, 4. concentric in the mapping dialog and 5. OK in the mapping dialog

For the second LCS the button still does nothing. In the image you can see that the first solid of the body is selected (its the plate with the holes).

Misumi_CSPJ75-R_D75_H95_LCS-PlacementTest.png
Here is the file I used Misumi_CSPJ75-R_D75_H95.FCStd


I noted that your specific function "New Hole LCS" works very well. When selecting 1. the shape of the hole 2. NewHole LCS the LCS is already inserted. Then continuing with the next shape works fine. To me it looks as if the correct behaviour is already there in the NewHole LCS function,



Zolko wrote: Sun Jan 26, 2020 6:53 pm
catman wrote: Sun Jan 26, 2020 11:40 am Another usefult thing would be a kind of "switching" App:Link. Maybe something like this already exists?
yes I know, and it doesn't exist. We have called that variant link or configurations. This will need some core FreeCAD support, not only some Python scripts. I would also like to make this compatible with exploded assembly.
Cool, I was not aware what is going on behind the scenes. I understood the configuration table feature, but variants stuff.

Zolko wrote: Sun Jan 26, 2020 6:53 pm As for the rest of the requests, please note that this is for me also a free-time involvement. You probably know the saying:
I am aware of that and I am very grateful for your work. Please do not take my remarks as "requests". I am happy to just get a feedback (as above). Often it happens that there are ways, workarounds I just did not see. Also it helps to know if you agree to an idea or even if that is already on the roadmap.

Zolko wrote: Sun Jan 26, 2020 6:53 pm On the other hand, and I don't know if you can see this statistics: there are 20 downloads of this workbench a day. While I'm very happy — and proud — that people like what I've be doing, some help could be appreciated.
I am sure that will be rising 8-)
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

catman wrote: Sun Jan 26, 2020 10:33 pm I noted that your specific function "New Hole LCS" works very well.
I have tried to understand your code. I guess I found the section responsible for the well working "New Hole LCS" button.

Code: Select all

"""
    +-----------------------------------------------+
    |      a class to create an LCS on a hole       |
    +-----------------------------------------------+
"""
class newHole:
    def GetResources(self):
        return {"MenuText": "New Hole LCS",
                "Accel": "Ctrl+H",
                "ToolTip": "Create a Coordinate System attached to a hole",
                "Pixmap" : os.path.join( Asm4.iconPath , 'Asm4_Hole.svg')
                }


    def IsActive(self):
        selection = self.getSelection()
        if selection == None:
            return False
        else:
            return True


    def getSelection(self):
        # check that we have selected a circular edge
        selection = None
        if App.ActiveDocument:
            # 1 thing is selected:
            if len(Gui.Selection.getSelection()) == 1: 
                # check whether it's a circular edge:
                edge = Gui.Selection.getSelectionEx()[0]
                if len(edge.SubObjects) == 1:
                    edgeObj = edge.SubObjects[0]
                    # if the edge is circular
                    if hasattr(edgeObj,"Curve") and hasattr(edgeObj.Curve,"Center"):
                        # find the feature on which the edge is located
                        parentObj = Gui.Selection.getSelection()[0]
                        edgeName = edge.SubElementNames[0]
                        selection = ( parentObj, edgeName )
        return selection
        
Maybe it is easier to just a another function to attach an LCS to an vertex. If it works for a curve it should be for a vertex, wouldn't it? I guess with just those two one can cover a lot of use cases. The Vertex would be useful e.g. in all Master Sketches at the line ends for kinematic structures (as in your tutorials).
For the vertexes I used the attachment mode "translate origin (add Vertex)"

I now next to nothing about the FreeCAD API and python I guess the function would look like this. Probably the structure search is quite a bit different that for circular edges, but maybe its even easier to scan for vertexes.

Code: Select all

"""
    +-----------------------------------------------+
    |      a class to create an LCS on a vertex       |
    +-----------------------------------------------+
"""
class newHole:
    def GetResources(self):
        return {"MenuText": "New Vertex LCS",
                "Accel": "Ctrl+?",
                "ToolTip": "Create a Coordinate System attached to a vertex (select before using the function)",
                "Pixmap" : os.path.join( Asm4.iconPath , 'Asm4_Vertex.svg')
                }


    def IsActive(self):
        selection = self.getSelection()
        if selection == None:
            return False
        else:
            return True
   
   # a rough guess of how it would work
    def getSelection(self):
        # check that we have selected a vertex
        selection = None
        if App.ActiveDocument:
            # 1 thing is selected:
            if len(Gui.Selection.getSelection()) == 1: 
                # check whether it's a vertex edge:
               vertex = Gui.Selection.getSelectionEx()[0] 
                if len(vertex.SubObjects) == 1:
                    vertexObj = vertex.SubObjects[0]
                       # find the feature on which the vertex is located
                        parentObj = Gui.Selection.getSelection()[0]
                        vertexName = vertex.SubElementNames[0]
                        selection = ( parentObj, edgeName )
        return selection
dwebman
Posts: 5
Joined: Wed Jan 08, 2020 6:44 pm

Re: Assembly 4 workbench

Post by dwebman »

I just updated the Assembly 4 workbench and have run into a problem When entering a variable quantity, using float, I am restricted to two digits prior to the decimal point. The correct value can, however, be entered into the property view of the variable.
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

Zolko wrote: Sun Jan 26, 2020 6:53 pm yes I know, and it doesn't exist. We have called that variant link
@zolko Some technical questions

I read your linked posts about the variant link. The thread is discontinued now. Your use case was different part variations which are build in memory (though a hidden file). I see three ways variations can be done.
1. single base file with different parameter sets in the file
2. single file with different variants as separate models
3. set of different files with variants
Maybe there are use casees with a combination of them. Important in all cases would be that once you import the link into another document you a) have a switch parameter to change it and b) the interface (i.e. LCSs) is maintained when switching back and forth.
I would be interested to know if your proposal covers all cases or maybe only the first case? Is that discussion is continued in another thread?

Also I noted that you found V0.19_pre App:Link is using absolute paths. I guess that could be a reason for some issues I came across when using Assembly4 in a larger test project. Often trouble involved renaming or moving files. You asked if there is a way to switch to relative path, but I did not see an answer. Did you find out yet?
gozlikehell
Posts: 17
Joined: Sun Jan 26, 2020 11:47 pm

Re: Assembly 4 workbench

Post by gozlikehell »

I'd like to extend a big thank you. The Assembly 4 workbench is awesome!!! I was already using Assembly 2. Then I started playing with Map Mode for sketches to link them when I discovered your workbench. It was exactly what I was doing with my project, so it was easy to migrate it in and go far beyond what I expected. When I'm able to, I'll post my example. Discovered some issues, plus could use some help cleaning it up. Most of my bugs/problems involve assembly/animation in 3D space, not just planar assembly/motion.
Post Reply