コード例 #1
0
 private bool ruledSolidOrg()
 {
     if (((p1 as ICurve).GetPlanarState() == PlanarState.Planar) && ((p2 as ICurve).GetPlanarState() == PlanarState.Planar))
     {     // also nur Ebene Pfade mit unterschiedlichen Ebenen:
         if (!Precision.IsEqual((p1 as ICurve).GetPlane(), (p2 as ICurve).GetPlane()))
         { // also was geeignetes dabei
             Solid ss = Make3D.MakeRuledSolid(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 ruledSolidDo(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);
            }
            Solid ss = null;

            if ((p1 != null) && (p2 != null))
            {
                ss = Make3D.MakeRuledSolid(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
                            }
                        }
                    }
                }
            }
        }