public static bool TryGetExtrusion(this BrepFace face, out Extrusion extrusion)
        {
            if (face.UnderlyingSurface().TryGetExtrusion(out extrusion))
            {
                if (face.OrientationIsReversed)
                {
                    var profile = extrusion.Profile3d(new ComponentIndex(ComponentIndexType.ExtrusionBottomProfile, 0));
                    profile.Reverse();

                    if (!extrusion.GetProfileTransformation(0.0).TryGetInverse(out var WCStoECS))
                    {
                        return(false);
                    }

                    if (!profile.Transform(WCStoECS))
                    {
                        return(false);
                    }

                    return(extrusion.SetOuterProfile(profile, false));
                }

                return(true);
            }

            extrusion = null;
            return(false);
        }
Пример #2
0
        // Extrusions
        public static SpeckleExtrusion ToSpeckle(this Rhino.Geometry.Extrusion extrusion)
        {
            //extrusion.PathTangent
            var myExtrusion = new SpeckleExtrusion(extrusion.Profile3d(0, 0).ToSpeckle(), extrusion.PathStart.DistanceTo(extrusion.PathEnd), extrusion.IsCappedAtBottom);

            myExtrusion.PathStart             = extrusion.PathStart.ToSpeckle();
            myExtrusion.PathEnd               = extrusion.PathEnd.ToSpeckle();
            myExtrusion.PathTangent           = extrusion.PathTangent.ToSpeckle();
            myExtrusion.ProfileTransformation = extrusion.GetProfileTransformation(0.0);
            var Profiles = new List <SpeckleObject>();

            for (int i = 0; i < extrusion.ProfileCount; i++)
            {
                Profiles.Add(extrusion.Profile3d(i, 0).ToSpeckle());
            }
            myExtrusion.Profiles   = Profiles;
            myExtrusion.Properties = extrusion.UserDictionary.ToSpeckle();
            myExtrusion.SetHashes(myExtrusion);
            return(myExtrusion);
        }