cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Array of elements

kmi
1-Newbie
1-Newbie

Array of elements

Hi everybody,

I trying to create array of elements to save the selected elements in the array (becouse after second selection all first elements are gone)
somebody know how to create array in isodraw?

5 REPLIES 5
thendricks
3-Visitor
(To:kmi)

I do not believe an array, in the VB sense, is available. Depending on your need, however, this might be obtainable using a set of global variables.

Example:

Global MyList as String

Global iCount as Integer

Then, within your macro you append your values to the MyList variable using a delimiter that you feel comfortable with (I suggest a tilda), each time increasing the value of the iCount variable.

Depending on what you need to do, the iCount value would return the size of your array. There is more coding for extraction, but it is quite possible.

If this doesn't address your need, please give a little more info on your specific issue and I'll take a look.

kmi
1-Newbie
1-Newbie
(To:thendricks)

thanks but it didn't help becouse I need create list of elements (every element has many attributes like position, string (if it text) and more)
basicly I want to select some elements like:
Select if Text contains 'WIRE'
and after I selected all wires I want to select specific wire and some lines and then create a group, but after I will write again:

Select if Text contains 'WIRE'
the order of the element in the stock of the selection will be different (by using the command element.nextSelectedElement), so I need to create an array in order to save all elements (in order to go over each element once).

thendricks
3-Visitor
(To:kmi)

Starting to get the picture. It almost sounds like you could skip the array and just use a select if, and then another select if inside the group. But I have a feeling this still isn't what you are looking for.

The approach I've used to go around this shortcoming takes some coding, but worked atleast for my purposes. If you need to be able to make one selection including multiple objects, or multiple selections each time selecting one object, but then need to revisit everything to parse out what you need this might work.

1) Prior to your first selection, create a TEMP layer.

2) Make your selection/s. After each, move the objects to the TEMP layer. This is possible to do while maintaining the auto_IDs.

3) Once everything you need to go through has been selected (and moved to the TEMP layer) you can then select everything on the TEMP layer and do what you wish.

4) Two notes though are to make sure to move the objects back to their proper layer* at the end of your macro and make sure to delete the TEMP layer when done.

*We have text on specific layer, and art on another. If you have a different breakdown, which is not as simple, you can do the following.

1) On selection, add a object attribute of your choosing and apply the current layer name.

2) Move the object and...

3) When you are done and need to move the objects back, cycle through each object.

4) Read the attribute you assigned and that gives you your original layer name that you can use to move back to.

5) Likely, you'll want to eliminate the attribute you added...but maybe not. It's up to you of course.

kmi
1-Newbie
1-Newbie
(To:thendricks)

Thanks, your right about this I already figured it out, but I did it a little bit different: I used the differed attributes of the object to mark them if I already check them (my macro very complex so I try to expain the basic operation) this way I can select and after change select again and again without lose any objects.

again thanks for your help it was helpfull.

And another question do you know who read lines from text file? it even possible?
becouse I didn't found any information about this in "Macro Language Reference" document (isod-mlref.pdf)

thendricks
3-Visitor
(To:kmi)

In regards to reading a text file, there is not a direct way except for the text excerpt. This basic logic is this.

1) You have three text elements on your page (or however many you want).

2) You export the text excerpt. This file is formatted in a specific way and must retain this formatting for importation.

3) Make you changes to the text in this file.

4) Open the text file while you have the original IsoDraw file open. The text elements will be updated with the new text.

If you look around on the forum, there are different strings on getting text into IsoDraw using a macro, but the most complete is probably "Read a text file into a variable".

Top Tags