Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Assembly Context Features #14116

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Add Assembly Context Features #14116

wants to merge 20 commits into from

Conversation

drwho495
Copy link

@drwho495 drwho495 commented May 17, 2024

This addresses issue #14105. This adds two tools and three Python files. The first tool is an Assembly Context Creator, and the second is an Assembly Context Updater. The python files are "CommandUpdateAssemblyContext.py", "ContextCreatorLibrary.py", "CommandCreateAssemblyContext.py". The files with the name of "CommandUpdateAssemblyContext.py" and "CommandCreateAssemblyContext.py" manage each command and the task dialogs that surround them. "ContextCreatorLibrary.py" is the library that manages the groups, creating the contexts, updating the contexts, and etc. This file can be used (if modified) in other Assembly workbenches like Assembly3 and Assembly4.

This solution can be held back by TNP issues, as the sub-shape binder tool you would use to reference the Assembly Context geometry often breaks, making this approach frustrating. I have found a workaround: when using the sub-shape binder tool, ensure you select the entire object and not just a single face. If the geometry of the assembly context object changes, the binder won't break, but you may still need to redefine the references in your sketches. I find that by using this method I don't have to redefine everything nearly as much.

@github-actions github-actions bot added the WB Assembly Related to the Integrated Assembly Workbench label May 17, 2024
@drwho495 drwho495 marked this pull request as ready for review May 17, 2024 23:13
@drwho495 drwho495 marked this pull request as draft May 17, 2024 23:16
@drwho495 drwho495 marked this pull request as ready for review May 18, 2024 01:34
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like icons are removed from this file, but they are just moved down

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 18, 2024

Thanks, please also add a demo as mentioned in the issue. TIA

@drwho495
Copy link
Author

drwho495 commented May 18, 2024

Thanks, please also add a demo as mentioned in the issue. TIA

I added this to the pr description: https://github.com/drwho495/FreeCAD-Context-Fork/blob/LinkStable/context-assembly-example2.gif

@maxwxyz maxwxyz linked an issue May 18, 2024 that may be closed by this pull request
2 tasks
@PaddleStroke
Copy link
Contributor

PaddleStroke commented May 20, 2024

Sorry I can't understand very clearly what this is about just with the gif and description. If possible a video of a simple case presenting the issue, how this tool works and how it solves would be helpful.

@PaddleStroke
Copy link
Contributor

Ok I think I understand the idea now. It's to design a part that reference other parts in the assembly. Yet a video presenting the workflow would still be good.

@drwho495
Copy link
Author

alright, i will start on one

drwho495 and others added 3 commits May 21, 2024 02:50
this affects the Context system, if a new object that was not present on the last update it will be added
@PaddleStroke
Copy link
Contributor

And if you can add a real-world model to go along for testing it would be great!

@drwho495
Copy link
Author

https://www.youtube.com/watch?v=7rAA28M6hs0
here is the demo that i created

@PaddleStroke
Copy link
Contributor

PaddleStroke commented May 27, 2024

Thank you for the video.
So if I understand correctly, the 'context' is an object that is created in the document of the part for which you want to be able to use assembly as reference.

This context is a group object that contains copies of all the solids that are inside the assembly. (it is hard to see in your video as the tree is very small.). I see many issues with this :

  • It creates copies of solid and so if the assembly is large, then the file becomes heavy.
  • This is not connected to the assembly. So every time you update any small thing in the assembly, you need to update the context group with the update tool. Everytime something moves in the assembly, then the context is outdated.
  • You need a update button.

So my first question here, is why not simply creating a Link of the assembly in the file Carriage file?
Seems to be like its doing the same thing, without the need to update the context manually.
image

@drwho495
Copy link
Author

Thank you for the video.

So if I understand correctly, the 'context' is an object that is created in the document of the part for which you want to be able to use assembly as reference.

This context is a group object that contains copies of all the solids that are inside the assembly. (it is hard to see in your video as the tree is very small.). I see many issues with this :

  • It creates copies of solid and so if the assembly is large, then the file becomes heavy.

  • This is not connected to the assembly. So every time you update any small thing in the assembly, you need to update the context group with the update tool. Everytime something moves in the assembly, then the context is outdated.

  • You need a update button.

