-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Problem] Assembly: duplicate parts are renamed #12139
Comments
Interesting forum post about this: https://forum.freecad.org/viewtopic.php?p=742461#p742461 According to user1234 on the forum, this is more of a Core issue, not Assembly. Though it’s the right behavior for features inside a part. @PaddleStroke at what level should this be addressed? |
Yes this is a core issue. It's probably a big work so not sure someone will want to tackle this right now :) |
My comment for #12141, make me thinking about an important detail for instance numbers. This number is incremented by levels only and not for the whole view. Here is an example of an assembly with several sub-assemblies, with only one part with multiple instances at every levels:
|
Related forum thread: https://forum.freecad.org/viewtopic.php?t=87499 |
@martinproks this could interest you. |
Thanks, |
@shaise The fasteners wb sems to support instances of parts. Dy you thing that the solution could be used for links to generic parts in FreeCAD? They are required for the BOM feature. |
@pierreporte , AFAIK It does not actually support instances. There is a fastener caching system that prevents regeneration of an already generated fastener by just making a copy of the original cached one. It is still a full copy, not a link. |
Hi, But yes, this could be good an helpful, if the part object with filled parameters will be there. Links are one benefit, parameters are second benefit. For parameters example look to image (screw from fasteners_mp library) vs. informations from the same(EDIT: sorry, not the same, this is not hexagon but star, sorry) pure screw from fasteners WB |
@PaddleStroke Do you plan to implement instances for your BOM feature? |
Currently it is like so, you have a part : If you make a link of it you have :
Make one more link of it : The names must be different of course, and their value is not so important. So basically current situation seems very similar to catia and sw. It's just the syntax that changes. <1> instead of 001. There are two ways this could be done I guess : B - The displayed names for links is not the link label anymore, but it fetches the linked object label instead. This way changing the label of the component would not modify external files. I think B is the correct way to handle this. However it has some drawbacks :
Anyway this is a substantial change to core. So @wwmayer you probably want to weight in. |
The current situation is actually pretty different from other CAD program in that, while the displayed label is different, which is necessary to distinguish the instances, FreeCAD considers them as completely different. It is proved by the screenshot posted in #14198: Instances should be the way to avoid this problem. A solution could be having some common attribute stored in each link to a specific target. I don’t know how it should work when the target is inside the current file. The BOM feature would count the number of parts (or sub-assemblies) that share this common information to determine the quantity. It could also be the index of an array. What is displayed in the tree view is a different problem and there is an issue about this: #12141. The idea is that the label in the tree view is a formatted string that can’t be edited manually. Its content is fetched from the attributes of linked parts and sub-assemblies, and of course instance number. So to change anything, the user must edit the link target. All instances pointing to this same target would have their label changed. The way attributes should be modified by the user could be discussed in #12136 which is about implementing part attributes in the first place. Solution A goes in the right direction. Links are shortcuts to the part and it is legitimate to edit them in context. Because links are links, it makes no sense to change just one instance: solution B isn’t right. What could be allowed, though, is to change manually the instance number. Catia allows it: by default it’s a number incrementing from 1 but you can use custom text (very useful for connectors that you can thus name e.g. J0123 to better identify them). This would be only for the parent assembly it is done in. Let’s consider your M6x20 screw example. It is stored in screw.fcstd. Its attributes internal are:
FreeCAD is set so that the tree view label is formatted like this for the children of an assembly:
Three instances of this part in an assembly creates this:
FreeCAD knows that all these links have the same target so the BOM shows a quantity of 3. Now, the user wants to make the screw longer. When they are done, they change the
With variant links, it would be like the target gives choice of the configuration to insert, each one having a specific All this discussion about attributes is getting too far for this issue though. @pieterhijma could have relevant input on this topic (attributes of course but instances as well). |
Interesting discussion! My two cents: Document Object have a Appending There is also Regarding BOM and counting, for links it is easy to detect whether there are multiple instances because of the I think what would be nice in terms of BOM functionality is a button that allows you to change labels according to a user-defined scheme where the user can select for links and copies whether the base label of the source object should be adopted. |
Hi, It is not good idea to think, the object2.Label = 'Washer001' is just second piece of object.Label = 'Washer'. Imagine real situation: first object.Label = 'Washer 10 iso 7089' and second object will be automatically labeled anotherObject.Label = 'Washer 10 iso 7090'. Two hours later You do not know if both of them are the same and just automatic re-labeled, or if each of them is really different. How any (BOM) tools should know it? Another variant - look to Std Part (also called App Part or instance) parameters and make tree window more user customizable - allow more user controlled columns, not just Label2 (marked as DESCRIPTION). Std Part.Name - unique name in one document Then You can let the .Label as it is now and focus on .Type and .Id for BOM tools and assembly tree. But not-instance objects does not have these parameters. It is pointing to start think about splitting model tree from Assembly tree... |
So Assembly could inform the user and change this preference at load (and set it back at unload). |
You miss understand this screenshot. Pieter inserted several time the same object, but they are not linked in anyway. Even if the solids are identical, the objects are separated and the BOM tool has no way to know it should add them up (fastener's BOM can because it implemented some custom properties in fasteners objects to recognize identical objects, but this is not the way to handle things). This is a problem of the fastener workbench and of the user. The user/wb should insert the fastener only once, then use links to create copies. Then the BOM tool would have known it's the same and added the quantity. The instances mechanism is the same as the BOM tool, it cannot guess that 2 objects are identical if you create twice the same object without any connection between them. To work it must use App::Link.
This is very problematic then. Expressions should use name as labels can be edited no? But Names are not user friendly as they're not user facing... Maybe the expressions should display/accept the labels in the UI but internaly replace them by the names |
Oh yes, I didn't anticipate this problem. |
Yes, this would perhaps be better, but it is not so easy to accomplish. From the top of my head, we would need to maintain for a sub-expression whether it was created using a label or with a name. In case of the former, we show the user the label subexpression instead of the name. Internally it uses the name only. Hm, perhaps doable, but we should also take backward compatibility into account. I checked to be sure if I'm correct: If there are two files This has been the case forever, I believe, and I'm not aware of complaints of this behavior so far. I assume that users understand that this can happen when making use of labels across files in expressions. |
Hi,
This could be done just at case "Assembly: All in one monolithic file". Then You can add instance from file just one time and rest of them link across whole assembly tree. Imagine "Assembly: Separate instance = separate file". It is common for industry cooperative work. Each instance - (sub)assembly or component - has its own file and each file could be edited by another person independently. Each instance could be easy used in other project - just use or link the file with the instance. In this case You will have multiple added instances (for example screw or any possible one) at multiple levels. At this moment, it does not make sense to enforce law: "insert once and use link for all". And what about people who are using mixed approach: smaller sub-assemblies in monolithic files, bigger assembly at higher level follow "separate sub-assembly = separate file". This approach is the most problematic, but still relatively correct I think. You have to count with multiple added identical files on each level. You have to take into account:
|
@PaddleStroke Do you mean that multiple links to a component stored in an external files are counted as different components? Do you have to create a link to a component already in the parent assembly, be it stored in the document or a link itself? I can test your PR to get the answer myself. The common workflow is described by @martinproks. Users create instances using
@martinproks I think that there is a misunderstanding there. Instances are not components and are not stored in external files. Instance is not a synonym for part, it’s a generic term for assembly and part. Instances are the different 3D models (part or assembly) inserted in an assembly from a single component. Let me correct your comment:
|
Just to make it clear, copying and pasting an instance of a component should create a new instance: a link to the original target, not to the copied one. |
Is there an existing issue for this?
Problem description
When inserting more than one of the same part in an assembly, the name is changed in the tree. For example, the part called “bolt” in its file will be displayed “bolt”, “bolt001”, “bolt002”, etc. The name of parts shouldn’t change. The instance number should be displayed separately in a distinct manner.
In Catia, it would be displayed like this: “bolt (bolt.1)”, “bolt (bolt.2)”, etc.
In Solidworks, it would be displayed like this: “bolt<1>, “bolt<2>”, etc.
When the name of the part changes, the instance number doesn’t.
Full version info
0.22 with PR #10764 Tested width Ondsel ES 2024.1
Subproject(s) affected?
Assembly
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: