GetObjectSnapPoints函数的主要参数介绍 by游天居士


GetObjectSnapPoints函数的主要参数介绍

定义一:

 

public virtual void GetObjectSnapPoints(ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds);

 

定义二:

 

       public virtual void GetObjectSnapPoints(ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds, Matrix3d insertionMat)

 

 

(1)


snapMode 是enum类型 ,这是对象捕捉模式设置ObjectSnapModes的枚举名称取值如下表:

Member Name

 

Description

 

Value

 

Description的翻译

 

ModeNear

 

Nearest.

 

10

 

最近点

 

ModeTangent

 

Tangent.

 

9

 

切点

 

ModePerpendicular

 

Perpendicular.

 

8

 

垂足

 

ModeIns

 

Insertion.

 

7

 

插入点

 

ModeQuad

 

Quadrant.

 

5

 

象限点

 

ModeNode

 

Node.

 

4

 

节点;交叉点

 

ModeCenter

 

Center.

 

3

 

圆心

 

ModeMid

 

Midpoint.

 

2

 

中点

 

ModeEnd

 

Endpoint.

 

1

 

端点

 

 


(2)gsSelectionMark是int类型, Graphics System Selection Mark,即选择集中图元的图形系统标记。每个实体可能包含多个子实体,一般设置为0,代表整个实体。可精细设置到具体实体内部的子实体。

(3)pickPoint是Point3d 类型 ,设置拾取点,如果不是有具本要求如求最近点的话可以设置为(0,0,0)

(4)snapPoints是Point3dCollection类型 ,获取捕捉点集合对象

(5)其它参数设置详见Autodesk.AutoCAD.Geometry空间介绍

[CommandMethod("DispGetEntsnap", CommandFlags.Session)]

public void DispGetEntsnap()//遍历显示捕捉点(端点)

        {

            using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())

// 游天居士到此一游

            {

                Database db = HostApplicationServices.WorkingDatabase;

                using (Transaction trans = db.TransactionManager.StartTransaction())

                {

                    Entity ent = (Entity)trans.GetObject(GetSelectFirstEntityid(), OpenMode.ForWrite);

                    Point3d pickPt = new Point3d(0, 0, 0);

                    Point3dCollection snapPts = new Point3dCollection();

                    IntegerCollection geomIds = new IntegerCollection();

                    geomIds.Add(0);

                    ent.GetObjectSnapPoints(ObjectSnapModes.ModeEnd, 0, pickPt, pickPt, Matrix3d.Identity, snapPts, geomIds);

                    for (int i = 0; i < snapPts.Count; i++)

                    {

                        ed.WriteMessage("\n点是:" + (i + 1).ToString() + ":"+snapPts.ToString());

                    }

                    trans.Commit();

                }

            }

        }  

 

 

 

posted @ 2012-11-19 22:09  游天居士  阅读(704)  评论(0编辑  收藏  举报