CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

文本移动属性 (ActiveX)

2023-1-3 03:53| 发布者: admin| 查看: 185| 评论: 0|来自: AutoCAD

摘要: 指定移动文本时如何绘制尺寸文本。

指定移动文本时如何绘制尺寸文本。

支持的平台:仅窗口

签名

工 务 局:

object.TextMovement
对象

类型:暗三点角度,暗对齐,暗,暗弧长度,暗直径,尺寸,暗坐标,径向,向大,暗旋转

此属性适用的对象。

属性值

只读:

类型:枚举acDimTextMovement

  • acDimLineWithText:尺寸线跟在文本后面。
  • acMoveTextAddLeader:文本独立于尺寸线移动,从文本到尺寸线绘制引线。
  • acMoveTextNoLeader:文本独立于尺寸线移动,没有从文本绘制到尺寸线的引线。

言论

此属性的初始值为。acMoveTextNoLeader

注意:此属性将覆盖给定维度的 DIMTMOVE 系统变量的值。

例子

工 务 局:

Sub Example_TextMovement()
    ' This example creates two aligned dimensions in model space and
    ' sets the TextMovement property of each one differently to allow
    ' the user to see the differences this property makes when moving
    ' dimension text
    '
    ' To see the effects of this property:
    ' 1) Run this sample
    ' 2) Enter the drawing and move the dimension text of the leftmost object
    '    on the screen with the mouse or keyboard.
    ' 3) Notice the position of the dimension lines
    ' 4) Repeat with the rightmost object
   
    Dim dimObj1 As AcadDimAligned, dimObj2 As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim location1(0 To 2) As Double, location2(0 To 2) As Double
        
    ' Define the two dimensions
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6: point2(1) = 5: point2(2) = 0
    location1(0) = 5: location1(1) = 7: location1(2) = 0
    
    point3(0) = 7: point3(1) = 5: point3(2) = 0
    point4(0) = 8: point4(1) = 5: point4(2) = 0
    location2(0) = 5: location2(1) = 7: location2(2) = 0
    
    ' Create the aligned dimension objects in model space
    Set dimObj1 = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location1)
    Set dimObj2 = ThisDrawing.ModelSpace.AddDimAligned(point3, point4, location2)
    
    ThisDrawing.Application.ZoomAll

    ' Set the text movement of the new dimensions to different values
    dimObj1.TextMovement = acMoveTextNoLeader
    location1(0) = 5.5: location1(1) = 7.5: location1(2) = 0
    dimObj1.TextPosition = location1
    dimObj2.TextMovement = acDimLineWithText
    location2(0) = 7.5: location2(1) = 7.5: location2(2) = 0
    dimObj2.TextPosition = location2
       
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextMovement()
    ;; This example creates two aligned dimensions in model space and
    ;; sets the TextMovement property of each one differently to allow
    ;; the user to see the differences this property makes when moving
    ;; dimension text
    ;;
    ;; To see the effects of this property:
    ;; 1) Run this sample
    ;; 2) Enter the drawing and move the dimension text of the leftmost object
    ;;    on the screen with the mouse or keyboard.
    ;; 3) Notice the position of the dimension lines
    ;; 4) Repeat with the rightmost object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
          
    ;; Define the two dimensions
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6 5 0)
          location1 (vlax-3d-point 5 7 0))

    (setq point3 (vlax-3d-point 7 5 0)
          point4 (vlax-3d-point 8 5 0)
          location2 (vlax-3d-point 5 7 0))
    
    ;; Create the aligned dimension objects in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj1 (vla-AddDimAligned modelSpace point1 point2 location1))
    (setq dimObj2 (vla-AddDimAligned modelSpace point3 point4 location2))
    (vla-ZoomAll acadObj)

    ;; Set the text movement of the new dimensions to different values
    (vla-put-TextMovement dimObj1 acMoveTextNoLeader)
    (setq location1 (vlax-3d-point 5.5 7.5 0))
    (vla-put-TextPosition dimObj1 location1)
    (vla-put-TextMovement dimObj2 acDimLineWithText)
    (setq location2 (vlax-3d-point 7.5 7.5 0))
    (vla-put-TextPosition dimObj2 location2)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 17:37

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部