CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

基点属性 (ActiveX)

2023-1-3 21:33| 发布者: admin| 查看: 406| 评论: 0|来自: AutoCAD

摘要: 指定射线或构造线通过的点。

指定射线或构造线通过的点。

支持的平台:仅窗口

签名

工 务 局:

object.BasePoint
对象

类型:射线,射线

此属性适用的对象。

属性值

只读:

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

表示射线或构造线通过的点的 3D 坐标。

言论

没有额外的评论。

例子

工 务 局:

Sub Example_BasePoint()
    ' This example creates a ray object. It then finds the
    ' base point of the ray, changes the base point, and
    ' queries the new base point.
    Dim basePoint(0 To 2) As Double
    Dim directionVec(0 To 2) As Double
    Dim rayObj As AcadRay
    
    ' Establish the base point and directional vector for the ray
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#
    
    ' Create a Ray object in model space
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, directionVec)
    
    ThisDrawing.Regen True
    MsgBox "A new Ray has been added.", vbInformation
    
    ' Define a new base point
    Dim newBase(0 To 2) As Double
    newBase(0) = 4#: newBase(1) = 2#: newBase(2) = 0#
    
    ' Update the ray using the new base point
    rayObj.basePoint = newBase
            
    ' Query the new basepoint for the Ray
    Dim currBase As Variant      ' Note that return from basepoint property is Variant and not a SafeArray
    Dim msg As String
    currBase = rayObj.basePoint
    msg = currBase(0) & ", " & currBase(1) & ", " & currBase(2)
    
    ThisDrawing.Regen True
    MsgBox "We've just changed the basepoint of the new Ray to: " & msg, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BasePoint()
    ;; This example creates a ray object. It then finds the
    ;; base point of the ray, changes the base point, and
    ;; queries the new base point.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Establish the base point and directional vector for the ray
    (setq basePoint (vlax-3d-point 3 3 0)
          directionVec (vlax-3d-point 1 1 0))
    
    ;; Create a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq rayObj (vla-AddRay modelSpace basePoint directionVec))
    
    (vla-Regen doc :vlax-true)
    (alert "A new Ray has been added.")
    
    ;; Define a new base point
    (setq newBase (vlax-3d-point 4 2 0))
    
    ;; Update the ray using the new base point
    (vla-put-basePoint rayObj newBase)
            
    ;; Query the new basepoint for the Ray
    (setq currBase (vlax-safearray->list (vlax-variant-value (vla-get-BasePoint rayObj))))
    (setq msg (strcat (rtos (nth 0 currBase) 2) ", "
		      (rtos (nth 1 currBase) 2) ", "
		      (rtos (nth 2 currBase) 2)))
    
    (vla-Regen doc :vlax-true)
    (alert (strcat "We've just changed the basepoint of the new Ray to: " msg))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部