Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Owner2229
in reply to: Anonymous

Hey. This whole idea stinks to me, so I'd like to dig into it a bit, if you don't mind:

1) What are you trying to calculate?

2) What for?

3) How are the points attached to the plane (or whatever the gray object is, sheet metal maybe?)?

4) "X_Afstand_1_Ruit"... are the parameters the values come from, right?

5) How are you triggering / running this rule?

 

This (*1*):

If MyArrayList(1)<0 Then
    B1=MyArrayList(1) *-1
Else If MyArrayList(1) >=0 Then
    B1=MyArrayList(1)*1
End If

Is the same as this (*2*):

 

B1 = Abs(MyArrayList(1))

 

Shorten your code wherever you can, for the sake of readability.

 

Read the last line of my signature. You're from Ieper, Belgium, right?

 

Few tips:

A) If you want to write some comments in the code, write them like this below. The text should fit in your screen without the need to scroll to the side.

 

'Some very long comment which really can't fit to one row, 
'so we have to split it to two
Dim A As Integer = 1 'This is the place for short notes

B) Use declarations, so you can see right away what object type you're working with.

You can also use the first letter of the type as a prefix for the variable ("i" for Integer, "d" for Double, ...)

 

 

Dim iNumber As Integer = -1 'Accepts whole numbers only
Dim dNumber As Double = 0.5 'Accepts decimals
Dim sText As String = "some text" 'Accepts text (and numbers)
Dim oDoc As Document

C) Don't use any special symbols in code and make the names of your variables (and parameters) as short as possible.

 

It also wouldn't hurt to use English names (specially when you're posting the code on international forum and asking for help).

'Wrong:
Afstand_tot_center_Ruit = 0.5
'Right
Dim dToCenter As Double = 0.5

 

Here's the picture you've posted in your last post, so others can relate:

Knipsel

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods