CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

添加容差方法 (ActiveX)

2023-1-4 12:10| 发布者: admin| 查看: 656| 评论: 0|来自: AutoCAD

摘要: 创建容差图元。

创建容差图元。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.AddTolerance(Text, InsertionPoint, Direction)
对象

类型:模型空间,图纸空间

此方法适用的对象。

发短信

访问:仅输入

类型:字符串

容差的文本字符串。

插入点

访问:仅输入

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

图形中的 3D WCS 坐标指定公差符号的位置。

方向

访问:仅输入

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

指定公差符号方向的 3D 方向矢量。

返回值(RetVal)

类型:公差

新创建的对象。Tolerance

言论

没有额外的评论。

例子

工 务 局:

Sub Example_AddTolerance()
    ' This example creates a tolerance object in model space.
    
    Dim toleranceObj As AcadTolerance
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim direction(0 To 2) As Double
	    
    ' Define the tolerance object
    textString = "{\Fgdt;r}%%vasdf{\Fgdt;l}%%vdf%%vxc%%v12{\Fgdt;m}%%vsd" & vbCrLf & _
                 "{\Fgdt;t}%%vdfd%%v3dd{\Fgdt;l}%%vv%%v%%vxc{\Fgdt;m}" & vbCrLf & _
                 "123"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    direction(0) = 1#: direction(1) = 1#: direction(2) = 0#
	
    ' Create the tolerance object in model space
    Set toleranceObj = ThisDrawing.ModelSpace.AddTolerance(textString, insertionPoint, direction)
    ZoomAll
   
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddTolerance()
    ;; This example creates a tolerance object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the tolerance object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          direction (vlax-3d-point 1 0 0))
  
    (setq textString (strcat "{\\Fgdt;r}%%vasdf{\\Fgdt;l}%%vdf%%vxc%%v12{\\Fgdt;m}%%vsd\n"
                             "{\\Fgdt;t}%%vdfd%%v3dd{\\Fgdt;l}%%vv%%v%%vxc{\\Fgdt;m}\n"
                             "123"
                     )
    )
	
    ;; Create the tolerance object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq toleranceObj (vla-AddTolerance modelSpace textString insertionPoint direction))  
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-27 09:46

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部