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!

How to specify the Name Variable in Search

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
235
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
 
Replies continue below

Recommended for you

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