So my first question here, is why not simply creating a Link of the assembly in the file Carriage file?

Seems to be like its doing the same thing, without the need to update the context manually.

image

Ok, so the reason you cannot just edit the part from within the assembly or create links, is because it creates a cyclic error. This tool is impossible for cyclic errors to be generated unless the user trys to. I also plan on optimizing the speed and multi threading it

@chennes chennes marked this pull request as draft May 27, 2024 16:53
@chennes
Copy link
Member

chennes commented May 27, 2024

Switched to draft while work continues - please mark as ready for review when it's settled down.

@PaddleStroke
Copy link
Contributor

Indeed it appears that it is giving cyclic dependencies errors when attempting to use a link to the assembly. Or also when trying to edit the external object while in the assembly.

I think the ideal solution here would be to be able to modify the object directly from the assembly file and be able to reference to other objects of the assembly. Is that right? (As a note, I think that this is already possible if you are putting the body directly inside the assembly instead of using a Link to an external body.)

If so then the correct solution would be to make it work and find a way around these cyclic dependency problem. It would be a much more user friendly solution than having a tool creating copies of solids and another tool to update them.

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 29, 2024

I think it would be great if you have a assembly reference in the single parts as reference. Especially in large assemblies and also when you collaborate with different people they cannot work in the same file. Usually each part is in its own file and location.

@drwho495
Copy link
Author

Indeed it appears that it is giving cyclic dependencies errors when attempting to use a link to the assembly. Or also when trying to edit the external object while in the assembly.

I think the ideal solution here would be to be able to modify the object directly from the assembly file and be able to reference to other objects of the assembly. Is that right? (As a note, I think that this is already possible if you are putting the body directly inside the assembly instead of using a Link to an external body.)

If so then the correct solution would be to make it work and find a way around these cyclic dependency problem. It would be a much more user friendly solution than having a tool creating copies of solids and another tool to update them.

This tool does work around the cyclic error, this is exactly why I created it.

@drwho495
Copy link
Author

I think it would be great if you have a assembly reference in the single parts as reference. Especially in large assemblies and also when you collaborate with different people they cannot work in the same file. Usually each part is in its own file and location.

This is also what my tool does. It creates Part::Feature objects that copy the shapes of assembly objects.

@loomings
Copy link

I made a comment on the youtube video, and I’m leaving a comment here too, because I think this kind of tool — one that can “modify the object directly from the assembly file and be able to reference to other objects of the assembly” — is very very helpful. It would be good to have on FreeCAD if we dont have that yet…

I’m new to FreeCAD, still starting to learn, so keep in mind that I’m not that used to the naming yet…

What I could get from the video is that the Subshape Binder was used, and that creates a copy — like a “ghost” — of the features of the particular part (that is to be referenced) into the “active” part (which is being edited). And this “ghost” is kept within the “active” part, as a feature.

I have experience with Creo, so I’ll try to explain how it works there…

Suppose I have an assembly ASM1 made of 3 parts, and need to edit PART3, referencing a hole pattern from PART1 and edges of PART2.
(Note: In Creo, PART3 must come after parts 1 and 2 in the “assembly tree” to use those as references)

First thing, I would “activate” PART3 to be able to edit it from inside the ASM1.

After activating it, I would create an “Extrude” from a surface, and with that, go into “sketch” mode.

Inside sketch mode, I would select “REFERENCES” tool, and would be able to select the features from parts PART1 and PART2 that I need referencing. Here’s the nice thing…
Just the projection of the selected features are loaded into the sketch plane. I use those to finish my sketch.
And I can delete those references if I like, after using them, so the model does not fail if I modify PART1 or PART2.
(Although, I can see benefit of keeping the references so it updates the model when I change the referenced parts).

After finishing sketching, I would extrude it and finish the editing inside PART3, and “activate” ASM1 to go back to assembly mode.

I’ll leave a question and a suggestion:

. Can I do similar thing in FreeCAD today? Or do I need this tool being developed to do that?

It seems that instead of creating references inside the sketch, the tool is creating “ghost” features into the part itself. Maybe referencing from inside the sketch would reduce the amount of things to load.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WB Assembly Related to the Integrated Assembly Workbench
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modelling with context of an assembly in Part Design
5 participants