Array question

Array question

Anonymous
Not applicable
589 Views
8 Replies
Message 1 of 9

Array question

Anonymous
Not applicable
I want to create an array of lines, but the finite number of lines I need is
dependent on user input. How should I define my variable so that the number
of objects in the array is comparable to the number of items I need? As of
right now I am using the following:

Dim lneVert (0 to 10000) as AcadLine

This works, but I would like it to be accurate.

BTW I am using A2K...

TIA,

--Adam Thomas
Assistant Systems Coordinator
Chattanooga Boiler and Tank Co.
[email protected]
0 Likes
590 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
So is the user being asked for the number of lines? If not, how are you
determining the number of lines to be created?

"Adam Thomas" wrote in message
news:[email protected]...
> I want to create an array of lines, but the finite number of lines I need
is
> dependent on user input. How should I define my variable so that the
number
> of objects in the array is comparable to the number of items I need? As of
> right now I am using the following:
>
> Dim lneVert (0 to 10000) as AcadLine
>
> This works, but I would like it to be accurate.
>
> BTW I am using A2K...
>
> TIA,
>
> --Adam Thomas
> Assistant Systems Coordinator
> Chattanooga Boiler and Tank Co.
> [email protected]
>
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
The program draws an approximated curve for a cylindrical intersection
layout. Our company standard for accuracy is 2 inches between development
points. The number of development points required to get the desired 2 inch
line is dependant on the circumference of the cylinder and is calculated by
the code. For example a cylinder of circumference = 100 inches would require
50 development lines. Since we draw these in all different sizes, I don't
know a finite number of lines that I will need.

--Adam Thomas
Assistant Systems Coordinator
Chattanooga Boiler and Tank Co.
[email protected]

Frank Oquendo wrote in message
news:[email protected]...
> So is the user being asked for the number of lines? If not, how are you
> determining the number of lines to be created?
0 Likes
Message 4 of 9

Anonymous
Not applicable
You seem to have answered your own question. Here's some pseudo-code:

numLines = Circumference/2
For i = 1 to numLines
Do your thing
Next

"Adam Thomas" wrote in message
news:[email protected]...
> The program draws an approximated curve for a cylindrical intersection
> layout. Our company standard for accuracy is 2 inches between development
> points. The number of development points required to get the desired 2
inch
> line is dependant on the circumference of the cylinder and is calculated
by
> the code. For example a cylinder of circumference = 100 inches would
require
> 50 development lines. Since we draw these in all different sizes, I don't
> know a finite number of lines that I will need.
>
> --Adam Thomas
> Assistant Systems Coordinator
> Chattanooga Boiler and Tank Co.
> [email protected]
>
> Frank Oquendo wrote in message
> news:[email protected]...
> > So is the user being asked for the number of lines? If not, how are you
> > determining the number of lines to be created?
>
>
>
0 Likes
Message 5 of 9

Anonymous
Not applicable
Hi!Adam,

You can achieve it in the following way.

Declare a dynamic array as
Dim lneVert () as AcadLine

Suppose you have number of lines in the variable 'lineCount' then the
following will increase the array size dynamically.
Redim ineVert(1 to lineCount) as acadline

Use the following if you want to increase the array size without erasing the
previous elements in the array.
Redim Preserve ineVert(1 to lineCount) as acadline

Also refer the VB help for more information.
--
bye,

P.Murali
Adam Thomas wrote in message
news:[email protected]...
> I want to create an array of lines, but the finite number of lines I need
is
> dependent on user input. How should I define my variable so that the
number
> of objects in the array is comparable to the number of items I need? As of
> right now I am using the following:
>
> Dim lneVert (0 to 10000) as AcadLine
>
> This works, but I would like it to be accurate.
>
> BTW I am using A2K...
>
> TIA,
>
> --Adam Thomas
> Assistant Systems Coordinator
> Chattanooga Boiler and Tank Co.
> [email protected]
>
>
0 Likes
Message 6 of 9

