pyrevitlabs / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®
http://wiki.pyrevitlabs.io
GNU General Public License v3.0
1.32k stars 337 forks source link

[Bug]: Copy legends -> copies reference planes to model space #2319

Open bitsy opened 4 months ago

bitsy commented 4 months ago

✈ Pre-Flight checks

🐞 Describe the bug

This command is so close to working, but there's one major issue I've run into while using it: it copies reference planes in each source legend view to the model space in the destination project. From a quick Google search, this appears to be a common issue with the way Revit handles copying/pasting reference planes in legend views.

I noticed this when I copied about 30-40 legend views to another project and wound up with nearly 300 new reference planes in my model (visible in plan view). We use reference planes in legends in our office template so that you can snap the legend views to guide grids on sheets and so that we have consistent graphics/alignment of legend components.

⌨ Error/Debug Message

n/a - no error message

♻️ To Reproduce

  1. Open the source and destination documents
  2. Make sure the source document has a legend view with reference planes
  3. Run the command "Copy legends to others documents", and select destination document, source legend, etc.
  4. Observe that reference planes are copied to model space and not to the new legend view.

⏲️ Expected behavior

I expected all elements including ref. planes in source legend views to get copied to the destination legend views with correct subcategories assigned to reference planes.

🖥️ Hardware and Software Setup (please complete the following information)

==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.16.24121+2117" | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
==> Attachments
master | Product: "Autodesk Revit 2025" | Engine: DEFAULT (2711) | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
master | Product: "24.2.1" | Engine: DEFAULT (2711) | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
master | Product: "23.1.4" | Engine: DEFAULT (2711) | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
master | Product: "Autodesk Revit 2022" | Engine: DEFAULT (2711) | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
master | Product: "2020.2.9" | Engine: DEFAULT (2711) | Path: "C:\Users\%USERNAME%\AppData\Roaming\pyRevit-Master"
==> Installed Extensions
Bloodhound | Type: Unknown | Repo: "" | Installed: "C:\Users\%USERNAME%\OneDrive\Documents\Assets\Revit\Developer\Bloodhound.extension"
==> Default Extension Search Path
C:\Users\%USERNAME%\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
C:\Users\%USERNAME%\OneDrive\Documents\Assets\Revit\Developer
==> Extension Sources - Default
https://github.com/pyrevitlabs/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2025 | Version: 25.0.2.419 | Build: 20240307_1300(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2025\"
24.2.1 | Version: 24.2.10.64 | Build: 20240408_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024\"
23.1.4 | Version: 23.1.40.56 | Build: 20240411_0945(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023\"
Autodesk Revit 2022 | Version: 22.1.60.18 | Build: 20240417_1700(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022\"
2020.2.9 | Version: 20.2.90.12 | Build: 20220517_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2020\"
==> Running Revit Instances
PID: 5228 | 24.2.1 | Version: 24.2.10.64 | Build: 20240408_1515(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2024"
==> User Environment
Microsoft Windows 10 [Version 10.0.19045]
Executing User: %USERNAME%PC\%USERNAME%
Active User: %USERNAME%PC\%USERNAME%
Admin Access: No
%APPDATA%: "C:\Users\%USERNAME%\AppData\Roaming"
Latest Installed .Net Framework: 4.8
Installed .Net Target Packs: v4.0 v4.5 v4.5.1 v4.5.2 v4.6 v4.6.1 v4.7.2 v4.8 v4.X
Installed .Net-Core Target Packs: v7.0.304
pyRevit CLI v4.8.16.24121+2117.23a0b8cbc4babdeb29a0611e159d017bbe9cbad5

Additional context

In the "Hardware and Software Setup" section, I substituted my username with %USERNAME%.

I've written a solution to this problem but could use some feedback. It basically involves recreating new reference planes in the destination legend views that match the properties of the source reference planes. I'd like to initiate a pull request but wanted to be sure I'm not missing some important context or previous discussions. It's my first time posting an issue here.

bitsy commented 4 months ago

Also, happy to share my work-in-progress code... should I paste here, or would a pull request be more appropriate?

sanzoghenzo commented 4 months ago

Hi @bitsy , thanks for your feedback!

You can go ahead by making the pull request, so that we can review and comment on specific parts of the code it there's the need to.

bitsy commented 3 months ago

Awesome will do! Sorry for the late response, just trying to tidy up and test the code a little more before I post. @sanzoghenzo, which branch should I fork for this pull request?

sanzoghenzo commented 3 months ago

you can use the develop-4 branch.