社区
Inventor 产品技术应用讨论区
欢迎访问欧特克Inventor论坛!分享知识,发帖提问,浏览Inventor热帖
取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Inventor iLogic - 工程图批量替换文本

2 条回复2
回复
1 条消息(共 3 条)
Anonymous
572 次查看, 2 条回复

Inventor iLogic - 工程图批量替换文本

oDoc = ThisDoc.Document

Dim oT As String
Dim nT As String
Dim oSl As New ArrayList
	oSl.Add("通用注释")'通用注释
	oSl.Add("孔标注")'孔标注
	oSl.Add("倒角标注")'倒角标注
	oSl.Add("指引导线文本")'指引导线文本
	oSl.Add("通用尺寸")'通用尺寸
	oSl.Add("视图草图里文本")'视图草图里文本
	oSl.Add("自由草图里文本")'自由草图里文本
	oSl.Add("所有项目")'所有项目

'输入
oT = InputBox("请输入需要替换的文本:", "iLogic - 批量替换文本 - Frank Li", "XXX")
'输入为空,则退出
If oT ="" Then Exit Sub

nT = InputBox("请输入新文本,用来替换:  "& oT & " ", "iLogic - 批量替换文本 - Frank Li", "****")

'选择某个项目或全部
S = InputListBox("请选择需要进行文本替换的项目!", oSl, "所有项目", Title := "选择替换项目", ListName := "项目列表")


For Each oSheet As Sheet In oDoc.Sheets
	Select Case S
	Case "通用注释"
    	For Each oGn As GeneralNote In oSheet.DrawingNotes.GeneralNotes
		oGn.FormattedText = oGn.FormattedText.Replace(oT,nT)   
    	Next    
    Case "孔标注"
    	For Each oHn As HoleThreadNote In oSheet.DrawingNotes.HoleThreadNotes
		oHn.FormattedHoleThreadNote = oHn.FormattedHoleThreadNote.Replace(oT,nT)   
    	Next
	Case "倒角标注"
		For Each oCn As ChamferNote In oSheet.DrawingNotes.ChamferNotes
		oCn.FormattedChamferNote = oCn.FormattedChamferNote.Replace(oT,nT)   
    	Next
	Case "指引导线文本"
    	For Each oLn As LeaderNote In  oSheet.DrawingNotes.LeaderNotes
		oLn.FormattedText = oLn.FormattedText.Replace(oT,nT)  
    	Next
	Case "通用尺寸"
    	For Each oDd As DrawingDimension In oSheet.DrawingDimensions
		oDd.Text.FormattedText = oDd.Text.FormattedText.Replace(oT,nT)
    	Next
	Case "视图草图里文本"
    	For Each oDv As DrawingView In oSheet.DrawingViews
			For Each oDs As DrawingSketch In oDv.Sketches
			oDs.Edit
				For Each oDst As TextBox In oDs.TextBoxes
				oDst.FormattedText = oDst.FormattedText.Replace(oT, nT)
				Next
			oDs.ExitEdit
			Next
		Next
	Case "自由草图里文本"
    	For Each oS As DrawingSketch In oSheet.Sketches
		oS.Edit
			For Each oSt As TextBox In oS.TextBoxes
			oSt.FormattedText = oSt.FormattedText.Replace(oT, nT)
			Next
		oS.ExitEdit
		Next
		
	Case "所有项目"
    	For Each oGn As GeneralNote In oSheet.DrawingNotes.GeneralNotes
		oGn.FormattedText = oGn.FormattedText.Replace(oT,nT)   
    	Next    
    	For Each oHn As HoleThreadNote In oSheet.DrawingNotes.HoleThreadNotes
		oHn.FormattedHoleThreadNote = oHn.FormattedHoleThreadNote.Replace(oT,nT)   
    	Next
		For Each oCn As ChamferNote In oSheet.DrawingNotes.ChamferNotes
		oCn.FormattedChamferNote = oCn.FormattedChamferNote.Replace(oT,nT)   
    	Next
    	For Each oLn As LeaderNote In  oSheet.DrawingNotes.LeaderNotes
		oLn.FormattedText = oLn.FormattedText.Replace(oT,nT)  
    	Next
    	For Each oDd As DrawingDimension In oSheet.DrawingDimensions
		oDd.Text.FormattedText = oDd.Text.FormattedText.Replace(oT,nT)
    	Next
    	For Each oDv As DrawingView In oSheet.DrawingViews
			For Each oDs As DrawingSketch In oDv.Sketches
			oDs.Edit
				For Each oDst As TextBox In oDs.TextBoxes
				oDst.FormattedText = oDst.FormattedText.Replace(oT, nT)
				Next
			oDs.ExitEdit
			Next
		Next
    	For Each oS As DrawingSketch In oSheet.Sketches
		oS.Edit
			For Each oSt As TextBox In oS.TextBoxes
			oSt.FormattedText = oSt.FormattedText.Replace(oT, nT)
			Next
		oS.ExitEdit
		Next		
End Select

Next
标记 (2)
标签 (3)
2 条回复2
2 条消息(共 3 条)
Henry.Huang
回复: Anonymous

感谢分享。 




Henry Huang
Product Support Specialist, Frontline Technical Support
Customer Service and Support, GCSO
Autodesk, Inc.

3 条消息(共 3 条)
Yong.Jing
回复: Anonymous

您是在分享程序还是有什么疑问? 为了更好的大家帮助大家, 能否上源程序文本,而不是截屏呢。 



Yong Jing
Product Support Senior Specialist
Technical Support, CSS, GPS

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!

找不到想要的内容?向社区提问或分享您的知识。

到论坛发帖  

”