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!

InserVariable is not recognised

catia_user

Computer
Jan 20, 2025
3
Hi all
In this code i get error that InserVariable is not recognised, has anyone used "InserVariable" and did the code work ? in Catiascript ?

For i = 1 To annotationSet.Annotations.Count
Set note = annotationSet.Annotations.Item(i)
noteName = note.Name

If InStr(noteName, "notes1") > 0 Then
MsgBox "note " & noteName
note.InsertVariable 26, 0, "test\test\notes1" ' Link note to parameter "parameter1"
Endif
....
 
Replies continue below

Recommended for you

The documentation for InsertVariable:

Sub InsertVariable(longiFirst,
longinbCharacter,
CATBaseDispatchibase)
Sets a Parameter in a string of the drawing text.Parameters:iFirstThe first character from which the parameter is insertedinbCharacterThe number of characters the parameter will replaceiParameterThe parameter to be insertedExample:This example sets a parameter right at the end of MyText drawing text. Dim DrwDocument As DrawingDocument

Set DrwDocument = CATIA.ActiveDocument

Dim iParameter As Parameter
Set iParameter = DrwDocument.Parameters.Item("Drawing\Sheet.1\ViewMakeUp.1\Scale")

MyText.InsertVariable 0, 0, iParameter

It appears to me one needs to declare the last part as a "param" . I don't know what the last part
"test\test\notes1" ' Link note to parameter "parameter1"
means; there is an unmatched "'" (single quote) in the middle of it and two strings that don't get concatenated.
 
'
' This is all way above my pay grade, but an unmatched single quote usually introduces
' some comment text, even if it occurs after some earlier executable code in the line.
'
 

Part and Inventory Search

Sponsor