Message 1 of 11

Not applicable
03-22-2017
01:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks,
I have some code with an array whose values changes with the movement of a plane.
SyntaxEditor Code Snippet
If Start= True Then InventorVb.DocumentUpdate(True) While Afstand_tot_center_Ruit <5 Dim MyArrayList(3) As Double 'Hier maak je een lijstje aan met de waarden van je parameter. MyArrayList(0) = X_Afstand_1_Ruit MyArrayList(1) = X_Afstand_2_Ruit MyArrayList(2) = X_Afstand_3_Ruit MyArrayList(3) = X_Afstand_4_Ruit Array.Sort(MyArrayList) 'Hier sorteer je het lijstje dat je hebt aangemaakt van klein naar groot. For Each Str As Double In MyArrayList Next MessageBox.Show(MyArrayList(1), "Co�rdinaat links") 'Hier wordt het linker X-co�rdinaat getoont in een venstertje. MessageBox.Show(MyArrayList(2), "Co�rdinaat rechts") 'Hier wordt het rechter X-co�rdinaat getoont in een venstertje. If MyArrayList(1)<0 Then 'Hier zorg je ervoor dat wanneer de waard op plaats MyArrayList(1) negatief is dus kleiner dan 0, hij positief wordt door te vermenigvuldigen met -1. B1=MyArrayList(1) *-1 Else If MyArrayList(1) >=0 Then B1=MyArrayList(1)*1 End If If MyArrayList(2)<0 Then 'Hier zorg je ervoor dat wanneer de waard op plaats MyArrayList(2) negatief is dus kleiner dan 0, hij positief wordt door te vermenigvuldigen met -1. H1=MyArrayList(2) *-1 Else If MyArrayList(2) >= 0 Then H1=MyArrayList(2)*1 End If 'Bereken van de hoek " formule Sin(alpha)= X/(straal+laagdikte). A1=((Binnen_diameter_Ruit/2)+Laagdikte_Ruit) I1=B1/A1 'Hier deel je de X-waarde door de de straal + laagdikte. J1=Asin(I1) 'Hier neem je de Boogsinus van de X-waarde gedeeld door de straal + laagdikte. K1=J1*180 L1=K1/3.1415 'De uitkomst wordt maal 180 en gedeeld door Pi om van radialen naar graden te gaan. M1=H1/A1 N1=Asin(M1) O1=N1*180 P1=O1/3.1415 Q1=P1+L1 MessageBox.Show(Q1, "hoek") 'De hoeken van de 2 X-waardes wordt samengeteld Afstand_tot_center_Ruit= Afstand_tot_center_Ruit+0.5 End While End If
Afstand_tot_center_Ruit is the parameter of the plane that moves.
now when it moves 1mm the values in my array have to change with the movement of the plane but i can't get it work.
I tried a while loop so when the Afstand_tot_center_Ruit is smaller then 5mm it would run the code and each time it has looped trought it. It would add 0.5 mm to the Afstand_tot_center_Ruit and then run the code again. But my problem here is that the values of my array do'nt change they stay the same until Afstand_tot_center_Ruit is equal to 5mm.
Can someone help me ?
thanks in advance
Solved! Go to Solution.