Alan Lowbands
Aerospace
- May 17, 2017
- 274
Hi All,
I'm trying to fill some items on drawings using macro's with pop up boxes.
I've got most of it to work but it's in sheet background.
When I try to get it to alter some text on the working views I get an error 'Set DrwText = DrwTexts.GetItem("Text.222") 'TEXT NUMBER'
I am a bit stumped on how to work on the 'working views'
any help (as always) would be appreciated
Thanks
code below.
Sub CATMain()
CATIA.ActiveDocument.Selection.clear
Set drawingDocument1 = CATIA.ActiveDocument
Set selection1 = drawingDocument1.Selection
Dim DrwDocument As Document
Dim drwsheets As DrawingSheets
Dim drwsheet As DrawingSheet
Dim drwviews As DrawingViews
Dim drwview As DrawingView
Dim DrwTexts As DrawingTexts
Dim DrwText as DrawingText
Set DrwDocument = CATIA.ActiveDocument
Set drwsheets = DrwDocument.Sheets
set drwsheet = drwsheets.item(1)
set drwviews = drwsheets.item(1).views
set drwview = drwviews.item(2)
Set DrwTexts = drwview.Texts
Dim oPART
oPART=InputBox ( "Enter Part number" ) 'pop up box
'oPART="XX/XXX/XX" 'for batch
Set DrwText = DrwTexts.GetItem("Text.221") 'SHEET No (this is on sheet background
DrwText.text = oPART
Set DrwText = DrwTexts.GetItem("Text.222") 'TEXT NUMBER (this is on the working views
DrwText.text = oPART