/// <summary>
        /// Creates a fill in Surface from the specified Curve or Composite Curve.
        /// </summary>
        /// <param name="genericCurve">The curve or composite curve from which to create the fill in surface.</param>
        /// <returns>The new surface.</returns>
        public PSSurface CreateFillInSurface(PSGenericCurve genericCurve)
        {
            var newSurface = PSSurface.CreateFillInSurface(_powerSHAPE, genericCurve);

            Add(newSurface);
            return(newSurface);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a solid from a drive curve and one or more sections.
        /// </summary>
        /// <param name="driveCurve">The drive curve for the solid.</param>
        /// <param name="sections">The sections through which to drive the solid.</param>
        public PSSolid CreateSolidFromDriveAndSections(PSGenericCurve driveCurve, List <PSGenericCurve> sections)
        {
            // Create the solid
            PSSolid newSolid = new PSSolid(_powerSHAPE, driveCurve, sections);

            Add(newSolid);
            return(newSolid);
        }
        /// <summary>
        /// Creates a fill in Surface from the specified Curve or Composite Curve.
        /// </summary>
        /// <param name="genericCurve">The curve or composite curve from which to create the fill in surface.</param>
        /// <returns>The new surface.</returns>
        public PSSurface CreateFillInSurface(PSGenericCurve genericCurve)
        {
            genericCurve.AddToSelection(true);
            var newSurface = PSSurface.CreateSmartSurface(_powerSHAPE, AutomaticSurfacingMethods.Fill, AutomaticSurfaceTypes.PowerSurface);

            Add(newSurface);
            return(newSurface);
        }
        /// <summary>
        /// Morphs surfaces between a control and reference surface.  Note that you can morph one surface if it is a PowerSurface but you
        /// must morph more than one surface if it is not a PowerSurface.  Also, the control and reference surfaces must have the same number
        /// of laterals and longitudinals
        /// </summary>
        /// <param name="surfacesToMorph">The surfaces to be morphed</param>
        /// <param name="referenceSurface">The reference surface</param>
        /// <param name="controlSurface"></param>
        /// <param name="decayDefinitionOption"></param>
        /// <param name="decayDefinitionBlend"></param>
        /// <param name="keepReferenceAndControlSurfaces"></param>
        /// <param name="normalOffsetting"></param>
        /// <param name="decaySelection"></param>
        /// <param name="decayLimit"></param>
        /// <param name="decayValue"></param>
        public static void MorphSurfacesBetweenTwoSurfaces(
            List <PSSurface> surfacesToMorph,
            PSSurface referenceSurface,
            PSSurface controlSurface,
            DecayDefinitionOptions decayDefinitionOption,
            DecayDefinitionBlend decayDefinitionBlend = DecayDefinitionBlend.Quartic,
            bool keepReferenceAndControlSurfaces      = false,
            bool normalOffsetting     = false,
            PSSurface decaySurface    = null,
            PSGenericCurve decayCurve = null,
            int decayLimit            = 100,
            double decayValue         = 0.5)
        {
            _powerSHAPE = referenceSurface.PowerSHAPE;
            var activeModel = _powerSHAPE.ActiveModel;

            activeModel.ClearSelectedItems();
            surfacesToMorph.ForEach(x => x.AddToSelection());

            _powerSHAPE.DoCommand("MORPH", "TWOSURFS", "REFERENCE ON");
            referenceSurface.AddToSelection();
            _powerSHAPE.DoCommand("CONTROL ON");
            controlSurface.AddToSelection();

            // Always keep the surfaces as they are only actually hidden from view but kept in the database. If
            // the user wants to lose them then we can delete them afterwards.
            _powerSHAPE.DoCommand("KEEP ON", "WRAP " + normalOffsetting.ToOnOff(), "DECAY " + decayDefinitionOption);

            if (decayDefinitionOption != DecayDefinitionOptions.None)
            {
                _powerSHAPE.DoCommand("BLEND " + decayDefinitionBlend);
                if (decayDefinitionOption == DecayDefinitionOptions.Distance)
                {
                    if (decayValue < 0.05)
                    {
                        decayValue = 0.05;
                    }
                    if (decayValue > 0.5)
                    {
                        decayValue = 0.5;
                    }
                    _powerSHAPE.DoCommand("LIMIT " + decayLimit, "HALFLIFE " + decayValue);
                }
                else
                {
                    _powerSHAPE.DoCommand("DECAYSELECT ON");
                    if (decaySurface != null)
                    {
                        decaySurface.AddToSelection();
                    }
                    if (decayCurve != null)
                    {
                        decayCurve.AddToSelection();
                    }
                }
            }

            _powerSHAPE.DoCommand("ACCEPT");

            // Delete the reference and control surfaces if chosen to
            if (keepReferenceAndControlSurfaces == false)
            {
                referenceSurface.Delete();
                controlSurface.Delete();
            }
        }