Anonymous
Not applicable
Thanks,
That's exactly what I was looking for.

--Adam

P.Murali wrote in message
news:[email protected]...
> Hi!Adam,
>
> You can achieve it in the following way.
>
> Declare a dynamic array as
> Dim lneVert () as AcadLine
>
> Suppose you have number of lines in the variable 'lineCount' then the
> following will increase the array size dynamically.
> Redim ineVert(1 to lineCount) as acadline
>
> Use the following if you want to increase the array size without erasing
the
> previous elements in the array.
> Redim Preserve ineVert(1 to lineCount) as acadline
>
> Also refer the VB help for more information.
> --
> bye,
>
> P.Murali
> Adam Thomas wrote in message
> news:[email protected]...
> > I want to create an array of lines, but the finite number of lines I
need
> is
> > dependent on user input. How should I define my variable so that the
> number
> > of objects in the array is comparable to the number of items I need? As
of
> > right now I am using the following:
> >
> > Dim lneVert (0 to 10000) as AcadLine
> >
> > This works, but I would like it to be accurate.
> >
> > BTW I am using A2K...
> >
> > TIA,
> >
> > --Adam Thomas
> > Assistant Systems Coordinator
> > Chattanooga Boiler and Tank Co.
> > [email protected]
> >
> >
>
>
0 Likes
Message 7 of 9

Anonymous
Not applicable
I'm trying to cycle through a set of blocks and create separate selection
sets based on groups of blocks that contain a common attribute value. For
example, I need to check a block's attribute and if it matches one already
encountered, the block is placed into the appropriate selection set. If
it's a new value, a new selection set is created with that block as a
member.

I've tried to dynamically create arrays, but am having trouble determining
whether a current attribute value is a member of an existing selection set.

Any ideas? Anyone have a simpler way?

Thanks-

Jim Story
OTM Engineering, Inc.
[email protected]
(512) 328-8801
0 Likes
Message 8 of 9

Anonymous
Not applicable
I don't know what your problem is, but I would create a two dimensional
array where the first value would be the attribute value and the second the
selectionset. When cycling through the array for the attribute value of the
current block I would use strComp to compare the values.

Post your code if you want more help.

--
Rune Wold
System Analyst
Engineering Systems
[email protected]
--
"Jim Story" wrote in message
news:[email protected]...
> I'm trying to cycle through a set of blocks and create separate selection
> sets based on groups of blocks that contain a common attribute value. For
> example, I need to check a block's attribute and if it matches one already
> encountered, the block is placed into the appropriate selection set. If
> it's a new value, a new selection set is created with that block as a
> member.
>
> I've tried to dynamically create arrays, but am having trouble determining
> whether a current attribute value is a member of an existing selection
set.
>
> Any ideas? Anyone have a simpler way?
>
> Thanks-
>
> Jim Story
> OTM Engineering, Inc.
> [email protected]
> (512) 328-8801
>
>
0 Likes
Message 9 of 9

Anonymous
Not applicable
Jim, I won't throw any code at you but I here's one way the logic should
work, based on naming the selsets to match the attribute values:

build the sel set of all your blocks
for...each loop through sel set checking attr. value
place block into sel set who's name matches attr. value
if error then the selset does not exist - create it

Does that make sense to you?

Regards,
Jacob Dinardi

Jim Story wrote in message
news:[email protected]...
I'm trying to cycle through a set of blocks and create separate selection
sets based on groups of blocks that contain a common attribute value. For
example, I need to check a block's attribute and if it matches one already
encountered, the block is placed into the appropriate selection set. If
it's a new value, a new selection set is created with that block as a
member.

I've tried to dynamically create arrays, but am having trouble determining
whether a current attribute value is a member of an existing selection set.

Any ideas? Anyone have a simpler way?

Thanks-

Jim Story
OTM Engineering, Inc.
[email protected]
(512) 328-8801
0 Likes