point array class property - how?

point array class property - how?

Anonymous
Not applicable
263 Views
3 Replies
Message 1 of 4

point array class property - how?

Anonymous
Not applicable
have scoured google for an hour and cant' find a mention of this:

how to store a point value as a property of a class

with this in the declarations section of a class module
Private mWeldDefPt(2) As Double

I tried this: (bombed on class creation)

Property Let DefPt(val() As Double)
mWeldDefPt(0) = val(0)
mWeldDefPt(1) = val(1)
mWeldDefPt(2) = val(2)
End Property
Property Get DefPt() As Double
DefPt(0) = mWeldDefPt(0)
DefPt(1) = mWeldDefPt(1)
DefPt(2) = mWeldDefPt(2)
End Property

then I tried:
Property Let DefPt(val As Variant)
mWeldDefPt(0) = val(0)
mWeldDefPt(1) = val(1)
mWeldDefPt(2) = val(2)
End Property
Property Get DefPt() As Variant
DefPt(0) = mWeldDefPt(0)
DefPt(1) = mWeldDefPt(1)
DefPt(2) = mWeldDefPt(2)
End Property

that allowed the class to be created several times during further debug
testing
but I wasn't accessing the property

as soon as I tried to access the property thus:
in class initialize:
mWeldDefPt(0) = 0
mWeldDefPt(1) = 0
mWeldDefPt(2) = 0

in the calling sub that creates the class:
Debug.Print "DefPt is: " & ws.DefPt(0) & ", " & ws.DefPt(1) & ", " &
ws.DefPt(2)

I got:
got out of stack space error:

then I tried:
Private mWeldDefPt As Variant

and that gives type mismatch on class creation

what's the trick to get a point value as a class property?
0 Likes
264 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Mark Propst wrote:

> what's the trick to get a point value as a class property?

The trick is that even though AutoCAD expects you to pass an array of
doubles for a point, you will always *receive* a variant containing an
array of variants, not doubles. If you plan on stuffing your double
array, you need to convert each element to a double.

The easy way out is to declare your member variable as a Variant.

--
"It's more important that you know how to find the answer than to have
the answer." - Me
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks again, Frank!

"Frank Oquendo" wrote in message
news:46D63F7A371CA9DDF1A361BFDDD129A4@in.WebX.maYIadrTaRb...
> Mark Propst wrote:
>
> > what's the trick to get a point value as a class property?
>
> The trick is that even though AutoCAD expects you to pass an array of
> doubles for a point, you will always *receive* a variant containing an
> array of variants, not doubles. If you plan on stuffing your double
> array, you need to convert each element to a double.
>
> The easy way out is to declare your member variable as a Variant.
>
> --
> "It's more important that you know how to find the answer than to have
> the answer." - Me
>
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
and another curiousity
why did that cause a stack overflow instead of a type mismatch?
I understand very little about the stack - other than it's an area of memory
devoted to acad's use...

"Frank Oquendo" wrote in message
news:46D63F7A371CA9DDF1A361BFDDD129A4@in.WebX.maYIadrTaRb...
> Mark Propst wrote:
>
> > what's the trick to get a point value as a class property?
>
0 Likes