Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Return the “ItemToCopy” Value

Status
Not open for further replies.

Kesslermaq

Aerospace
Jun 27, 2023
6
Can anyone help me. I’m trying to get the value of the ItemToCopy from a pattern to use it in a If/then statement.

Thanks in advance.
 
Replies continue below

Recommended for you

itemToCopy return AnyObject type so you have to check what it really is to get what you need from it.

What do you want to test with if/then

Eric N.
indocti discant et ament meminisse periti
 
So I have got it to do kind of what I want but I’m getting an error on the line noted below. But it does what I tell it to do. It just doesn’t continue on with the script after that if then statement.

Dim bodies1 As Bodies
Set bodies1 = partl.Bodies

Dim bodyl As Body
Set body1 = bodies1.Item("PartBody")

Dim shapes1 As Shape
Set shapes1 = body1Shapes

dim holel as shape
set holel=shapes1.ltem("1/2-13 KEENSERT")

dim hole2 as shape
set hole2=shapes1.Item("3/8-16 KEENSERT")

Dim oPatt(2) as AnyObject
For i= 1 To 50


‘Errors out on line below
set oPatt(0) = shapes1.Item("RectPattern.” & (i))



if oPatt(0). Item ToCopy.name = hole1.name then
oPatt(0).name = "1/2-13 KSERT PATTERN*
End if
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor