Export 方法 (ActiveX) 
将 AutoCAD 图形或一组保存的图层设置导出到文件。 支持的平台:仅限 Windows 签名 - 文档VBA: object.Export FileName, Extension, SelectionSet 
 签名 - LayerStateManagerVBA: object.Export Name, FileName 
 返回值 (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)
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 20:17
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.