找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 200|回复: 0

[每日一码] 如何修改图形中XREF路径(包括嵌套)

[复制链接]

0

主题

0

回帖

28

积分

管理员

积分
28
发表于 2024-3-14 20:25:59 | 显示全部楼层 |阅读模式
  1. 问题:
  2. 如何修改图形中XREF路径(包括嵌套)?
  3. How to change the path of Xref (including the nested ones) in a drawing?
  4. 解决方案:
  5. 下面代码段演示来如何修改图形中XREFS的路径指向一个新的位置。对于嵌套的XREFS,代码递归运行改变路径。这个代码适合把XREFS文件从一个目录改变到另外的目录时候使用。
  6. The following code snippet shows how to change the path of all the Xrefs in a given drawing, to point to a new location. The code sample runs recursively to change the paths of the Xref even in the nested Xrefs. This code is useful in situations where the Xrefed drawings are being migrated from one folder/server to another folder/server.
  7. 普通浏览复制代码
  8. // TODO: Here you can add your own includes / declarations
  9. #include "acedxref.h"
  10. void fTest();
  11. void fXrefRePath(const char* pDwgPath,const char* pNewLocation,long mnDepth = 1);
  12. ///////////////////////////////////////////////////////////////////////////////////////////////
  13. //Description: fGetXYPlane
  14. //1)Call this from ARX defined command
  15. ///////////////////////////////////////////////////////////////////////////////////////////////
  16. void fTest()
  17. {
  18. acutPrintf(采用T("\nTrying to change the paths of XREFs..."));
  19. fXrefRePath(采用T("c:\\test.dwg"),采用T("c:\\newlocation\")); //feel free to change the path as required
  20. }
  21. ///////////////////////////////////////////////////////////////////////////////////////////////
  22. //Description: fGetXYPlane
  23. //Parameters:
  24. //a)pDwgPath: Drawing name to repath the XREFs
  25. //b)pNewLocation: The new folder where the XREF are available
  26. //c)nDepth: Do not use. It specifies the nest level. It is optional and is used while running recursively
  27. ///////////////////////////////////////////////////////////////////////////////////////////////
  28. void fXrefRePath(const TCHAR* pDwgPath,const TCHAR* pNewLocation,long nDepth)
  29. {
  30. //preparing the prefix
  31. TCHAR mPrefix[255];
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2024-12-29 05:41 , Processed in 0.143713 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表