一、前言

  使用pyautocad编辑好cad图纸后,往往涉及到一个保存的问题,但是官方文档并未提及,所以只能自己来了,测试了好久,终于是找到了保存的命令和参数说明。

二、方法介绍 

  • Autocad.doc.SaveAs()

    autocad文档如下:

      

Signatures

object.SaveAs FileName, FileType [, SecurityParams]

Object

Document, MenuGroup
The object or objects this
method applies to.

Note This method has no effect for menu groups.

FileName

String; input-only
The full path and file name, or
valid URL address, for the file. The active document takes on the new name.

FileType

AcSaveAsType enum; input-only; optional for Document
objects

acR14_dwg

AutoCAD R14 DWG (*.dwg)

ac2000_dwg

AutoCAD 2000 DWG (*.dwg)

ac2000_dxf

AutoCAD 2000 DXF (*.dxf)

ac2000_Template

AutoCAD 2000 Drawing Template File (*.dwt)

ac2004_dwg

AutoCAD 2004 DWG (*.dwg)

ac2004_dxf

AutoCAD 2004 DXF (*.dxf)

ac2004_Template

AutoCAD 2004 Drawing Template File (*.dwt)

ac2007_dwg

AutoCAD 2007 DWG (*.dwg)

ac2007_dxf

AutoCAD 2007 DXF (*.dxf)

ac2007_Template

AutoCAD 2007 Drawing Template File (*.dwt)

acNative

A synonym for the latest drawing release. In this
release, this value equals ac2007_dwg.

SecurityParams

SecurityParams
object; variant; optional for Document objects
Security settings for an
encrypted drawing.

Remarks

The default file type for documents is ac2007_dwg. The value acR14_dxf is obsolete.

Documents can be saved only as files with the extensions indicated
above. To save a document in a different file type, use the Export method.

When saving to a secure URL, a dialog box prompts the user for the
necessary password information. Message boxes appear if the user has not
suppressed this activity in the browser.

Menu groups cannot be saved in AutoCAD 2006 and later releases.
This method will be removed from the MenuGroup object in a future release.

   

  简单来说,该方法涉及三个参数:

  •  FileName 

          文件名,要求string类型,如要保存到指定位置,加上完整路径

  •  Filetype

          文件类型,枚举类型,但是python好像设置不了,默认2007.dwg

  •  SecurityParams  

     安全设置,暂时用不到,留空

二、方法实例

  

  1. from pyautocad import Autocad,APoint
  2.  
  3. acad = Autocad(create_if_not_exists=True)
  4. acad.prompt("hello,test saveas")
  5. d1 = APoint(0,0,)
  6.  
  7. #默认保存为2007dwg
  8. acad.doc.SaveAs('d:/22/test_SaveAs')
  9. #保存为dwf
  10. acad.doc.SaveAs('d:/22/test_SaveAs',1)

  

枚举类型测试:

  1. for i in range(100):
  2. try:
  3. acad.doc.SaveAs('d:/22/file-%s'%i,i)
  4. time.sleep(1)
  5. except:
  6. continue

  

    

