LinetypeScale 属性 (ActiveX) 
指定对象的线型比例。 支持的平台:仅限 Windows 签名VBA: object.LinetypeScale 属性值只读:不;只写对象除外Group 类型:双 此值必须为正实数。默认值为 1.0。 言论对象的线型比例指定每个绘图单位的虚线点线型的相对长度。 
 例子VBA: Sub Example_LinetypeScale()
    ' This example creates a line and finds the linetype scale
    ' for the line. It then changes the linetype scale, and finally
    ' resets the linetype scale back to the original value.
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine
    Dim currLTScale As Double
    ' Create a Line object in model space
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Update
    currLTScale = lineObj.LinetypeScale
    MsgBox "The linetype scale for the line is: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"
    ' Set the linetype scale of a Line to .5
    lineObj.LinetypeScale = 0.5
    lineObj.Update
    MsgBox "The new linetype scale for the line is: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"
    
    ' Reset the linetype scale of a Line to what is was before
    lineObj.LinetypeScale = currLTScale
    lineObj.Update
    MsgBox "The linetype scale for the line is reset to: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_LinetypeScale()
    ;; This example creates a line and finds the linetype scale
    ;; for the line. It then changes the linetype scale, and finally
    ;; resets the linetype scale back to the original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 2 2 0)
          endPoint (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-Update lineObj)
  
    (setq currLTScale (vla-get-LinetypeScale lineObj))
    (alert (strcat "The linetype scale for the line is: " (rtos currLTScale 2)))
    ;; Set the linetype scale of a Line to .5
    (vla-put-LinetypeScale lineObj 0.5)
    (vla-Update lineObj)
    (alert (strcat "The new linetype scale for the line is: " (rtos (vla-get-LinetypeScale lineObj) 2)))
    
    ;; Reset the linetype scale of a Line to what is was before
    (vla-put-LinetypeScale lineObj currLTScale)
    (vla-Update lineObj)
    (alert (strcat "The linetype scale for the line is reset to: " (rtos (vla-get-LinetypeScale lineObj) 2)))
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 15:16
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.