CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

Export 方法 (ActiveX)

2024-5-18 18:55| 发布者: admin| 查看: 147| 评论: 0|原作者: admin|来自: AutoCAD

Export 方法 (ActiveX)

将 AutoCAD 图形或一组保存的图层设置导出到文件。

支持的平台:仅限 Windows

签名 - 文档

VBA:

object.Export FileName, Extension, SelectionSet
对象

类别: 文档

此方法应用到的对象。

文件名

访问:仅输入

类型:字符串

新导出文件的名称。

外延

访问:仅输入

类型:字符串

此字符串应包含三个字符,用于指定要将图形导出到的文件类型。大小写并不重要。使用以下扩展名之一:.wmf.sat.eps.dxf.bmp

Selection集

访问:仅输入

类型:SelectionSet

对于 WMF、SAT 和 BMP 格式,选择集指定要导出的对象。对于 EPS 和 DXF 格式,将忽略选择集并输出整个图形。

签名 - LayerStateManager

VBA:

object.Export Name, FileName
对象

类型:LayerStateManager

此方法应用到的对象。

名字

访问:仅输入

类型:字符串

要导出的已保存图层设置的名称。

文件名

访问:仅输入

类型:字符串

要将图层设置导出到的文件的名称。

返回值 (RetVal)

无返回值。

言论

导出为 WMF 或 BMP 格式时,选择集指定图形中要输出的对象。如果提供了空的选择集,则会提示用户选择对象。如果提供,而不是空选择集,则输出整个图形。Nothing

导出为 SAT 格式时,指定的选择集必须包含一个或多个对象。此选择集指定图形中要输出的对象。仅导出对象、对象、非流形实体和其他不符合 or 对象特征的 ShapeManager 实体;选择集中的所有其他对象都将被忽略。如果提供了空的选择集,则执行该方法时不会出错,并且不会导出任何对象。Region3DSolid3DSolidRegion

导出为 EPS 或 DXF 格式时,将忽略选择集并导出整个图形。

导出保存的图层设置时,必须将输出文件命名为 .las 扩展名,以便 AutoCAD 自动将其标识为保存的图层设置导出文件。

例子

VBA:

Sub Example_Export()
    ' This example exports the current drawing to DXF format.
    ' Note that a valid selection set must be provided, even
    ' though the contents of the selection set are ignored.
    
    ' Define the name for the exported file
    Dim exportFile As String
    exportFile = "C:\AutoCAD\DXFExport"     ' Adjust path to match your system
    
    ' Create an empty selection set
    Dim sset As AcadSelectionSet
    Set sset = ThisDrawing.SelectionSets.Add("TEST")
    
    ' Export the current drawing to the file specified above.
    ThisDrawing.Export exportFile, "DXF", sset
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Export()
    ;; This example exports the current drawing to DXF format.
    ;; Note that a valid selection set must be provided, even
    ;; though the contents of the selection set are ignored.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))     
    
    ;; Define the name for the exported file
    (setq exportFile "C:\\AutoCAD\\DXFExport")     ;; Adjust path to match your system
    
    ;; Create an empty selection set
    (setq sset (vla-Add (vla-get-SelectionSets doc) "TEST"))
    (vla-Select sset acSelectionSetAll)
    
    ;; Export the current drawing to the file specified above.
    (vla-Export doc exportFile "DXF" sset)

    (vla-Delete sset)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-14 05:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部