Пример #1
0
 private bool ruledFaceOrg()
 {
     if (!(Precision.IsEqual(p1.StartPoint, p2.StartPoint) && (Precision.IsEqual(p1.EndPoint, p2.EndPoint)))) // 1. Näherung, dass sie nicht gleich sind!
     {
         if ((p1.IsClosed && p2.IsClosed) || (!p1.IsClosed && !p2.IsClosed))                                  // OPenCascade will nur geschlossene oder nur offene
         {
             if ((((p1 as ICurve).GetPlanarState() == PlanarState.Planar) || (p1 as ICurve).GetPlanarState() == PlanarState.UnderDetermined) && (((p2 as ICurve).GetPlanarState() == PlanarState.Planar) || (p2 as ICurve).GetPlanarState() == PlanarState.UnderDetermined))
             { // also nur Ebene Pfade mit unterschiedlichen Ebenen oder unbestimmt, z.B. Linien:
                 if (((p1 as ICurve).GetPlanarState() == PlanarState.Planar) && ((p2 as ICurve).GetPlanarState() == PlanarState.Planar) && Precision.IsEqual((p1 as ICurve).GetPlane(), (p2 as ICurve).GetPlane()))
                 {
                     return(false);
                 }
                 // also was geeignetes dabei
                 IGeoObject ss = Make3D.MakeRuledShell(p1, p2, Frame.Project);
                 if (ss != null)
                 {
                     if (base.ActiveObject != null)
                     {
                         ss.CopyAttributes(base.ActiveObject);
                     }
                     // der block wird das neue aktive Objekt, er muss die Attribute tragen, weil sie später
                     // wieder von ihm verlangt werden
                     //                        ss.CopyAttributes(attrObject);
                     base.ActiveObject     = ss; // darstellen
                     base.ShowActiveObject = true;
                     return(true);
                 }
             }
         }
     }
     base.ShowActiveObject = false;
     return(false);
 }
Пример #2
0
        static public void ruledFaceDo(GeoObjectList geoObjectList, IFrame frame)
        { // im Falle zweier selektierter Pfade: alles machen ohne Aktion!
            bool pathCreatedFromModel1 = false;
            bool pathCreatedFromModel2 = false;
            // erstmal versuchen, Pfade draus zu machen
            Path p1;

            if (geoObjectList[0] is Path)
            { // schon fertig
                p1 = geoObjectList[0].Clone() as Path;
            }
            else
            {  // Pfad aus Einzelobjekt machen:
                p1 = findPath(geoObjectList[0], frame.ActiveView.Model, out pathCreatedFromModel1);
            }
            Path p2;

            if (geoObjectList[1] is Path)
            { // schon fertig
                p2 = geoObjectList[1].Clone() as Path;
            }
            else
            {  // Pfad aus Einzelobjekt machen:
                p2 = findPath(geoObjectList[1], frame.ActiveView.Model, out pathCreatedFromModel2);
            }
            IGeoObject ss = null;

            if ((p1 != null) && (p2 != null))
            {
                ss = Make3D.MakeRuledShell(p1, p2, frame.Project);
            }
            if (ss != null)
            {
                using (frame.Project.Undo.UndoFrame)
                {
                    ss.CopyAttributes(geoObjectList[0]);
                    frame.Project.GetActiveModel().Add(ss); // einfügen
                    if (!pathCreatedFromModel2 && frame.GetBooleanSetting("Construct.3D_Delete2DBase", false))
                    {
                        geoObjectList[1].Owner.Remove(geoObjectList[1] as IGeoObject);                                                                                        // Original weg
                    }
                    if (pathCreatedFromModel2)
                    { // die Einzelelemente des CreateFromModel identifizieren
                        for (int i = 0; i < p2.Count; ++i)
                        {
                            IGeoObject obj = null;
                            if ((p2.Curve(i) as IGeoObject).UserData.ContainsData("CADability.Path.Original"))
                            {
                                obj = (p2.Curve(i) as IGeoObject).UserData.GetData("CADability.Path.Original") as IGeoObject;
                            }
                            if (obj != null && obj.Owner != null)
                            {
                                obj.Owner.Remove(obj);                                   // löschen
                            }
                        }
                    }
                    if (!pathCreatedFromModel1 && frame.GetBooleanSetting("Construct.3D_Delete2DBase", false))
                    {
                        geoObjectList[0].Owner.Remove(geoObjectList[0] as IGeoObject);
                    }
                    if (pathCreatedFromModel1)
                    { // die Einzelelemente des CreateFromModel identifizieren
                        for (int i = 0; i < p1.Count; ++i)
                        {
                            IGeoObject obj = null;
                            if ((p1.Curve(i) as IGeoObject).UserData.ContainsData("CADability.Path.Original"))
                            {
                                obj = (p1.Curve(i) as IGeoObject).UserData.GetData("CADability.Path.Original") as IGeoObject;
                            }
                            if (obj != null && obj.Owner != null)
                            {
                                obj.Owner.Remove(obj);                                   // löschen
                            }
                        }
                    }
                }
            }
        }