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!

Error on VBS 1

Status
Not open for further replies.

lapek

Aerospace
Aug 26, 2013
37
MX
hello guys

I have this code, and when running in in CATIA it gave me an error, hope you can help me


Dim oFoundEdges
Set oFoundEdges = New Collection '(the component active x can not create the object "collection")

For j = 1 To osel.Count
sEdgeName = osel.Item(j).Value.name

Dim aEdgeName
aEdgeName = Split(sEdgeName, "face")
sEdgeName = "face" & aEdgeName(UBound(aEdgeName))
If sEdgeName = "*" & sFaceName1 & "*" & sFaceName2 & "*" Then

Dim Edge
Set Edge = osel.Item(j).Value
oFoundEdges.Add Edge
iFoundEdges = iFoundEdges + 1
End If
Next
osel.Clear

If Not iFoundEdges = 0 Then
For j = 1 To oFoundEdges.Count
osel.Add oFoundEdges.Item(j)
Next
data_file.WriteLine "Numero de aristas"
data_file.WriteLine (iFoundEdges)
data_file.WriteLine "--------------------------------------"
'Else
'MsgBox "La figura no tiene aristas"
End If

I don't know what to do,


hope you can help me

thanks
 
Replies continue below

Recommended for you

Dim oFoundEdges as New Collection

Eric N.
indocti discant et ament meminisse periti
 
hi, itsmyjob

thank you so much for your answer

I tried that already, but on VBS does not accept any as ...., so I had to erase it,

at this point I don't know what to do.

hope you can guide me trough

thanks
 
dont know if you can use collection in VBS... works on VBA

Eric N.
indocti discant et ament meminisse periti
 
thak you for your answer I found that collection can not be used

I use CreateObject("Scripting.Dictionary") and it works perfectly

thank you for your help
 
can you elaborate ?

Eric N.
indocti discant et ament meminisse periti
 
I don't understand the question

if I can elaborate de code? or de collection?
 
can you share your solution?

Eric N.
indocti discant et ament meminisse periti
 
oooo yes sure here is the code

Dim oFoundEdges
Set oFoundEdges = CreateObject("Scripting.Dictionary")

For j = 1 To osel.Count
sEdgeName = osel.Item(j).Value.name

Dim aEdgeName
aEdgeName = Split(sEdgeName, "face")
sEdgeName = "face" & aEdgeName(UBound(aEdgeName))
If InStr(sEdgeName, sFaceName1) and InStr(sEdgeName, sFaceName2) Then

Dim Edge
Set Edge = osel.Item(j).Value
oFoundEdges.Add j, Edge
iFoundEdges = iFoundEdges + 1
End If
Next
osel.Clear

If Not iFoundEdges = 0 Then
For j = 1 To oFoundEdges.Count
osel.Add oFoundEdges.Item(j)
Next
data_file.WriteLine "Numero de aristas"
data_file.WriteLine (iFoundEdges)
data_file.WriteLine "--------------------------------------"
'Else
'MsgBox "La figura no tiene aristas"
End If

I hope it can help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top