CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

选择方法 (ActiveX)

2023-1-4 03:57| 发布者: admin| 查看: 659| 评论: 0|来自: AutoCAD

摘要: 选择对象并将其放入选择集中,或选择表格中的单元格。

选择对象并将其放入选择集中,或选择表格中的单元格。

支持的平台:仅窗口

签名 - 选择集

工 务 局:

object.Select Mode [, Point1] [, Point2] [, FilterType, FilterData]
对象

类型:选择集

此方法适用的对象。

模式

访问:仅输入

类型:枚举AcSelect

  • acSelectionSetWindow
  • acSelectionSetCrossing
  • acSelectionSetPrevious
  • acSelectionSetLast
  • acSelectionSetAll
要点1

访问:仅输入;自选

类型:变体(双精度的三元素数组)

指定Point1 的 3D WCS 坐标或坐标数组。请参阅模式定义以正确使用Point1

要点2

访问:仅输入;自选

类型:变体(双精度的三元素数组)

指定Point2 的 3D WCS 坐标。请参阅模式定义以正确使用Point2

过滤器类型

访问:仅输入;自选

类型:变体

指定要使用的筛选器类型的 DXF 组代码。

过滤数据

访问:仅输入;自选

类型:变体

要筛选的值。

签名 - 表

工 务 局:

object.Select wpt, wvwVec, wvwxvec, wxaper, wyaper, allowOutside, resultRowIndex, resultColumnIndex
对象

类型:桌子

此方法适用的对象。

WPT

访问:仅输入

类型:变体

WCS 中的 3D 点指定输入拾取点。

wvwVec

访问:仅输入

类型:变体

WCS 中的 3D 矢量指定命中测试的视图方向。

wvwxvec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view orientation for the hit test.

wxaper

Access: Output-only

Type: Double

Width of aperture box centered at the hit point for the hit test; reserved for future use.

wyaper

Access: Output-only

Type: Double

Height of aperture box centered at the hit point for the hit test; reserved for future use.

allowOutside

Access: Input-only

Type: Boolean

  • True: Pick point outside the table will select a cell.
  • False: Pick point outside the table will not select a cell.
resultRowIndex

Access: Output-only

Type: Long

Row index of the selected cell.

resultColumnIndex

Access: Output-only

Type: Long

Column index of the selected cell.

Return Value (RetVal)

No return value.

Remarks - SelectionSet

This method supports the filtering mechanism.

The following selection modes are available:

  • Window: Selects all objects completely inside a rectangular area whose corners are defined by Point1 and Point2.
  • Crossing: Selects objects within and crossing a rectangular area whose corners are defined by Point1 and Point2.
  • Previous: Selects the most recent selection set. This mode is ignored if you switch between paper space and model space and attempt to use the selection set.
  • Last: Selects the most recently created visible objects.
  • All: Selects all objects.

For more selection mode options, see the , , and methods. SelectByPolygonSelectAtPointSelectOnScreen

Remarks - Table

This function selects a cell in the table by specifying a point, viewing direction, and orientation. The row and column index of the selected cell are returned in resultRowIndex and resultColumnIndex.

Examples

VBA:

Sub Example_Select()
    ' This example adds members to a selection set, first by crossing and
    ' then by filtering for circles.
    
    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
    
    ' Add all object to the selection set that lie within a crossing of (28,17,0) and
    ' (-3.3, -3.6,0) 
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double
    
    mode = acSelectionSetCrossing
    corner1(0) = 28: corner1(1) = 17: corner1(2) = 0
    corner2(0) = -3.3: corner2(1) = -3.6: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2
    
    ' Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ' (-3.3, -3.6,0) by filtering from the current drawing
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"
    
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
    
    ssetObj.Select mode, corner1, corner2, groupCode, dataCode
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Select()
    ;; This example adds members to a selection set, first by crossing and
    ;; then by filtering for circles.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SSET"))
    
    ;; Add all object to the selection set that lie within a crossing of (28,17,0) and
    ;; (-3.3, -3.6,0)
    (setq mode acSelectionSetCrossing
          corner1 (vlax-3d-point 28 17 0)
          corner2 (vlax-3d-point -3.3 -3.6 0))

    (vla-Select ssetObj mode corner1 corner2)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Clear ssetObj)
  
    ;; Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ;; (-3.3, -3.6,0) by filtering from the current drawing
    (setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 0)))
    (vlax-safearray-put-element gpCode 0 0)
    (setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 0)))
    (vlax-safearray-put-element dataValue 0 "Circle")
    
    (vla-Select ssetObj mode corner1 corner2 gpCode dataValue)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))

    (vla-Delete ssetObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 18:06

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部