Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

How to specify the Name Variable in Search

Status
Not open for further replies.

jzecha

Aerospace
Joined
Jan 20, 2016
Messages
236
Location
US
I would like to know how to specify the "Name=" variable in the search command.

This is the Code I got from recording my actions and typed in "Partbodyname"

I would like to change the "Partbodyname" to "myBodies.Item(i).Name" when I put this in another code, but I am unable to figure out how to get this to work.
Code:
Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = partDocument1.Selection

selection1.Search "(Name=Partbodyname & CATPrtSearch.BodyFeature),all"

End Sub
 
first, make a string:
dim SearchString as String
SearchString="combine text_" & myBodies.Item(i).Name & "with variable names"
selection1.Search SearchString​
i.e the ampersand is used to concatinate strings, and "" are used to delimit your texts


regards,
LWolf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top