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

Checks for duplicate constraints. #461

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

TimStrauven
Copy link
Contributor

@TimStrauven TimStrauven commented Apr 17, 2024

On constraint creation checks are added to see if it exists on the selected entity or entitiies. The exists method was added to GenericConstraintOp for this.
Line distances have been replaced for point to point distances.

linked to:
[BUG] CAD Sketcher allows us to apply the hor/vert constraints multiple times to an element #430
Cannot set Distance constraint to horizontal or vertical for lines [BUG] #459

On constraint creation checks are added to see if it exists on the selected entity or entitiies.
The exists method was added to GenericConstraintOp for this.
Line distances have been replaced for point to point distances.
Copy link
Owner

@hlorus hlorus left a comment

Choose a reason for hiding this comment

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

Looks good to me besides the two comments.

operators/add_distance.py Outdated Show resolved Hide resolved
operators/base_constraint.py Outdated Show resolved Hide resolved
@hlorus
Copy link
Owner

hlorus commented Apr 20, 2024

Line distances have been replaced for point to point distances.

linked to: #430 Cannot set Distance constraint to horizontal or vertical for lines [BUG] #459

Note: In order to solve 430 we'll have to migrate old distance constraints to also contrain point to point.

@hlorus
Copy link
Owner

hlorus commented Apr 21, 2024

To migrate existing constraints:

  • Bump the addon version (e.g. 0.27.4) in init.py bl_info and blender_mainfest.toml
  • Add a check for files older than that new version in versioning.py
  • Loop through constraints of type distance and replace line entity with the two points of the line

@TimStrauven
Copy link
Contributor Author

To migrate existing constraints:

* Bump the addon version (e.g. 0.27.4) in **init**.py bl_info and blender_mainfest.toml

* Add a check for files older than that new version in versioning.py

* Loop through constraints of type distance and replace line entity with the two points of the line

Yes I figured this out yesterday, but while looking trough it I noticed the versioning system is broken for blender before 4.20 because of the changes made in the last month. I'll create another bug report...

TimStrauven and others added 2 commits April 21, 2024 19:42
Simplified the exists method in base_constraint not to do specific checks and moved this logic into the add_distance operator.
Added version check for older drawings. This updates all distance constraints on a line to the endpoints of that line.
Changed addon version from 0.27.3 to 0.27.4
@TimStrauven
Copy link
Contributor Author

To migrate existing constraints:

* Bump the addon version (e.g. 0.27.4) in **init**.py bl_info and blender_mainfest.toml

* Add a check for files older than that new version in versioning.py

* Loop through constraints of type distance and replace line entity with the two points of the line

Think this is all. I added quite some checks into versioning to be really sure to select only the right ones (since e.g. angle constraints are also in dimensional).

Let me know if anything doesn't look right.

versioning.py Show resolved Hide resolved
@hlorus
Copy link
Owner

hlorus commented Apr 23, 2024

This is ok to go in, feel free to merge yourself when you're ready. I've added you as a collaborator to the project.

Added extra check on length of line_entities to avoid errors if it would somehow be out of bounds
@TimStrauven
Copy link
Contributor Author

This is ok to go in, feel free to merge yourself when you're ready. I've added you as a collaborator to the project.

Thanks, but i've declined the request for now, maybe at a later point when I know all details of the project better.

@hlorus hlorus merged commit 1476235 into hlorus:main Apr 25, 2024
@TimStrauven TimStrauven deleted the fix_duplicate_constraints branch April 25, 2024 08:18
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

Successfully merging this pull request may close these issues.

None yet

2 participants