Beispiel #1
0
        /// <summary>
        /// Get extruded entity by <seealso cref="_baseFaceAreaState">information about _main_ base face area</seealso>
        /// </summary>
        /// <returns>Extruded entity</returns>
        private ksEntity GetExtrudedEntity()
        {
            int faceIndex1 = 0;
            int faceIndex2 = 0;
            int facesCount = _facesCountAfterExtrusion - _facesCountBeforeExtrusion;

            if (_doc3DPart == null)
            {
                LastErrorCode = ErrorCodes.ArgumentNull;
                return(null);
            }

            // If count of faces is 2 or 3 -- then get cylinder base plane indexes
            if (facesCount == 2 || facesCount == 3)
            {
                KompasFaces.GetCylinderBasePlaneIndexes(_doc3DPart,
                                                        _facesCountBeforeExtrusion + 1,
                                                        _facesCountAfterExtrusion,
                                                        out faceIndex1, out faceIndex2);
            }
            // Square or just a single face isn't supported
            else if (facesCount == 0 || facesCount == 1 || facesCount == 4)
            {
                LastErrorCode = ErrorCodes.ExtrusionFacesCountWrong;
                return(null);
            }
            else
            {
                KompasFaces.GetRegPolyBasePlanesIndexes(_doc3DPart,
                                                        _facesCountBeforeExtrusion + 1,
                                                        _facesCountAfterExtrusion,
                                                        out faceIndex1, out faceIndex2);
            }

            var entity = KompasFaces.GetParallelBasePlane(_doc3DPart,
                                                          faceIndex1,
                                                          faceIndex2,
                                                          BaseFaceAreaState);

            if (entity == null)
            {
                LastErrorCode = ErrorCodes.ArgumentNull;
                return(null);
            }

            return(entity);
        }
Beispiel #2
0
        /// <summary>
        ///Получить экструдированный объект
        ///<seealso cref="_baseFaceAreaState">
        ///информация о _основной базовой грани</seealso>
        /// </summary>
        /// <returns>Extruded entity</returns>
        private ksEntity GetExtrudedEntity()
        {
            int faceIndex1 = 0;
            int faceIndex2 = 0;
            int facesCount = _facesCountAfterExtrusion - _facesCountBeforeExtrusion;

            if (_doc3DPart == null)
            {
                LastErrorCode = ErrorCodes.ArgumentNull;
                return(null);
            }

            if (facesCount == 2 || facesCount == 3)
            {
                KompasFaces.GetCylinderBasePlaneIndexes(_doc3DPart,
                                                        _facesCountBeforeExtrusion + 1,
                                                        _facesCountAfterExtrusion,
                                                        out faceIndex1, out faceIndex2);
            }

            else if (facesCount == 0 || facesCount == 1 || facesCount == 4)
            {
                LastErrorCode = ErrorCodes.ExtrusionFacesCountWrong;
                return(null);
            }
            else
            {
                KompasFaces.GetRegPolyBasePlanesIndexes(_doc3DPart,
                                                        _facesCountBeforeExtrusion + 1,
                                                        _facesCountAfterExtrusion,
                                                        out faceIndex1, out faceIndex2);
            }

            var entity = KompasFaces.GetParallelBasePlane(_doc3DPart,
                                                          faceIndex1,
                                                          faceIndex2,
                                                          BaseFaceAreaState);

            return(entity);
        }