




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精品文档Sub AdjustPartsPropsLocation()'MACROMENU AdLoc'MACROKEY CTRL+P'MACRODESCRIPTION Auto adjust Location of Part's display properties'SelectObject -52.32,-20.83, FALSE'SelectObject-14.22, -1.02, FALSEConst MB_OKCANCEL = 1' Define buttons.Const vbOKOnly = 0Const IDCANCEL =
2、 2Const MaxNumOfParts = 500Dim DgDef, Msg, Response, Title ' Declare variables.Title =" 注意:kurbylee"Msg = "1.该宏将自动调整原理图页面中元件的Part Refrence 和Value的位置;"& (Chr(13) & _"2.该宏将自动创建 C:test.txt 文件,如果该文件存在,其内容将被覆盖;” & (Chr(13) & _"3.该程序正常情况下首先弹出一个对话框begin,如果在
3、该begin出现之前oread弹出"& (Chr(13) &" Select filter请手动选择:parts (只选择parts,其他一概不要选);"& (Chr(13) & _"4.如果在 begin 对话框之后还出现 select filter,请手动选择 display properties;" & (Chr(13) &"5.该宏在oread capture 10.3 及winxp下测试通过,其他情况未测试"& (Chr(13) & _"6.
4、请确保您使用的电阻电容形状和大小类似Capture库中的相应元件,并注意它们在库中的"& (Chr(13) & _"原始图形是垂直放置的,即印脚在上下位置,而不是左右位置” & (Chr(13) & _"7.本程序假设 R*,r*,L*,l*,C*,c* 与 Caputre 的 Discrete.olb 中的 R,C 外形大致相似;"& (Chr(13) &"其他字母开头的统一当作矩形行状的元件处理,其Part Refrence 和Value置上。"& (Chr(13)&
5、 _"8.为防止出错死循环,本宏中设置了页面最大元件数为500;" & (Chr(13) & _"9.请在 Option->preference->select下设置选择方式为 interselect, 并确定;"& (Chr(13) & _"10.请在 Option->schematic Page Properties->page size下选择 inch ," & (Chr(13) & _"并确保您的原理图尺寸小于43X33" &
6、(Chr(13) & _"11.程序运行期间,请不要动键盘和鼠标,以免程序出错产生数据破坏;"& (Chr(13) & _"12.请确保您在运行该程序之前做好了备份,如有数据丢失或损坏,概不负责"& (Chr(13)Msg = Msg & (Chr(13) & "您确认要继续吗 ?"DgDef = MB_OKCANCEL' Describe dialog.Response = MsgBox(Msg, DgDef, Title)' Get user response.If
7、Response = IDCANCEL ThenMsgBox "退出程序!Exit SubElse' action.End IfDim ExitLoop As IntegerExitLoop = 0Dim partName As StringDim TxtFileName As StringTxtFileName = "c:test.txt"Dim PartLocX As StringDim PartLocY As StringDim ReturnValue As Integer'sometimes the following is ok,some
8、times is unvalid :(SendKeys "%vfaTAB 2 enter", True'popup a select filter dialo and set parts filterMsg ="如果您刚才看到了 select filter 对话框,而您没有只选择 Parts," & (Chr(13) & _"建议您立刻退岀,否则可以继续!”Response = MsgBox(Msg, DgDef,"您要继续吗? ")' Get user response.If Respons
9、e = IDCANCEL ThenMsgBox ("退出程序!")Exit SubElse' action.End If'SendKeys "%vfaUP 12 enter",True'popup a select filter dialo and set parts filterunselectallGoToAbsolute 0#, 0#SelectBlock 0#, 0#, 43#, 33#, FalseRemoveDisplayProperty "Part Reference"RemoveDisplayP
10、roperty "Value"'Open Property Editor and then Select,copy to clipboard and close Property Editor ShowSpreadsheetSendKeys "LEFT+DOWNAc%-DOWN 5ENTER"'creat a empty text: c:test.txtOpen TxtFileName For Output As #1CloseRun NotepadPaste from clipboard aReturnValue = Shell(&qu
11、ot;notepad.EXE c:test.txt", 1)AppActivate "test.txt -记事本"SendKeys "AaAv%fs%fx", Truend save on the disk c:.ExitLoop = 0Dim FileData As StringDim PartRotation As StringDim PartRef As StringDim displayPro As StringDim K As IntegerdisplayPro =""Dim aa As StringDim nTa
12、bNameBegin As IntegerDim nTabNum As IntegerDim nPreTab As IntegerDim nEndTab As IntegernTabNum = 0Dim TmpCnt As Integer'popup a select filter dialog and set display property filterSelectAll unselectallMsg = "1:请使用鼠标点击确定按钮,不要直接使"& (Chr(13) & _" 用ENTER因为此时焦点可能不再该窗口上"&am
13、p; (Chr(13) & (Chr(13) & _"2:确定后开始调整 Part ref 和value的位置,这"& (Chr(13) & _"可能要花费较长的时间,请耐心等候"Response = MsgBox(Msg, 48," 警告")'MsgBox("开始调整Part ref 和value的位置,这可能要花费较长的时间,请耐心等候")'SendKeys "%vfaTAB 8",TrueSendKeys "%vfaUP 8 ENT
14、ER", True unselectallOpen TxtFileName For Input As #1 'Get File header informationIf (Not EOF(1) ThenLine Input #1, FileData FileData = LCase(FileData)'MsgBox(FileData)If (Not (Len(FileData) > 0) ThenMsgBox ("1:文件格式错误或文件不存在")Exit SubEnd IfnTabNameBegin = lnStr(1, FileData,
15、Chr$(9) & "name"& Chr$(9), 1)If nTabNameBegin = 0 ThenMsgBox ("2:文件格式错误或文件不存在")Exit SubEnd IfFileData = Left(FileData, nTabNameBegin - 1)TmpCnt = InStr(1, FileData, Chr$(9), 1)Do While 仃 mpCnt > 0 And TmpCnt < Len(FileData)nTabNum = nTabNum + 1TmpCnt = InStr(TmpCnt
16、+ 1, FileData, Chr$(9), 1)LoopEnd IfDo While Not EOF(1)TmpCnt = 1K = nTabNum + 1Line Input #1, FileDataDo While (K)nPreTab = InStr(TmpCnt, FileData, Chr$(9), 1)TmpCnt = nPreTab + 1'MsgBox(Str$(NTabNum)&":" & Str$(nPreTab)K = K - 1LoopnEndTab = InStr(TmpCnt, FileData, Chr$(9), 1
17、)partName = Mid(FileData, nPreTab + 1, Abs(nEndTab - nPreTab - 1)'MsgBox(Str$(nPreTab)& Str$(nEndTab) & ":" & partName )Findparts partName, FalseGetProperty "Rotation", PartRotationGetProperty "Part Reference", PartRef'The following for ResistorIf (L
18、eft$(PartRef, 1) = "R") Or (Left$(PartRef, 1) = "r") Or (Left$(PartRef, 1) = "L")Or (Left$(PartRef, 1) = "l") ThenDisplayProperty "Value", "Arial", 9, False, False, 48, 0SelectBlock 0#, 0#, 0.1,0.1, False'GetProperty "Rotation"
19、; , PartRotationIf (Left$(PartRotation, 3) = "0" Or Left$(PartRotation, 3) = "180") ThenDrag 0.12, 0.3, FalseElseDrag 0.3, 0#, FalseEnd IfSetfont "Arial", 1, False, FalseFindparts partName, FalseDisplayproperty "Part Reference", "Arial", 9, False, Fa
20、lse, 48, 0SelectBlock 0#, 0#, 0.1,0.1, False'GetProperty "Rotation" , PartRotationIf (Left$(PartRotation, 3) = "0" Or Left$(PartRotation, 3) = "180") ThenDrag 0.12, -0.1, FalseElseDrag -0.1,0#, FalseEnd IfSetfont "Arial", 1, False, False'The following
21、for CapacityElseIf (Left$(PartRef, 1) = "C") Or (Left$(PartRef, 1) = "c") ThenDisplayProperty "Value", "Arial", 9, False, False, 48, 0SelectBlock 0#, 0#, 0.1,0.1, False'GetProperty "Rotation" , PartRotationIf (Left$(PartRotation, 3) = "0&quo
22、t; Or Left$(PartRotation, 3) = "180") ThenDrag 0.12, 0.1, FalseElseDrag 0.12, 0#, FalseEnd IfSetfont "Arial", 1, False, FalseFindparts partName, FalseDisplayProperty "Part Reference", "Arial", 9, False, False, 48, 0SelectBlock 0#, 0#, 0.1,0.1, False'GetProperty "Rotation" , PartRotationIf (Left$(PartRotation, 3) = "0" Or Left$(PartRotation, 3) = "180") ThenDrag 0.12, -0.1, FalseElseDrag -0.2, 0#, FalseEnd IfSetfont "Arial", 1, False, False'The following for other
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- DB41∕T 1840-2019 场(厂)内专用机动车辆应急救援规范
- 前期知识会议组织要求会议服务礼仪课件
- (6.1)抒情内容-抒什么?-朱松苗
- (0.7)文学理论的学科定位-朱松苗
- 电梯紧急救援课件
- Starter Unit 1 Hello!Section A 2a-2b 教学设计 2024-2025学年人教版英语七年级上册
- Unit6 lesson 1教学设计 - 2024-2025学年冀教版七年级英语上册
- 期中模拟题(二)-2022-2023学年高一化学下学期期中期末考点大串讲(沪科版2020必修第二册) (解析版)
- 2025建筑项目内部承包合同范本
- 2025合同解除协议书范本
- 2025年安阳职业技术学院单招职业技能测试题库必考题
- 2025年入团考试练习试题(100题)附答案
- 南美白对虾养殖课件
- 房建工程样板策划及实施方案
- 二年级数学生活中的推理-完整版PPT
- 《环境生态学导论(第二版)》课件第二章 生物与环境
- 车床、钻床安全风险辨识清单
- (完整版)保温工艺课件
- BLM(含样例)(培训调研)课件(PPT 121页)
- T∕CVIA 73-2019 视觉疲劳测试与评价方法 第2部分:量表评价方法
- 小学美术课件-第12课太空旅行-冀美版(16张PPT)ppt课件
评论
0/150
提交评论