VBA CAD布局复制

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

DimCADappAsObjectPublicFunctionIVersion()AsString'È¡°æ±¾ºÅOnErrorResumeNextSetCADapp=GetObject(,AutoCAD.Application)IfErr.Number0ThenSetCADapp=CreateObject(AutoCAD.Application)EndIfCADapp.Visible=TrueIVersion=Left(CADapp.Version,2)EndFunctionPublicFunctionIobjDbx()AsObject'»ñÈ¡½Ó¿Ú°æ±¾Version=IVersionIfCInt(Version)16ThenSetIobjDbx=CADapp.GetInterfaceObject(ObjectDBX.AxDbDocument)ElseSetIobjDbx=CADapp.GetInterfaceObject(ObjectDBX.AxDbDocument.&Version)EndIfEndFunctionPublicFunctionlayoutcopy(DocumentobjAsObject,SourcelayoutNameAsString,TargetlayoutNameAsString)AsObject'¸´ÖƲ¼¾ÖDimmylayoutAsObjectDimobjArray()AsObjectDiment()AsObjectDimlngCountAsLong,iAsLonglngCount=Documentobj.Layouts(SourcelayoutName).Block.CountSetmylayout=CADapp.Application.activeDocument.Layouts.Add(TargetlayoutName)IflngCount0ThenReDimobjArray(0TolngCount-1)Fori=0TolngCount-1SetobjArray(i)=Documentobj.Layouts(SourcelayoutName).Block.Item(i)Nextmylayout.CopyFromDocumentobj.Layouts(SourcelayoutName)Documentobj.Database.CopyObjectsobjArray,mylayout.BlockSetlayoutcopy=mylayoutEndIfEndFunctionSubTest()DimDocumentobjAsObjectSetDocumentobj=IobjDbxDocumentobj.Openc:\xxx.dwtlayoutcopyDocumentobj,xxx.dwtÖв¼¾ÖÃû³Æ,Ö¸¶¨Ð²¼¾ÖÃû³ÆSetDocumentobj=NothingSetCADapp=NothingEndSub

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功