-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Copy/Paste state improvements #763
Merged
eirannejad
merged 15 commits into
pyrevitlabs:pr/763
from
melnikovalex:copy-state-improvements
Mar 19, 2020
Merged
Copy/Paste state improvements #763
eirannejad
merged 15 commits into
pyrevitlabs:pr/763
from
melnikovalex:copy-state-improvements
Mar 19, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 tasks
Merged into |
eirannejad
added a commit
that referenced
this pull request
Mar 20, 2020
Merged into develop. @melnikovalex Thank you so much for the hard work on this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Ehsan.
I was trying to extend the functionality of Copy/Paste Viewport position in PR #722 . The main aim was to be able to align viewports not only by the viewport center but also by the project base point. And add support of Sections as well as any other view type.
I stuck with PR #722 then, because I understood that it would be good to rework all the structure of Copy/Paste tools. That is what I tried to achieve here.
The first reason to rebuild it and to make it modular is that the functionality was split into two scripts - Copy and Paste.
Therefore I left in these two .py scripts only 'UI-logic' and moved the main logic into
...stack\lib\copy_paste_state_actions.py
. In this case, I am using similar way as you have in Wipe-actions.Entities
There are several entities I am announcing to reduce repeating and make the content of each action simpler:
CopyPasteStateAction
- Base class for creating Copy/Paste State Actions.Usage sample:
DataFile
- Wraps pickle module and pyrevit datafile for using withwith
Usage:
dump
andload
also includes serialization and deserialization of certain Revit types. Some of those types were already there (e.g.picklable_list
). I extracted it intopyrevitlib.revit.serialization
because it is being used not only in Copy/Paste but also in Sync views. Please check how correct it is using it like that.validate_context
method allows showing only actions which are applicable in current contextTools
Here I will describe improvements in the tools:
Copy view zoom/pan state / SyncViews
pyrevitlib.revit.serialization
Viewport placement
I completely rewrite the algorithm. Now it doesn't store 'transformation matrix` it uses either viewport center or does alignment using 'zero-cropbox' (for alignment by basepoint)
Support Section, Elevation, 3D views, Schedules (it should work with all placeable views now)
Support Sheets with different TitleBlock locations - the alignment is done according to TitleBlock (if it exists and in count no more than one)
Allow choosing ProjectBasePoint as an origin (instead of Cropbox)
Allow choosing cropbox alignment when Paste (top left, bottom left, etc.)
Flexible selection: can use either active view or selected viewport(s)
Support Pasting to multiple selected viewports at once (relevant for all Copy/Paste modes)
Bonus: running Paste with Shift-Click allows to isolate transformation to a certain axis (X or Y). So the tool can be used also for alignment many viewports on one sheet.
Crop Region
Support Pasting to multiple selected views
Filter Overrides
Please have a look. Looking forward to your comments. I hope it won't take long to merge this.