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

Can not get geometry element when underlying sketch is modified #26

Closed
ceremcem opened this issue Aug 9, 2018 · 6 comments
Closed

Can not get geometry element when underlying sketch is modified #26

ceremcem opened this issue Aug 9, 2018 · 6 comments

Comments

@ceremcem
Copy link
Collaborator

ceremcem commented Aug 9, 2018

Problem

If I modify an underlying sketch, "Can not get geometry element ..." exception arises.

Solution/workaround

  1. Remove the related constraint
  2. Re-apply the constraint

Reproduction

  1. Drawing is at this point
    image

  2. Remove the small window from the sketch:

image

  1. Can not get geometry element ... exception arises: (here is the drawing at that state)

image

  1. That element seem to be referenced from previous state:

image

@realthunder
Copy link
Owner

This is by design. Because you remove the window, and created another one, the face is consider a different one. To avoid this type of problem, when you use PartDesign body as part, you should choose shape in history as early as possible to avoid lost of element reference.

To fix the error here, select the new face (preferably from early body shape history), and drag and drop to the element in error.

@ceremcem
Copy link
Collaborator Author

ceremcem commented Aug 9, 2018

Is that what you are suggesting:

fix-element-reference

@realthunder
Copy link
Owner

The face dragging is correct. But you don't need to delete that element. Just drop the face to that element can fix the problem.

Another thing, I mentioned that to avoid similar problems from happening again, it is better to use early feature. It appears that sketch is the first feature in your body, in which case, you can use the origin plane that your sketch is attached to for constraining.

@ceremcem
Copy link
Collaborator Author

I'm slowly getting the hang of the internal working of the event: When we create a constraint between two "elements" and if we point to "that square face of the box", it gets the square face of the box. If we open a pocket in the box, then the face gets another id and naturally the link can not find appropriate face.

Here we are assembling two objects:

image

When we create a pocket, the element link says it can not find ...Face6:

image

Which means at the beginning, that face was enumerated as Face6. To fix the matter, we click the face again, select the highlighted line in the treeview, drag and drop it on the broken element:

fix-broken-element

Okay, we are seeking for trouble, so remove the pocket:

image

Now element says it can not find ...Face10, because the windowed face was (apparently) enumerated as Face10. The enumeration is kind of deterministic, because when we fix this issue in the same way we did before and re-open the pocket, it can't again find Face6.

But if we flip the gray part and perform the same operations, element link won't be broken, because that face is always enumerated before pocket faces, so its ID is always the same (like Face4).

Conclusion

There is no reliable way to prevent this problem before it happens, because we might have to create two distinct constraints where one of them relies one side of the gray object and the other constraint relies on the other side of the gray object and then we might want to change the underlying sketch.

Proposal

If everything is true above, then I think the way to go is leaving already enumerated faces (and edges) intact and giving new IDs for new faces/edges.

@realthunder
Copy link
Owner

First, in my branch, the element reference does not rely on names like Face1 or Edge2. It looks at the name before that, ;#13;:G6...bla bla. This name is generated based on the topology on the element. For example, the topology of a face is defined by its edges, which in turn corresponds to the sketch. When you add/remove edges in sketch, the face topology will change, and so is its topological name, regardless whether its index name changes or not.

Second, you usage of PartDesign should be discouraged, and the correct way of using it can prevent this link broken problem. There is 'Pocket' feature specifically for marking a pocket. You should create a second sketch on the face of the pad, or better, on the origin plane, to make the pocket. If you you do this, the element link will not be affected. In short, it is fine to add new sketches and add more features (i.e. modeling steps), but you should always be careful when adding/removing edges in an existing sketch.

@ceremcem
Copy link
Collaborator Author

Now I understand what you mean by "...it is better to use early feature.". I just used pocket feature and now I have actual history.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants