Example #1
0
 private static void DrawDottedLine(ModelDoc2 swModel, Entity ent1, Entity ent2)
 {
     swModel.SetAddToDB(true);
     if (ent1 != null && ent2 != null)
     {
         swModel.SketchManager.CreateCenterLine(1, 1, 0, 1.1, 1.1, 0);
         var objPoints = (object[])swModel.SketchManager.ActiveSketch.GetSketchPoints();
         SketchPoint swPoint1 = null, swPoint2 = null;
         foreach (var objPoint in objPoints)
         {
             var swPoint = (SketchPoint)objPoint;
             double x1 = 1 - swPoint.X;
             double x2 = 1.1 - swPoint.X;
             double y1 = 1 - swPoint.Y;
             double y2 = 1.1 - swPoint.Y;
             if (x1 < 0)
                 x1 = -x1;
             if (x2 < 0)
                 x2 = -x2;
             if (y1 < 0)
                 y1 = -y1;
             if (y2 < 0)
                 y2 = -y2;
             if (x1 < 0.0001 && y1 < 0.0001)
             {
                 swPoint1 = swPoint;
             }
             if (x2 < 0.0001 && y2 < 0.0001)
             {
                 swPoint2 = swPoint;
             }
         }
         if (swPoint1 != null && swPoint2 != null)
         {
             if (swPoint1.Select(false) && ent1.Select(true))
             {
                 swModel.SketchAddConstraints("sgCONCENTRIC");
             }
             if (swPoint2.Select(false) && ent2.Select(true))
             {
                 swModel.SketchAddConstraints("sgCONCENTRIC");
             }
         }
     }
     swModel.SetAddToDB(false);
     swModel.GraphicsRedraw2();
     swModel.ClearSelection();
     //swModel.ClearUndoList();
 }
Example #2
0
    // ===============================================================
    // Entities
    // ===============================================================
    private void SelectEntity(Entity entity)
    {
        Entity[] entities = FindObjectsOfType<Entity>();
        foreach(Entity ent in entities) {
            ent.Deselect();
        }

        entity.Select();
        selectedEntity = entity;

        //SelectGameTool(GameTools.NONE);
    }