示例#1
0
        public static IDictionary <Face, List <Lavorazione> > detectLavorazioni(PartDocument oDoc)
        {
            IDictionary <Face, List <Lavorazione> > result = new Dictionary <Face, List <Lavorazione> >();

            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;

            FaceCollection oFaceColl = oCompDef.Bends[1].FrontFaces[1].TangentiallyConnectedFaces;

            oFaceColl.Add(oCompDef.Bends[1].FrontFaces[1]);

            foreach (Face f in oFaceColl)
            {
                if (f.EdgeLoops.Count > 1)
                {
                    List <Lavorazione> lavorazione = IdentificazioneEntita.main(f.EdgeLoops, iApp);

                    if (lavorazione.Count > 0)
                    {
                        result.Add(f, lavorazione);
                    }
                }
            }

            return(result);
        }
示例#2
0
        public static void deleteLavorazione(PartDocument oDoc)
        {
            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;
            int numeroFacceTan = oCompDef.Bends.Count * 2;

            NonParametricBaseFeature oBaseFeature = oCompDef.Features.NonParametricBaseFeatures[1];

            oBaseFeature.Edit();

            SurfaceBody basebody = oBaseFeature.BaseSolidBody;

            foreach (Face f in basebody.Faces)
            {
                if (f.TangentiallyConnectedFaces.Count == numeroFacceTan)
                {
                    string nameFace = f.InternalName;

                    ObjectCollection oColl = iApp.TransientObjects.CreateObjectCollection();

                    List <string> listName = new List <string>();

                    foreach (EdgeLoop oEdgeLoops in f.EdgeLoops)
                    {
                        Edges oEdges = oEdgeLoops.Edges;

                        string lav = IdentificazioneEntita.whois(oEdges);

                        if (!string.IsNullOrEmpty(lav))
                        {
                            Edge oEdge = oEdges[1];

                            Faces oFaceColl = oEdge.Faces;

                            foreach (Face oFaceLav in oFaceColl)
                            {
                                if (oFaceLav.InternalName != nameFace)
                                {
                                    if (!listName.Contains(oFaceLav.InternalName))
                                    {
                                        oColl.Add(oFaceLav);
                                        listName.Add(oFaceLav.InternalName);
                                    }
                                    foreach (Face oFaceLavTang in oFaceLav.TangentiallyConnectedFaces)
                                    {
                                        if (!listName.Contains(oFaceLavTang.InternalName))
                                        {
                                            oColl.Add(oFaceLavTang);
                                            listName.Add(oFaceLavTang.InternalName);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (oColl.Count > 0)
                    {
                        try
                        {
                            oBaseFeature.DeleteFaces(oColl);
                        }
                        catch
                        {
                        }
                    }
                }
            }
            oBaseFeature.ExitEdit();
        }