vbEmpty s meaning

vbEmpty s meaning

Anonymous
Not applicable
874 Views
10 Replies
Message 1 of 11

vbEmpty s meaning

Anonymous
Not applicable
hi,

this my sub

Sub intPointstest()
Dim explodedObjects As Variant
Dim returnObj1 As AcadObject
Dim returnObj2 As AcadObject

Dim BasePnt As Variant
Dim offsetobj As Variant
ThisDrawing.Utility.GetEntity returnObj1, BasePnt, "Select an object"
ThisDrawing.Utility.GetEntity returnObj2, BasePnt, "Select an object"
Dim intPoints As Variant
intPoints = returnObj1.IntersectWith(returnObj2, acExtendNone)
Debug.Print VarType(intPoints) <> vbEmpty '*
End Sub '

i wonder why * is true when there isnt any Intersecting Point,

how to judge if there an Intersecting Point or not


thanks
0 Likes
875 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
If the two objects do not intersect then .IntersectWith will return a one-dimensional array of doubles with no elements. Its VarType will be (vbArray or vbDouble), its lower bound will be 0, and its upper bound will be -1. Try:

Debug.Print UBound(intPoints) > LBound(intPoints)
0 Likes
Message 3 of 11

Anonymous
Not applicable
"youngman" wrote in message
news:5169543@discussion.autodesk.com...
hi,

Debug.Print VarType(intPoints) <> vbEmpty '*
i wonder why * is true when there isnt any Intersecting Point,
----------------

In addition to fantums reply there's also an IsEmpty function(for future
reference)
Dim vTest As Variant
If IsEmpty(vTest) Then Debug.Print "Empty"

...............
Empty

hth
Mark
0 Likes
Message 4 of 11

Anonymous
Not applicable
Using VarType(intPoint)=vbEmpty in Acad Help's IntersectWith() sample to
decide whether there is intersection or not is an error of the help file
since the very first ACAD VBA. As you have found out, the returned array
will never be vbEmpty, it is either an array of 0 element or an array of 3
elements.

I'd bet this bad sample code in ACD Help will be carried on and on to
following versions of ACAD each year and confuse VBA programmers who try to
use IntersectWith() the first time, so that a simple problem that could be
solved in minutes would take them hours to wonder why (I was one of them).

"youngman" wrote in message
news:5169543@discussion.autodesk.com...
hi,

this my sub

Sub intPointstest()
Dim explodedObjects As Variant
Dim returnObj1 As AcadObject
Dim returnObj2 As AcadObject

Dim BasePnt As Variant
Dim offsetobj As Variant
ThisDrawing.Utility.GetEntity returnObj1, BasePnt, "Select an object"
ThisDrawing.Utility.GetEntity returnObj2, BasePnt, "Select an object"
Dim intPoints As Variant
intPoints = returnObj1.IntersectWith(returnObj2, acExtendNone)
Debug.Print VarType(intPoints) <> vbEmpty '*
End Sub '

i wonder why * is true when there isnt any Intersecting Point,

how to judge if there an Intersecting Point or not


thanks
0 Likes
Message 5 of 11

Anonymous
Not applicable
Have you ever used the Feedback link at the bottom of the code example?

--
R. Robert Bell


"Norman Yuan" wrote in message
news:5170050@discussion.autodesk.com...
Using VarType(intPoint)=vbEmpty in Acad Help's IntersectWith() sample to
decide whether there is intersection or not is an error of the help file
since the very first ACAD VBA. As you have found out, the returned array
will never be vbEmpty, it is either an array of 0 element or an array of 3
elements.

I'd bet this bad sample code in ACD Help will be carried on and on to
following versions of ACAD each year and confuse VBA programmers who try to
use IntersectWith() the first time, so that a simple problem that could be
solved in minutes would take them hours to wonder why (I was one of them).

"youngman" wrote in message
news:5169543@discussion.autodesk.com...
hi,

this my sub

Sub intPointstest()
Dim explodedObjects As Variant
Dim returnObj1 As AcadObject
Dim returnObj2 As AcadObject

Dim BasePnt As Variant
Dim offsetobj As Variant
ThisDrawing.Utility.GetEntity returnObj1, BasePnt, "Select an object"
ThisDrawing.Utility.GetEntity returnObj2, BasePnt, "Select an object"
Dim intPoints As Variant
intPoints = returnObj1.IntersectWith(returnObj2, acExtendNone)
Debug.Print VarType(intPoints) <> vbEmpty '*
End Sub '

i wonder why * is true when there isnt any Intersecting Point,

how to judge if there an Intersecting Point or not


thanks
0 Likes
Message 6 of 11

Anonymous
Not applicable
> Have you ever used the Feedback link at the bottom of the code example?

While this was not directed to me, I'll offer a resonpse: Although not for this particular one, I have used similar Feedback links in several places in both the ActiveX and ObjectARX documentation from AutoCAD 2000 through AutoCAD 2005 and have observed no corrections when existing documentation is carried forward to a next version. My checking in later versions was not exhaustive as I may not have needed to reference the documentation again but in those cases where I checked from simple curiosity corrections were not made. Unfortunately, I have not kept a list of the topics for which I sent feedback.
0 Likes
Message 7 of 11

Anonymous
Not applicable
I ran into it on Acad R14.01 in 1999, and probably sent feedback then (not
sure now, more than 6 years later). The sample code remains unchanged since
until Acad2006 (now sure in Acad2007, just got the copy and not installed
yet). But I bet it is still unchanged.

