Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify Text in Title Blocks on CatDrawing open

Status
Not open for further replies.

Edcarlos

Industrial
Nov 17, 2012
6
BR
thread560-358816

Hi

the code works great,
another scenario is when there are two fields with the same text, the two are replaced, and in my case I wanted only one to be changed.
is it possible to saddle the text with mause, and only change what is selected? in my case I can blow the block.

Sub CATMain()

Dim oDrawing As DrawingDocument
Set oDrawing = CATIA.ActiveDocument

Dim oSheets As DrawingSheets
Set oSheets = oDrawing.Sheets

Dim oSheet As DrawingSheet
Set oSheet = oSheets.Item("Sheet.1")

Dim oView As DrawingView
Set oView = oSheet.Views.Item(2)
oView.Activate

Dim o2DComponents As DrawingComponents
Set o2DComponents = oView.Components

Dim o2DComponent As DrawingComponent
Set o2DComponent = o2DComponents.Item(1)

' Retrieve the modifiable text of the ditto
Dim oText As DrawingText
Set oText = o2DComponent.GetModifiableObject(1)

Count = o2DComponent.GetModifiableObjectsCount

For i = 1 To Count
Set oText = o2DComponent.GetModifiableObject(i)

If oText.Text = "Text 1" Then
oText.Text = "A1"
ElseIf oText.Text = "Text 2" Then
oText.Text = "B1"
ElseIf oText.Text = "Text 3" Then
oText.Text = "C1"
ElseIf oText.Text = "Text 4" Then
oText.Text = "D1"
ElseIf oText.Text = "Text 5" Then
oText.Text = "E1"
End If
Next ''i

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top