Jump to content

Recommended Posts

Posted

Is there really no other way, to check if two points are the same than individually comparing each element of their coordinates?

Posted

Essentially that is correct. Of course, binary math manipulation produces minor discrepancies that need to be addressed – i.e., the comparison requires some tolerance.

 

 

 

A good way to approach this would be to calculate the distance between the points, and compare that to your acceptable tolerance.

Posted

Yeah, that's the solution I went for. Still I think they could've included a function for it, like there is one in autolisp.

Posted

That’s true. A lot of useful functionality is unavailable to VBA. And, considering VBA’s deprecation, there will be no effort on Autodesk’s part to fix that situation.

 

 

 

You may be happy to know that VB.NET does include all of that missing functionality.

 

 

 

In a way, though, using VBA for years was beneficial in that it compelled me to a more in depth exploration of coding techniques/algorithms than I may have pursued if everything was pre-packaged.

 

 

 

Even with everything that is exposed via the ObjectARX api. there will always be something missing that a programmer has to develop on their own.

Posted

Well, when productivity is an issue I'm always looking for the fastest solution, not necessarily the best.

 

I don't know if I can use VB.NET with autocad 2007, but if its possible, how?

Posted

Well, I think you can still use the .ObjectID property of the AcadPoint object to compare if two points are the same. Same .ObjectID means same point.

Posted

If I've understand you right so next code should work for you

 
Option Explicit

Function IsPointsEqual(p1() As Double, p2() As Double, fuzz As Double) As Boolean
If Abs(p1(0) - p2(0)) <= fuzz And _
Abs(p1(1) - p2(1)) <= fuzz And _
Abs(p1(2) - p2(2)) <= fuzz Then
IsPointsEqual = True
Else
IsPointsEqual = False
End If
End Function
Sub test()
Dim p1(2) As Double
Dim p2(2) As Double
p1(0) = 1.22: p1(1) = 1.223: p1(2) = 0.00003
p2(0) = 1.22: p2(1) = 1.223: p2(2) = 0.00004
MsgBox IsPointsEqual(p1, p2, 0.00001)
''for AcadPoint objects use its coordinates property as arguments
End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...