"R. Robert Bell" wrote in message
news:5170193@discussion.autodesk.com...
Have you ever used the Feedback link at the bottom of the code example?

--
R. Robert Bell


"Norman Yuan" wrote in message
news:5170050@discussion.autodesk.com...
Using VarType(intPoint)=vbEmpty in Acad Help's IntersectWith() sample to
decide whether there is intersection or not is an error of the help file
since the very first ACAD VBA. As you have found out, the returned array
will never be vbEmpty, it is either an array of 0 element or an array of 3
elements.

I'd bet this bad sample code in ACD Help will be carried on and on to
following versions of ACAD each year and confuse VBA programmers who try to
use IntersectWith() the first time, so that a simple problem that could be
solved in minutes would take them hours to wonder why (I was one of them).

"youngman" wrote in message
news:5169543@discussion.autodesk.com...
hi,

this my sub

Sub intPointstest()
Dim explodedObjects As Variant
Dim returnObj1 As AcadObject
Dim returnObj2 As AcadObject

Dim BasePnt As Variant
Dim offsetobj As Variant
ThisDrawing.Utility.GetEntity returnObj1, BasePnt, "Select an object"
ThisDrawing.Utility.GetEntity returnObj2, BasePnt, "Select an object"
Dim intPoints As Variant
intPoints = returnObj1.IntersectWith(returnObj2, acExtendNone)
Debug.Print VarType(intPoints) <> vbEmpty '*
End Sub '

i wonder why * is true when there isnt any Intersecting Point,

how to judge if there an Intersecting Point or not


thanks
0 Likes
Message 8 of 11

Anonymous
Not applicable
It still isn't. I too don't have much hope that the lingering small things
will ever get fixed. The yearly release cycle just sucks.

--
R. Robert Bell


"Norman Yuan" wrote in message
news:5170535@discussion.autodesk.com...
I ran into it on Acad R14.01 in 1999, and probably sent feedback then (not
sure now, more than 6 years later). The sample code remains unchanged since
until Acad2006 (now sure in Acad2007, just got the copy and not installed
yet). But I bet it is still unchanged.
0 Likes
Message 9 of 11

Anonymous
Not applicable
thanks to all of you


"R. Robert Bell" wrote in message
news:5170576@discussion.autodesk.com...
It still isn't. I too don't have much hope that the lingering small things
will ever get fixed. The yearly release cycle just sucks.

--
R. Robert Bell


"Norman Yuan" wrote in message
news:5170535@discussion.autodesk.com...
I ran into it on Acad R14.01 in 1999, and probably sent feedback then (not
sure now, more than 6 years later). The sample code remains unchanged since
until Acad2006 (now sure in Acad2007, just got the copy and not installed
yet). But I bet it is still unchanged.
0 Likes
Message 10 of 11

Anonymous
Not applicable
They generally don't fix things like this, because
the fix itself will break existing code (e.g., if you
expect and test for an empty array of doubles, and
they 'fixed' it to return VT_EMPTY or something else,
then your code breaks).

Not that they have a problem breaking existing
code... Lord knows they've done more than a little
of that without any legitmate reason.

One of the most egregious examples of that was
the change to selection set ordering in 2005, which
fails to preserve the explicit picked order, the way
previous releases did.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Norman Yuan" wrote in message news:5170535@discussion.autodesk.com...
I ran into it on Acad R14.01 in 1999, and probably sent feedback then (not
sure now, more than 6 years later). The sample code remains unchanged since
until Acad2006 (now sure in Acad2007, just got the copy and not installed
yet). But I bet it is still unchanged.

"R. Robert Bell" wrote in message
news:5170193@discussion.autodesk.com...
Have you ever used the Feedback link at the bottom of the code example?

--
R. Robert Bell


"Norman Yuan" wrote in message
news:5170050@discussion.autodesk.com...
Using VarType(intPoint)=vbEmpty in Acad Help's IntersectWith() sample to
decide whether there is intersection or not is an error of the help file
since the very first ACAD VBA. As you have found out, the returned array
will never be vbEmpty, it is either an array of 0 element or an array of 3
elements.

I'd bet this bad sample code in ACD Help will be carried on and on to
following versions of ACAD each year and confuse VBA programmers who try to
use IntersectWith() the first time, so that a simple problem that could be
solved in minutes would take them hours to wonder why (I was one of them).

"youngman" wrote in message
news:5169543@discussion.autodesk.com...
hi,

this my sub

Sub intPointstest()
Dim explodedObjects As Variant
Dim returnObj1 As AcadObject
Dim returnObj2 As AcadObject

Dim BasePnt As Variant
Dim offsetobj As Variant
ThisDrawing.Utility.GetEntity returnObj1, BasePnt, "Select an object"
ThisDrawing.Utility.GetEntity returnObj2, BasePnt, "Select an object"
Dim intPoints As Variant
intPoints = returnObj1.IntersectWith(returnObj2, acExtendNone)
Debug.Print VarType(intPoints) <> vbEmpty '*
End Sub '

i wonder why * is true when there isnt any Intersecting Point,

how to judge if there an Intersecting Point or not


thanks
0 Likes
Message 11 of 11

Anonymous
Not applicable
It seems to me that the complaint in this case is not so much that the functionality is wrong but that it doesn't match the documentation. Surely somewhere during the course of seven plus years the label could be changed to match what's in the tin without breaking code. If you are going to enlist users as document checkers then shouldn't you take some notice when they tell you the doumentation is wrong?
0 Likes