Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CheckInterference with VBA

Status
Not open for further replies.

arno4012

Mechanical
Jul 11, 2007
10
Hi,

I have read the thread 562-135208, but I've still the same probleme than Baat. I'm trying :

Dim set1(1) As Reference
Dim set2(1) As Reference
Set set1(1) = objdoc.CreateReference(objdoc.Occurrences(2), objdoc.Occurrences(2).OccurrenceDocument.Models(1).Body)
Set set2(1) = objdoc.CreateReference(objdoc.Occurrences(3), objdoc.Occurrences(3).OccurrenceDocument.Models(1).Body)
Call objdoc.CheckInterference(1, set1, 2, 1, 1, set2)

And SE replies (in french):
Incompatibilité de type : Tableau ou type défini par l'utilisateur attendu
In English : wrong type, array of objects or user defined type required
And the cursor is on the last set(1)

Can anyone explain me where is my mistake ?
Thank you,
Arno
 
Replies continue below

Recommended for you

Arno,

ths one should work:

dy

======================

Dim set1(1) As Object
Dim set2(1) As Object
Dim oInterf As Object ' optional
Set mAsm = mApp.ActiveDocument
'
Set set1(0) = mAsm.Occurrences(2)
Set set1(1) = mAsm.CreateReference(mAsm.Occurrences(2), _
mAsm.Occurrences(2).OccurrenceDocument.Models(1).Body)
Set set2(0) = mAsm.Occurrences(3)
Set set2(1) = mAsm.CreateReference2(mAsm.Occurrences(3), _
mAsm.Occurrences(3).OccurrenceDocument.Models(1).Body)


Call mAsm.CheckInterference(1, set1, seInterferenceStatusConfirmedInterference, _
1, 1, set2, True, , , , , , , oInterf) ' all after set2 is optional!
MsgBox Err.Description
Err.Clear
 
Thank you very much donyoung, I will try tomorrow.
Good evening,
Arno
 
Hi donyoung,

I've tried your syntax method.
The good news is that there no error message.
But I'm not sure that something is done, because there no new occurence, no message and no evolution, even if there are some interferences in my assmbly.

Moreover, I would know if it's possible to recieved the result of CheckInterference in a boolean variable ? (if there are some interference : True, if not : False)

Thank you very much,
Arno
 
Arno,

the methoed will check whether there is any interference
between the element(s) in Set1 and Set2 no more no less.
You may, hoever, choose a different option what to check
and how. Also possible to include more elements in
either sets.
After the method is executed and the object oInterf is
empty then there are no interferences between set1 and set2

dy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor