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

Rhinoceros_Engine: add convert methods for Extrusion #204

Merged
merged 6 commits into from
Mar 5, 2021

Conversation

alelom
Copy link
Member

@alelom alelom commented Feb 22, 2021

Issues addressed by this PR

Closes #182

Test files

Create any BHoM Extrusion, then try to convert it ToRhino(), and then FromRhino().

To test the FromRhino() from a script, you may want to temporarily modify the IFromRhino method as below:

public static BHG.IGeometry IFromRhino(this object geometry)	     
{	 
            // Code to force testing of Extrusion: first convert toRhino, then fromRhino.	
            if (geometry is BH.oM.Geometry.Extrusion)	
                return Convert.FromRhino((geometry as BH.oM.Geometry.Extrusion).ToRhino());	

            return (geometry == null) ? null : Convert.FromRhino(geometry as dynamic);
}

otherwise, due to the Goo casting being enforced for BHoM components, you'll never be able to pass a Rhino object to FromRhino() using Grasshopper components.

Changelog

Additional comments

@alelom alelom added the type:feature New capability or enhancement label Feb 22, 2021
@alelom alelom self-assigned this Feb 22, 2021
@alelom alelom requested a review from al-fisher February 22, 2021 15:56
Copy link
Contributor

@IsakNaslundBh IsakNaslundBh left a comment

Choose a reason for hiding this comment

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

Small comments below, have just looked here on GitHub, so not tested. Will be nice to get this in!

Rhinoceros_Engine/Convert/ToRhino.cs Outdated Show resolved Hide resolved
Rhinoceros_Engine/Convert/ToRhino.cs Outdated Show resolved Hide resolved
@alelom
Copy link
Member Author

alelom commented Feb 23, 2021

@rolyhudson @al-fisher
Because Rhino is enforcing perpendicularity btw base curve and extrusion direction, while BHoM gives more freedom, I quickly added a feature to return a Sweep in case that condition is not met.

image

The method works by extrapolating the sweep rail from the centroid of the base curve (or middle point, if it is open).

For some reason, the sweep is interrupted a bit before the top of the provided direction line, see below. I guess this feature can be improvable, but I'd rather raise a separate issue on this than keeping this PR open, which is already useful as it is for our applications.

image

@al-fisher
Copy link
Member

Good approach returning sweep for not perpendicular BHoM.Extrusions. Agreed.
Also agree on current limitation on Sweep cut off - worth raising separate issue on that

Standard extrude working well for me now in preview
Although can not recreate your skewed Sweep behaviour? Have you missing commits? Or have I messed up my end? @alelom

@alelom
Copy link
Member Author

alelom commented Feb 23, 2021

Although can not recreate your skewed Sweep behaviour? Have you missing commits? Or have I messed up my end? @alelom

Sorry yes I was missing to save the file then commit!

al-fisher
al-fisher previously approved these changes Feb 23, 2021
Copy link
Member

@al-fisher al-fisher left a comment

Choose a reason for hiding this comment

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

LGTM now thanks @alelom.

Standard Extrude working as expected - and can recreate your behaviour (including the potential endpoint/cut off issue) with the Rhino.Sweep/BHoM.NonOrthognalExtrude

If @rolyhudson and @IsakNaslundBh are happy - good to merge from me

@al-fisher
Copy link
Member

/azp run Rhinoceros_Toolkit.CheckInstaller

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alelom
Copy link
Member Author

alelom commented Feb 23, 2021

Thanks @al-fisher , I had to push 4acbbf0 to fix build not working for Grasshopper as highlighted by CheckInstaller.

@alelom
Copy link
Member Author

alelom commented Feb 23, 2021

/azp run Rhinoceros_Toolkit.CheckInstaller

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@rolyhudson rolyhudson left a comment

Choose a reason for hiding this comment

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

LGTM. Issue with the interrupted sweep seems to be only when a circle. Here is an arc swept next to the manually modelled rhino version.
Screenshot 2021-02-23 154504
And rectangle with its direction line baked and selected.
Screenshot 2021-02-23 161403

@al-fisher al-fisher merged commit 7919866 into master Mar 5, 2021
@al-fisher al-fisher deleted the Rhinoceros_Toolkit-#182-extrusionConvert branch March 5, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New capability or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rhinoceros_Toolkit: Add support for converts of Extrusions
4 participants