Esempio n. 1
0
        private MateiMateDefinition findAxis(PartComponentDefinition def, Edge ed)
        {
            if (ed.TangentiallyConnectedEdges.Count == 1)
            {
                Face f = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) ? ed.Faces[1] : ed.Faces[2];
                return(def.iMateDefinitions.AddMateiMateDefinition(f, 0, InferredTypeEnum.kInferredLine));
            }
            SelectionFilterEnum[] sels = new SelectionFilterEnum[] { SelectionFilterEnum.kWorkAxisFilter };
            Arc3d             c        = ed.Geometry as Arc3d;
            ObjectsEnumerator col      = def.FindUsingPoint(ed.PointOnEdge, ref sels, c.Radius * 5, false);
            WorkAxis          ax       = null;

            foreach (var item in col.OfType <WorkAxis>())
            {
                ax = item;
                //Face f = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) ? ed.Faces[1]: ed.Faces[2];
                if (ax.DefinitionType == WorkAxisDefinitionEnum.kNormalToSurfaceWorkAxis)
                {
                    return(def.iMateDefinitions.AddMateiMateDefinition(ax, 0, InferredTypeEnum.kInferredLine));
                }
                ax = null;
            }
            if (ax == null)
            {
                return(iMate__(ed, def));
            }
            return(null);
        }