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

Duct Elements Convert Method Modified to Consider Disciplines #1260

Closed
wants to merge 3 commits into from

Conversation

travispotterBH
Copy link

@travispotterBH travispotterBH commented Sep 23, 2022

I did not know the best place for this PR, or what was the best name of the branch, so I am prepared to remake this after comments.

Issues addressed by this PR

Closes #1214
Closes BHoM/BHoM#1403

Attempts to address issue of duct objects being converted from Revit only as their analytical representation, which splits the ducts on all connected connectors (mostly only an issue on ducts with tap style fittings)

Try to Push to JSON a selected duct run with runs connected by taps and elbows like below:
MicrosoftTeams-image (10)

export the same duct run as a physical discipline and as an environmental discipline.

On the case of runs with tap fittings:
Physical Discipline should export just as the single, not separated by midpoint, Revit Element.
Environmental Discipline should export as the separated by midpoint element and should have multiple bhomobjects of type Duct of the same Revit Element Id.

Runs without tap fittings should export similar to the Physical discipline would.

MicrosoftTeams-image (9)

This was achieved by changing the FromRevit Convert Method for ducts called DuctFromRevit to take in the discipline provided, and that is passed into the Query.LocationCurveMEP method which then will either split or not split the duct line based on the discipline given.

This method of doing this required edits to the FromRevit Convert method that handles Element types where it was required the new Invocation of the convertMethod would be able to handle additional parameters, namely the Discipline type. This further required a change to Query.AllConvertMethods to check for methods that have between three and four parameters instead of what was previous set to three.

@pawelbaran I recognize that this may not be the most optimal solution, and I welcome your comments/suggestions/assistance.

@kayleighhoude can you give some indication on how well this suits your needs.

Test files

Revit file: Any revit file with some ducts and fittings connected in a duct run
Expected Results:
https://burohappold.sharepoint.com/:f:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Revit_Toolkit/Revit_Core_Engine-%231260-DuctElementsCreateMethodModifiedtoConsiderDisciplines?csf=1&web=1&e=3Gpp5P

Changelog

Additional comments

@travispotterBH travispotterBH self-assigned this Sep 23, 2022
@travispotterBH travispotterBH changed the title Duct Elements Create Method Modified to Consider Disciplines Duct Elements Convert Method Modified to Consider Disciplines Sep 23, 2022
Copy link
Member

@pawelbaran pawelbaran left a comment

Choose a reason for hiding this comment

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

I am afraid you are jumping too far ahead with this PR @travispotterBH. The current system around the Revit converts is based on the concept of having one convert per object type. This means you cannot have 2 types of converts to MEP ducts depending on discipline input (see the code comments).

Instead, you would need to start from adding MEP objects to the Physical namespace (Physical_oM) to then start supporting them in Revit_Toolkit. I hope this makes sense - even if taking a shortcut sounds tempting in short term, I am pretty sure we would need to pay double price once we realise the amount of extra effort required to make it work plus potentially refactor in long term.

Revit_Core_Engine/Convert/FromRevit.cs Outdated Show resolved Hide resolved
@@ -44,7 +45,7 @@ public static partial class Convert
[Input("settings", "Revit adapter settings.")]
[Input("refObjects", "A collection of objects processed in the current adapter action, stored to avoid processing the same object more than once.")]
[Output("ducts", "List of BHoM duct objects converted from a Revit duct elements.")]
public static List<BH.oM.MEP.System.Duct> DuctFromRevit(this Autodesk.Revit.DB.Mechanical.Duct revitDuct, RevitSettings settings = null, Dictionary<string, List<IBHoMObject>> refObjects = null)
public static List<BH.oM.MEP.System.Duct> DuctFromRevit(this Autodesk.Revit.DB.Mechanical.Duct revitDuct, RevitSettings settings = null, Dictionary<string, List<IBHoMObject>> refObjects = null, Discipline discipline = Discipline.Physical)
Copy link
Member

Choose a reason for hiding this comment

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

Discipline method parameter should not be added to this method - if you need it, please make this method private and then expose it via one-line public converts for physical and MEP disciplines that would call it.

Revit_Core_Engine/Query/AllConvertMethods.cs Outdated Show resolved Hide resolved
@@ -160,7 +161,7 @@ public static BH.oM.Geometry.Line LocationCurveColumn(this FamilyInstance family
[Input("mepCurve", "Revit MEPCurve to be queried.")]
[Input("settings", "Optional, the RevitSettings to be used.")]
[Output("locationCurveMEP", "BHoM lines list queried from the MEPCurve.")]
public static List<BH.oM.Geometry.Line> LocationCurveMEP(this MEPCurve mepCurve, RevitSettings settings = null)
public static List<BH.oM.Geometry.Line> LocationCurveMEP(this MEPCurve mepCurve, RevitSettings settings = null, Discipline discipline = Discipline.Physical)
Copy link
Member

Choose a reason for hiding this comment

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

This is fine, there is no limitations on the Query methods.

@travispotterBH travispotterBH marked this pull request as draft November 9, 2022 19:22
@travispotterBH
Copy link
Author

Will not planned to be resolved in this sprint.

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