ahlzl 发表于 2008-6-14 05:41:02

Question: samples\entity\hilight_dg of SDK2009

if visualstyle is "2dWireframe" ,OK!
but isn't, Select edge might fail!

MickD 发表于 2008-6-14 21:14:29

Do you have a little more information for us ahlzl?
If I get want you mean, when 'picking' objects on the screen you are actually picking pixels which are traced back to their owners that draw them such as a line, edge or face. If it's not 2d wire frame (all lines/edges) it becomes very hard to determine an edge when the whole face is rendered as the edge is also rendered, if that makes sense.

ahlzl 发表于 2008-6-14 22:08:33

thank you, MickD .
but use AutoCAD command ——"solidedit", Select edge success 100% in any visualstyle !!!
How modify SDK's code?
thanks

MickD 发表于 2008-6-14 23:06:58

Ok, when using the acad command it highlights the edges yes? This allows you to be able to pick the isolated highlighted edge. In you code you need highlight the object, have a look at 'highlighting' in the help doc's, you may also need to catch the mouse over event or similar to imitate how autocad does this without actually picking an object.
Do you have any code so far we might be able to help you with?

ahlzl 发表于 2008-6-14 23:45:32

thanks again !
I write C# code, also fail !using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Colors;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
namespace ABC
{
    public class Class1
    {
      
      public void MyTest()
      {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                TypedValue value = new TypedValue((int)DxfCode.Start, "3DSOLID");
                TypedValue[] values = { value };
                SelectionFilter sfilter = new SelectionFilter(values);
                PromptSelectionOptions opt = new PromptSelectionOptions();
                opt.SingleOnly = true;
                PromptSelectionResult res = ed.GetSelection(opt, sfilter);
                if (res.Status != PromptStatus.OK)
                {
                  return;
                }
                SelectionSet ss = res.Value;
                ObjectId objId = ss.ObjectId;
                Solid3d ent = (Solid3d)trans.GetObject(objId, OpenMode.ForWrite);
                int marker = ss.GraphicsSystemMarker;
                Matrix3d xform = Matrix3d.Identity;
                Point3d pickPoint = new Point3d(0, 0, 0);
                FullSubentityPath[] pathes;
                try
                {
                  pathes = ent.GetSubentityPathsAtGraphicsMarker
                        (SubentityType.Edge, marker, pickPoint, xform, 0, null);
                }
                catch (System.Exception e)
                {
                  ed.WriteMessage("\n" + e.Message);
                  return;
                }
                ent.Highlight(pathes, false);
                ed.GetString("\nEnter...");
                ent.Unhighlight(pathes, false);
                Color myColor = Color.FromColorIndex(ColorMethod.ByColor, 1);
                SubentityId edgeId = pathes.SubentId;
                ent.SetSubentityColor(edgeId, myColor);
                trans.Commit();
            }
      }
    }
}
I declare fail, and waitMickD、 Daniel、 other man

ahlzl 发表于 2008-6-15 12:44:06

I tried your routine. It does seem like a bug.You might post it at the Autodesk Discussion Groups to see if anyone has an alternative method. Sorry I couldn’t be of much help
页: [1]
查看完整版本: Question: samples\entity\hilight_dg of SDK2009