For a 64-Bit system, gets an object or subentity interactively. (Obsolete)
Supported platforms: Windows only
VBA:
object.GetSubEntity32 Object, PickedPoint, TransMatrix, ContextData [, Prompt]
Type: Utility
The object this method applies to.
Access: Output-only
Type: Object
The picked object or subentity. Can be one of any of the drawing objects.
Access: Output-only
Type: Variant (three-element array of doubles)
A 3D WCS coordinate specifying the point that was selected.
Access: Output-only
Type: Variant (4x4 array of doubles)
The translation matrix applied to this entity.
Access: Output-only
Type: Variant (array of longs)
An array of object IDs for any nested objects in the selected object.
Access: Input-only; optional
Type: Variant (string)
The text to display to prompt the user for input.
No return value.
This method requires the AutoCAD user to select an object by picking a point on the graphics screen. If an object or subentity is picked, it is returned in the first parameter, and the second parameter will contain the point picked in WCS coordinates. If the pick point is not on an object the method will fail.
This method can retrieve an object even if it is not visible on the screen or if it is on a frozen layer.
VBA:
Sub Example_GetSubEntity() ' This example prompts the user to select on object on the screen with a mouse click, ' and returns some information about the selected object. AppActivate ThisDrawing.Application.Caption Dim Object As Object Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant Dim HasContextData As String On Error GoTo NOT_ENTITY TRYAGAIN: MsgBox "Use the mouse to click on an object in the current drawing after dismissing this dialog box." ' Get information about selected object ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData ' Process and display selected object properties HasContextData = IIf(VarType(ContextData) = vbEmpty, " does not ", " does ") MsgBox "The object you chose was an: " & TypeName(Object) & vbCrLf & _ "Your point of selection was: " & PickedPoint(0) & ", " & _ PickedPoint(1) & ", " & _ PickedPoint(2) & vbCrLf & _ "This object" & HasContextData & "have nested objects." Exit Sub NOT_ENTITY: ' If you click on empty space or do not select an entity, ' this error will be generated If MsgBox("You have not selected an object. Click OK to try again.", _ vbOKCancel & vbInformation) = vbOK Then Resume TRYAGAIN End If End Sub
Visual LISP:
(vl-load-com) (defun c:Example_GetSubEntity() ;; This example prompts the user to select on object on the screen with a mouse click, ;; and returns some information about the selected object. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Get information about selected object (vla-GetSubEntity (vla-get-Utility doc) 'Object 'PickedPoint 'TransMatrix 'ContextData "Select a subentity: ") ;; Process and display selected object properties (if (/= ContextData nil) (setq HasContextData " does ") (setq HasContextData " does not ") ) (alert (strcat "The object you chose was an: " (vla-get-ObjectName Object) "\nYour point of selection was: " (rtos (vlax-safearray-get-element PickedPoint 0) 2) ", " (rtos (vlax-safearray-get-element PickedPoint 1) 2) ", " (rtos (vlax-safearray-get-element PickedPoint 2) 2) "\nThis object" HasContextData "have nested objects.")) )