-
Notifications
You must be signed in to change notification settings - Fork 43
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
WIP: Feature/refactor #62
Conversation
Hi Tony, I use dogBone as a prefix in a vague attempt to avoid confusion - I'm okay with cleaning it up, though typing: I don't think it's necessary to import cast. Fusion has a .cast method on most of it's methods. I've stopped using that because python provides a simpler annotation: todo: I want to use python standard libraries that doesn't require users to do anything. F360 allows you to put libraries into a specific directory, and the python interpreter will find them. but... it requires the user to install the libraries in the right place. The F360 python environment is also very fussy about which directories are searched for modules. Unfortunately the only way I could get a library in a subpath to be found is to insert it into the environment path - IDE inspections have to take a back seat unless you can find a way around it. I don't think the "with" python functionality existed when I first wrote the add-in (I think it was 3.7, if I remember correctly). I didn't get around to updating it - so that will work. However, dBParameter is a dataClass, so json to and from it is an inherent method to that class. You need to make sure that you don't break it by changing it too much. Otherwise it looks great so far. Thanks Peter |
There are still global run and stop functions available, which call the instance methods.
The cast is basically ensuring that the runtime type is reflected during inspection time. Same is true for places, like this
where the IDE then understands that hasFocus is available, vs. without the casting, we only have a I want to come to a point, where the IDE can detect all potential errors. Right now warnings are all over the place making it hard to spot bugs. E.g.
might need
I'm with you. But there are other ways to achieve this. I have it on my list as part of make the IDE understand the code better.
Yes. I'll come to a point where the functions are small enough to actually be tested as part of a CI system. Currently its impossible. |
Hi Tony,
Which IDE are you using?
Peter
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Tony Findeisen ***@***.***>
Sent: Saturday, September 23, 2023 4:23:14 AM
To: DVE2000/Dogbone ***@***.***>
Cc: Peter Ludikar ***@***.***>; Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
I'm not sure that the run and stop methods can be moved to the command. F360 is expecting to see those functions and not an object.
There are still global run and stop functions available, which call the instance methods.
_design: adsk.fusion.Design = _app.activeProduct
The IDE actually warns about this, as def activeProduct(self) -> Product: returns a Product and adsk.fusion.Design is one of the possible classes inheriting from Product.
The cast is basically ensuring that the runtime type is reflected during inspection time. Same is true for places, like this
cast(adsk.core.SelectionCommandInput, input.parentCommand.commandInputs.itemById(
FACE_SELECT
)).hasFocus
where the IDE then understands that hasFocus is available, vs. without the casting, we only have a CommandInput at our fingertips from def itemById(self, id: str) -> CommandInput, which doesn't have hasFocus.
I want to come to a point, where the IDE can detect all potential errors. Right now warnings are all over the place making it hard to spot bugs.
E.g.
[selectedEdge.select for selectedEdge in self._associatedEdgesDict.values()]
might need select(), but I cannot say at the moment.
todo: I want to use python standard libraries that doesn't require users to do anything. F360 allows you to put libraries into a specific directory, and the python interpreter will find them. but... it requires the user to install the libraries in the right place.
I'm with you. But there are other ways to achieve this. I have it on my list as part of make the IDE understand the code better.
However, dBParameter is a dataClass, so json to and from it is an inherent method to that class. You need to make sure that you don't break it by changing it too much.
Yes. I'll come to a point where the functions are small enough to actually be tested as part of a CI system. Currently its impossible.
—
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABBJGTEXIPSS47YT457ZDOTX32L7FANCNFSM6AAAAAA5DS5K44>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
Intellij Idea from jetbrains, so same as pycharm |
Ah, that would explain a few things for me.
I use Visual Studio Code, which is well integrated into F360 - creates the right environment from one click. VSC has intellisense which recognizes the python annotations and offers the mostly right autocomplete. There's no need to cast. There are also very few errors or warnings thrown up, so you get a cleaner look at the underlying code. I would suggest you try it and compare.
Peter
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Tony Findeisen ***@***.***>
Sent: Saturday, September 23, 2023 4:58:35 PM
To: DVE2000/Dogbone ***@***.***>
Cc: Peter Ludikar ***@***.***>; Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Which IDE are you using?
Intellij Idea from jetbrains, so same as pycharm
—
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABBJGTAD63TP2ZYCPVW5SQTX35EPXANCNFSM6AAAAAA5DS5K44>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
Hi Tony,
Just so you know - the changes you made to the import break the code. F360 is very fussy about where it finds imports from, and updating the system path with the subpath is the only work around that I know of. That means the short piece of code at the start of the Dogbones.py inserting the subpath MUST be before the import of dataclasses and pydantic, otherwise dbclasses and dbdata will not find the appropriate library.
I would suggest you use VSC instead of Intellij Idea, unless you can be 100% sure that the environment is identical. It's one of the quirks of f360 that I've not bothered to work around. It's just easier to use VSC.
Peter
…________________________________
From: Peter Ludikar ***@***.***>
Sent: September 23, 2023 6:25 PM
To: DVE2000/Dogbone ***@***.***>; DVE2000/Dogbone ***@***.***>
Cc: Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Ah, that would explain a few things for me.
I use Visual Studio Code, which is well integrated into F360 - creates the right environment from one click. VSC has intellisense which recognizes the python annotations and offers the mostly right autocomplete. There's no need to cast. There are also very few errors or warnings thrown up, so you get a cleaner look at the underlying code. I would suggest you try it and compare.
Peter
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Tony Findeisen ***@***.***>
Sent: Saturday, September 23, 2023 4:58:35 PM
To: DVE2000/Dogbone ***@***.***>
Cc: Peter Ludikar ***@***.***>; Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Which IDE are you using?
Intellij Idea from jetbrains, so same as pycharm
—
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABBJGTAD63TP2ZYCPVW5SQTX35EPXANCNFSM6AAAAAA5DS5K44>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
Hi Peter, less warnings in VSC only means, that it doesn't inspect the code that deep. As already pointed out
Yes, I noticed this. It's a problem of only manual testable code. In my ongoing changes I reverted it. I hope I can provide a better version this evening. Tony |
…ion class that holds references
Hey Tony, I'm also going to cherry-pick most of your changes, particularly the ones that don't effect the import search path. I'll upload the cabinet model you sent me, and I'll send you the link to your private email. Peter |
Hi Tony, In it I have included all your PR commits (except for the import changes). I have also included my bug fixes for both the static and parametric dogbones. If you rebase your PR to the head, I believe everything should tie back to your changes without significant conflicts (just the 3 commits to correct the bugs) If you're ok with my proposed git tree editing, then I'll do a "push --force" to affect the changes on the main repository. If you have a better idea, please let me know Peter |
Hi Peter, I see too many changes and I get too many conflicts. Also from the 24 commits, I only see a few, so I believe we were lost in the communication in between, e.g. the imports have been corrected in one of the early commits of the PR. if you remember from our conversation, my goal was to get Dogebones to a state where they can be updated even if fusion doesn't support this. As the structure of the code was not supportive to implement the update feature, I came up with refactoring and this PR. Even with my proposed changes the code was still in a state where it's hard to implement the update command. Thats why I started with a new plugin from scratch using a structure similar to the finger joint plugin. It worked out and in a few hours, I was able to create dogebones with your algorithm, plus they can be updated. Same is true for the finger joints plugin with this PR Not all features have been ported, e.g. minimal and mortise dogebones, but it's relative easy to add this as the logic happens in a single place and not in the UI/inputs. Given that state, I think we can close this PR and not merge it. I would appreciate, if you could take a look to the plugin. If you like the structure, we could work together on porting all the features that are missing and then bring this code back to your original repo. If you're happy with the current state of the plugin, we keep 2 forks and I'll add the features I personally need to the new one. Credits to your work have been given. Thanks, |
Hey Tony,
I'm planning to incorporate all your pull request changes. Unfortunately, in trying to update your media board/cabinet I found a large number of issues with my addin - I accidentally merged your PR, and that made things worse. So, I was dealing with too many problems at the same time, and my inexperience with github got the better of me. I apologize that I screwed up the merge, and I intend to get everything straight and am happy to do the work to make it right.
I have tried your doge addin, and I believe we can work on that as a basis. On my addin I deliberately show the edges that have been selected, which means that the user can deselect any edge/s they want, if necessary - there are some cases where you don't want all the corners dogboned.
I like that your code is cleaner than mine - I guess it's where your experience as a coder is superior to mine.
I have a model that I use to test the dogbone addin here<https://1drv.ms/u/s!ApHi-60dsiTttWG7vLL8OAnE1sju?e=iuhQCe>- your addin fails if you have multiple copies of the same component (it's ok if you select a face on the 1st component, but not if you select the same component with a higher instance)
I really do want to work with someone like you to make my addin usable and popular. It's already linked to AD/F360 examples - so, in principle, it should have good visibility. If your version ends up being better, I'm not proud and would be happy to update the DVE2000/dogbone repository.
Let me know what you think
Regards,
Peter
…________________________________
From: Tony Findeisen ***@***.***>
Sent: October 6, 2023 2:36 PM
To: DVE2000/Dogbone ***@***.***>
Cc: Peter Ludikar ***@***.***>; Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Hi Peter,
I see too many changes and I get too many conflicts. Also from the 24 commits, I only see a few, so I believe we were lost in the communication in between, e.g. the imports have been corrected in one of the early commits of the PR.
if you remember from our conversation, my goal was to get Dogebones to a state where they can be updated even if fusion doesn't support this. As the structure of the code was not supportive to implement the update feature, I came up with refactoring and this PR. Even with my proposed changes the code was still in a state where it's hard to implement the update command.
Thats why I started with a new plugin from scratch<https://github.com/it-ony/doge> using a structure similar to the finger joint plugin<https://github.com/FlorianPommerening/FingerJoints>. It worked out and in a few hours, I was able to create dogebones with your algorithm, plus they can be updated. Same is true for the finger joints plugin with this PR<FlorianPommerening/FingerJoints#26>
Not all features have been ported, e.g. minimal and mortise dogebones, but it's relative easy to add this as the logic happens in a single place and not in the UI/inputs.
Given that state, I think we can close this PR and not merge it. I would appreciate, if you could take a look to the plugin<https://github.com/it-ony/doge>. If you like the structure, we could work together on porting all the features that are missing and then bring this code back to your original repo. If you're happy with the current state of the plugin, we keep 2 forks and I'll add the features I personally need to the new one.
Credits<https://github.com/it-ony/doge#credits> to your work have been given.
Thanks,
Tony
—
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABBJGTBEDEWAENZISGORVJDX6BFRXAVCNFSM6AAAAAA5DS5K46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGIZTMNZQGM>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
Hey Tony, I've merged your PR - I reset the head to before my revert and pulled in all your commits. I'll now add in the bug fixes I found and commit them later. Peter |
Hi Tony, For the most part your refactoring is great. I like it. I originally left params as a instance method of Dogbone class because I wanted to make each dogbone instance individually settable - I was planning to emulate features such as Fillets, where you can set different Fillet parameters for different sets of edges. I was also aiming to make each document (model tab) a separate instance of DogboneCommand. I often have more than one model on the go at a time (particularly while testing - but if it works under those conditions, it should work robustly under normal conditions), and I don't always want the same parameters for one model to be the same as others. The AddIn is global to F360, and ideally should be isolated. During my debugging process over the last couple of weeks I found that the global nature of the addin has resulted in the GC hanging references and not cleaning up. To force a clean set of variables on DogboneUI instantiation (old OnCreate), I've had to specifically reset all the variables you now have in Selection. At the moment self.selection = Selection() is pre-populated with old data. There's obviously a hanging reference somewhere that either needs to be deleted, or the variables need to be reset. Peter |
Hi Tony,
Now that I’ve merged all your great changes, is it easier to port everything to your Doge or improve mine? I suspect it may be easier and less troublesome to do the improvements rather than port everything over. I don’t mind either way.
My end desire is to have something that is robust and easy to use with a good number of features. The actual calculations after the execute event is really the easy and trivial aspect of the dogbone. The UI and selection features are the hardest, but in my mind, the most critical.
I don’t know if you’ve noticed but when you click on the edges selection in the dialog box, you can only select valid candidate edges associated with a selected face. My aim was to allow edges to be de/selected by dragging a selection box. You need to allow for, say, a mortise in the middle of a panel to have a different dogbone type compared to a blind dado or tenon on the edge. And… both types have to be updatable.
I also was aiming to add a double-click face selection feature that would select every possible dogbone candidate on every same facing parallel face with corresponding candidate edges automatically selected. It makes the code behind the UI and selection quite tricky.
Having multiple types of dogbones on the same panel is achievable, but will require some work - that was one of the reasons why I made the parameters an edge instance rather than global. Any thoughts?
Peter
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Peter Ludikar ***@***.***>
Sent: Friday, October 6, 2023 4:54:22 PM
To: DVE2000/Dogbone ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Hey Tony,
I'm planning to incorporate all your pull request changes. Unfortunately, in trying to update your media board/cabinet I found a large number of issues with my addin - I accidentally merged your PR, and that made things worse. So, I was dealing with too many problems at the same time, and my inexperience with github got the better of me. I apologize that I screwed up the merge, and I intend to get everything straight and am happy to do the work to make it right.
I have tried your doge addin, and I believe we can work on that as a basis. On my addin I deliberately show the edges that have been selected, which means that the user can deselect any edge/s they want, if necessary - there are some cases where you don't want all the corners dogboned.
I like that your code is cleaner than mine - I guess it's where your experience as a coder is superior to mine.
I have a model that I use to test the dogbone addin here<https://1drv.ms/u/s!ApHi-60dsiTttWG7vLL8OAnE1sju?e=iuhQCe>- your addin fails if you have multiple copies of the same component (it's ok if you select a face on the 1st component, but not if you select the same component with a higher instance)
I really do want to work with someone like you to make my addin usable and popular. It's already linked to AD/F360 examples - so, in principle, it should have good visibility. If your version ends up being better, I'm not proud and would be happy to update the DVE2000/dogbone repository.
Let me know what you think
Regards,
Peter
________________________________
From: Tony Findeisen ***@***.***>
Sent: October 6, 2023 2:36 PM
To: DVE2000/Dogbone ***@***.***>
Cc: Peter Ludikar ***@***.***>; Review requested ***@***.***>
Subject: Re: [DVE2000/Dogbone] WIP: Feature/refactor (PR #62)
Hi Peter,
I see too many changes and I get too many conflicts. Also from the 24 commits, I only see a few, so I believe we were lost in the communication in between, e.g. the imports have been corrected in one of the early commits of the PR.
if you remember from our conversation, my goal was to get Dogebones to a state where they can be updated even if fusion doesn't support this. As the structure of the code was not supportive to implement the update feature, I came up with refactoring and this PR. Even with my proposed changes the code was still in a state where it's hard to implement the update command.
Thats why I started with a new plugin from scratch<https://github.com/it-ony/doge> using a structure similar to the finger joint plugin<https://github.com/FlorianPommerening/FingerJoints>. It worked out and in a few hours, I was able to create dogebones with your algorithm, plus they can be updated. Same is true for the finger joints plugin with this PR<FlorianPommerening/FingerJoints#26>
Not all features have been ported, e.g. minimal and mortise dogebones, but it's relative easy to add this as the logic happens in a single place and not in the UI/inputs.
Given that state, I think we can close this PR and not merge it. I would appreciate, if you could take a look to the plugin<https://github.com/it-ony/doge>. If you like the structure, we could work together on porting all the features that are missing and then bring this code back to your original repo. If you're happy with the current state of the plugin, we keep 2 forks and I'll add the features I personally need to the new one.
Credits<https://github.com/it-ony/doge#credits> to your work have been given.
Thanks,
Tony
—
Reply to this email directly, view it on GitHub<#62 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABBJGTBEDEWAENZISGORVJDX6BFRXAVCNFSM6AAAAAA5DS5K46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGIZTMNZQGM>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
Hi Peter,
still WIP, but worth going through the refactoring commit by commit. I try to make the code more readable by splitting them into smaller junks.
We can also pair on this in a session.
Best,
Tony