M76 Posted October 4, 2011 Share Posted October 4, 2011 Is there really no other way, to check if two points are the same than individually comparing each element of their coordinates? Quote Link to comment Share on other sites More sharing options...
SEANT Posted October 4, 2011 Share Posted October 4, 2011 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. Quote Link to comment Share on other sites More sharing options...
M76 Posted October 4, 2011 Author Share Posted October 4, 2011 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. Quote Link to comment Share on other sites More sharing options...
SEANT Posted October 4, 2011 Share Posted October 4, 2011 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. Quote Link to comment Share on other sites More sharing options...
M76 Posted October 6, 2011 Author Share Posted October 6, 2011 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? Quote Link to comment Share on other sites More sharing options...
Joro-- Posted October 10, 2011 Share Posted October 10, 2011 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. Quote Link to comment Share on other sites More sharing options...
Joro-- Posted October 10, 2011 Share Posted October 10, 2011 ...using VBA... Quote Link to comment Share on other sites More sharing options...
fixo Posted October 12, 2011 Share Posted October 12, 2011 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.