How to access the Start and end point of an array ?

How to access the Start and end point of an array ?

aiden_biondi
Participant Participant
522 Views
1 Reply
Message 1 of 2

How to access the Start and end point of an array ?

aiden_biondi
Participant
Participant

Hi, 

 

I am trying to create points using the start point and end point of an existing line using VBA. The line is stored in an array called 'entityArray'

 

I initially tried to access this using the object qualifier: 

P1(0) = entityArray.entityArray(0).StartPoint.StartPoint(0)
P1(1) = entityArray.entityArray(0).StartPoint.StartPoint(1)
P1(2) = entityArray.entityArray(0).StartPoint.StartPoint(2)

 

this returns an invalid object qualifier error.

 

My section of code: 

 

Private Sub Create3DFace(ss As AcadSelectionSet)

Dim entityArray As Variant
entityArray = CreateEntityArray(ss)


Dim P1(0 To 2) As Double
Dim P2(0 To 2) As Double
Dim P3(0 To 2) As Double
Dim P4(0 To 2) As Double

 

' Define the four points of the face (X, Y, Z)
P1(0) = entityArray.entityArray(0).StartPoint.StartPoint(0)
P1(1) = entityArray.entityArray(0).StartPoint.StartPoint(1)
P1(2) = entityArray.entityArray(0).StartPoint.StartPoint(2)

aiden_biondi_1-1715152671378.png

 

0 Likes
Accepted solutions (1)
523 Views
1 Reply
Reply (1)
Message 2 of 2

norman.yuan
Mentor
Mentor
Accepted solution

these line of code:

 

P1(0) = entityArray.entityArray(0).StartPoint.StartPoint(0)
P1(1) = entityArray.entityArray(0).StartPoint.StartPoint(1)
P1(2) = entityArray.entityArray(0).StartPoint.StartPoint(2)

 

Should be:

 

P1(0) = entityArray(0).StartPoint(0)
P1(1) = entityArray(0).StartPoint(1)
P1(2) = entityArray(0).StartPoint(2)

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes