Пример #1
0
        /// <summary>
        /// Implements the interface method.
        /// </summary>
        public void CreateLanding(Document document, ElementId stairsElementId, int landingIndex)
        {
            // Get the run configurations for the runs before and after this landing.
            IStairsRunComponent configuration1 = m_runConfigurations[landingIndex];
            IStairsRunComponent configuration2 = m_runConfigurations[landingIndex + 1];

            // Get the stairs path from the lower run for run direction.
            Curve curve        = configuration1.GetStairsPath()[0];
            XYZ   runDirection = (curve.GetEndPoint(1) - curve.GetEndPoint(0)).Normalize();

            // Generate the landing configuration
            IStairsLandingComponent configuration = GenerateLanding(configuration1.GetLastCurve() as Line,
                                                                    configuration2.GetFirstCurve() as Line,
                                                                    runDirection,
                                                                    configuration2.RunElevation);

            m_landingConfigurations.Add(configuration);

            // Create the landing now
            configuration.CreateLanding(document, stairsElementId);
        }
Пример #2
0
        /// <summary>
        /// Implements the interface method.
        /// </summary>
        public void CreateStairsRun(Document document, ElementId stairsElementId, int runIndex)
        {
            // Calculate where the previous run ended.
            XYZ    previousRunEndPoint = runIndex == 0 ? XYZ.Zero : m_runConfigurations[runIndex - 1].GetRunEndpoint();
            double elevation           = runIndex == 0 ? m_bottomElevation : m_runConfigurations[runIndex - 1].TopElevation;

            // Setup number of risers for the run.
            int runNumberOfRisers = m_riserIncrement;

            if (runIndex == m_numberOfLandings)
            {
                runNumberOfRisers = RiserNumber - m_numberOfLandings * m_riserIncrement;
            }

            // Setup the transform for the run.  Every second run must be reversed in direction and start point generated from
            // the offet to the previous run.
            Transform transform  = Transform.Identity;
            XYZ       pivotPoint = previousRunEndPoint + m_transform.OfPoint(new XYZ(RunWidth + RunOffset, 0, 0));

            if (runIndex % 2 == 1)
            {
                Transform translation = Transform.CreateTranslation(pivotPoint);
                Transform rotation    = Transform.CreateRotationAtPoint(XYZ.BasisZ, Math.PI, pivotPoint);
                transform = rotation.Multiply(translation);
            }
            transform = transform.Multiply(m_transform);

            // Generate the run configuration and it.
            IStairsRunComponent configuration = GenerateRun(runNumberOfRisers, elevation,
                                                            m_stairsType.MinTreadDepth, RunWidth, transform);

            m_runConfigurations.Add(configuration);

            // Create the run now (subsequent runs and landings need to use its geometric properties).
            configuration.CreateStairsRun(document, stairsElementId);
        }