文件另存为——Autocad.doc.SaveAs的更多相关文章

  1. python3将docx转换成pdf,html文件,pdf转doc文件

    直接上代码 # -*- encoding:utf-8 -*- """ author:lgh 简单的doc转pdf,html,pdf转doc脚本 依赖库pdfminer3k ...

  2. ExportAsFixedFormat Visio文件另存为其他几种格式的处理

    Visio文件另存为其他几种格式的处理,以及另存为Web文件等相关操作. 1.Visio导出为PDF格式 在一般情况下,PDF格式是较为常用的内容格式,因此Visio文档(Vsd格式)导出为PDF也是 ...

  3. JS实现文件另存为

    JS实现文件另存为 //下载平面图 function downPlan() { var oPop = window.open(src, "", "width=1, hei ...

  4. 如何将SolidWorks文件另存为.obj文件及如何打开.obj格式文件

    原网站:http://fans.solidworks.com.cn/forum.php?mod=viewthread&tid=40238) OBJ文件是Alias Wavefront公司为它的 ...

  5. txt文本程序 打开python文件 另存为原来的文件名,不能覆盖原来的文件解决

    txt文本程序 打开python文件 另存为原来的文件名,不能覆盖原来的文件 如:1.py文件用txt文本程序打开后,另存为 1.py,保存完毕后,不覆盖1.py文件,会生成 1.py.txt文件 原 ...

  6. asp.net文件下载文件另存为

    这是一个困惑已久的问题…… 首先,用<a>标签的href打开浏览器能解读的文件(如txt,jpg,pdf等),会自动打开,无法做到弹出另存为的效果. 其次,网上搜索了各种JS解决办法,包括 ...

  7. 15个最好的PDF转word的在线转换器,将PDF文件转换成doc文件

    PDF是一种文件格式,包含文本,图像,数据等,这是独立于操作系统的文件类型.它是一个开放的标准,压缩,另一方面DOC文件和矢量图形是由微软文字处理文件.该文件格式将纯文本格式转换为格式化文档.它支持几 ...

  8. 12.2 中的Data Guard Standby 密码文件自动同步 (Doc ID 2307365.1)

    Data Guard Standby Automatic Password file Synchronization in 12.2 (Doc ID 2307365.1) APPLIES TO: Or ...

  9. linux下的ssh工具之,本地上传到linux服务器and Linux服务器文件另存为本地。非sftp工具。

    首先,当你只有一个ssh工具可以连接linux,但你有想把文件在 linux 和windows(本地)直接的切换.其实可以的: 本文参考 1.将本地的文件,放到ssh远程的linux服务器上: 首先要 ...

随机推荐

  1. NOJ——1568走走走走走啊走(超级入门DP)

    [1568] 走走走走走啊走 时间限制: 1000 ms 内存限制: 65535 K 问题描述 菜菜赚了钱回来,想起要买很多桶回来,不同地方的桶质量是不同的,他在(1,1)点出发因为飞机票有点贵所以他 ...

  2. BZOJ-1036 [ZJOI2008]树的统计

    树链剖分模版题. #include <cstdlib> #include <cstdio> #include <cstring> #include <algo ...

  3. spring的事务传播与隔离

    propagation 事务的传播属性: 1.PROPAGATION_REQUIRED(*-required):支持当前事务,如果当前没有事务,就新建一个事务.(最常见的选择) 2.PROPAGATI ...

  4. hdu 4300 kmp算法扩展

    Clairewd’s message Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  5. poj 2492 A Bug's Life 二分图染色 || 种类并查集

    题目链接 题意 有一种\(bug\),所有的交往只在异性间发生.现给出所有的交往列表,问是否有可疑的\(bug\)(进行同性交往). 思路 法一:种类并查集 参考:https://www.2cto.c ...

  6. npm-debug.log文件出现原因

    项目主目录下总是会出现这个文件,而且不止一个,原因是npm i 的时候,如果报错,就会增加一个此文件来显示报错信息,npm install的时候则不会出现.

  7. PL/SQL Developer工具包和InstantClient连接Oracle 11g数据库

    一.前言 PLSQL Developer是Oracle数据库开发工具,很牛也很好用,PLSQL Developer功能很强大,可以做为集成调试器,有SQL窗口,命令窗口,对象浏览器和性能优化等功能. ...

  8. 获取某个元素相对于视窗的位置-getBoundingClientRect

    1. getBoundingClientRect用于获取某个元素相对于视窗的位置集合.集合中有top, right, bottom, left等属性. 语法:这个方法没有参数 rectObject = ...

  9. Python递归函数和二分查找算法

    递归函数:在一个函数里在调用这个函数本身. 递归的最大深度:998 正如你们刚刚看到的,递归函数如果不受到外力的阻止会一直执行下去.但是我们之前已经说过关于函数调用的问题,每一次函数调用都会产生一个属 ...

  10. 精读《Function Component 入门》

    1. 引言 如果你在使用 React 16,可以尝试 Function Component 风格,享受更大的灵活性.但在尝试之前,最好先阅读本文,对 Function Component 的思维模式有 ...