コード例 #1
0
        /// <summary>
        /// Построение вала
        /// </summary>
        /// <param name="parameters">Параметры делали</param>
        public void BuildDetail(Parameters parameters)
        {
            _doc3D = _kompas.Document3D();
            _doc3D.Create(false, true);

            BuildHead(parameters.DiameterHead, parameters.LengthHead);
            BuildLeg(parameters.DiameterLeg, parameters.LengthLeg, parameters.LengthHead);
            BuildBracing(parameters.DiameterBracing, parameters.LengthBracing,
                         parameters.LengthLeg, parameters.LengthHead);
            BuildBracingCut(parameters.DiameterBracing, parameters.LengthBracing, parameters.LengthLeg, parameters.LengthHead);
            BuildBracingHole(parameters.DiameterBracing, parameters.LengthBracing, parameters.LengthLeg, parameters.LengthHead);
            //

            switch (parameters.Thread)
            {
            case "-":
                break;

            case "Head":
                BuildThreadHead(parameters.DiameterHead, parameters.LengthHead, parameters.DiameterLeg);
                break;

            case "Leg":
                BuildThreadLeg(parameters.DiameterLeg, parameters.LengthLeg, parameters.DiameterBracing, parameters.LengthHead);
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Create 3D document
        /// </summary>
        /// <returns>true if operation successful; false in case of error</returns>
        public bool CreateDocument3D()
        {
            Document3D = (ksDocument3D)KompasObject.Document3D();

            // Create build
            if (!Document3D.Create(false /*visible*/, false /*build*/))
            {
                LastErrorCode = ErrorCodes.Document3DCreateError;
                return(false);
            }

            // Create screw detail on 3D document
            ScrewPart = (ksPart)Document3D.GetPart((short)Part_Type.pTop_Part);

            // Create nut detail on 3D document
            NutPart = (ksPart)Document3D.GetPart((short)Part_Type.pTop_Part);

            if (ScrewPart == null ||
                NutPart == null
                )
            {
                LastErrorCode = ErrorCodes.Document3DGetPartError;
                return(false);
            }

            return(true);
        }