예제 #1
0
        /// <summary>
        /// 获取导套
        /// </summary>
        /// <param name="cylinder"></param>
        /// <returns></returns>
        public List <AbstractCylinderBody> GetGuideBushing(List <AbstractCylinderBody> cylinder)
        {
            List <AbstractCylinderBody> bush = new List <AbstractCylinderBody>();

            foreach (AbstractCylinderBody ab in cylinder)
            {
                if (ab.Radius >= 6)
                {
                    Vector3d vec1   = ab.Direction;
                    Vector3d vec2   = new Vector3d(-vec1.X, -vec1.Y, -vec1.Z);
                    int      count1 = TraceARay.AskTraceARay(this.Body, ab.StratPt, vec1);
                    int      count2 = TraceARay.AskTraceARay(this.Body, ab.StratPt, vec2);
                    if (count1 == 0 && count2 == 0)
                    {
                        List <Body> bodys = new List <Body>();
                        NXOpen.GeometricAnalysis.SimpleInterference.Result res = AnalysisUtils.SetInterferenceOutResult(this.Body, ab.Body, out bodys);
                        if (res == NXOpen.GeometricAnalysis.SimpleInterference.Result.OnlyEdgesOrFacesInterfere && bodys.Count == 0)
                        {
                            if (ab is CylinderBody)
                            {
                                ab.Name = "直司";
                            }
                            else
                            {
                                ab.Name = "托司";
                            }
                            bush.Add(ab);
                            continue;
                        }
                    }
                }
            }
            return(bush);
        }
예제 #2
0
        private List <string> EleInterference(string Pich)
        {
            List <string> info    = new List <string>();
            Body          eleBody = GetOccsInBods(this.eleModel.PartTag)[0];

            foreach (Part work in this.workpiecePart)
            {
                List <Body> bodys         = new List <Body>();
                Body        workpieceBody = GetOccsInBods(work)[0];
                NXOpen.GeometricAnalysis.SimpleInterference.Result re = AnalysisUtils.SetInterferenceOutResult(eleBody, workpieceBody, out bodys);
                if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.NoInterference)
                {
                    info.Add(this.eleModel.AssembleName + "                     " + work.Name + Pich + "没有干涉!");
                }
                if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.InterferenceExists)
                {
                    info.Add(this.eleModel.AssembleName + "                     " + work.Name + Pich + "有干涉!");
                }
                if (bodys.Count > 0)
                {
                    foreach (Body body in bodys)
                    {
                        body.Layer = 252;
                    }
                }
            }
            return(info);
        }
        /// <summary>
        /// 干涉检查
        /// </summary>
        /// <param name="eleCtBody"></param>
        /// <param name="eleName"></param>
        /// <param name="post"></param>
        /// <param name="picth"></param>
        /// <param name="err"></param>
        private void Interference(Component eleCt, string eleName, string post, string picth, ref List <string> err)
        {
            Body eleCtBody = GetOccsInBods(eleCt);

            foreach (Part pt in work.GetAllWorkpiece())
            {
                Component ptCoo = GetPartInOcc(pt);
                if (ptCoo != null && !ptCoo.IsSuppressed)
                {
                    Body        by    = GetOccsInBods(ptCoo);
                    List <Body> bodys = new List <Body>();
                    if (by != null)
                    {
                        try
                        {
                            NXOpen.GeometricAnalysis.SimpleInterference.Result re = AnalysisUtils.SetInterferenceOutResult(eleCtBody, by, out bodys);
                            if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.NoInterference)
                            {
                                err.Add(eleName + "                     " + pt.Name + picth + "没有干涉!");
                            }
                            if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.InterferenceExists)
                            {
                                err.Add(eleName + "                     " + pt.Name + picth + "有干涉!");
                            }
                            if (bodys.Count > 0)
                            {
                                foreach (Body body in bodys)
                                {
                                    body.Layer = 252;
                                }
                            }
                        }
                        catch
                        {
                            ClassItem.WriteLogFile("干涉检查错误!");
                        }
                    }
                    else
                    {
                        err.Add(pt.Name + "                   无法找到工件体,请检查引用集!");
                    }
                }
            }
        }