Can't find documentation (new macro commands)

Can't find documentation (new macro commands)

old_snickers
Advocate Advocate
1,103 Views
4 Replies
Message 1 of 5

Can't find documentation (new macro commands)

old_snickers
Advocate
Advocate

Hello  to all,

 

I found here a lot of very inspiring macros, written by some real programming idols. Many thanks to all for sharing this great work!  But unfortunately the customizing for my own circumstances causes often a lot of "try and error", because I can not find any explanation in the "Macro programming guide".

 

Two examples:

FOREACH $Selected IN (explorer_selected_entities()) ....

string list tp_names = extract(flatten(extract($progs, 'nctoolpath')), 'name')

 

How are the possibilities with "explorer_selected_entities", how is it to use and what the hell means "flatten" inside of the extract-command?

 

Is there any further documentation for macro commands which are not descripted in the here downloadeble guide?

0 Likes
Accepted solutions (1)
1,104 Views
4 Replies
Replies (4)
Message 2 of 5

TK.421
Advisor
Advisor
Accepted solution

The definitions youre looking for are under help, documentation, parameters, reference. In that document you can go to the Functions section and find examples and definitions of your two examples as well as a host of others.

Capture.PNGCapture.PNG

Capture.PNG


the numbers never lie
Message 3 of 5

old_snickers
Advocate
Advocate

So near yet so far....

 

old_snickers_0-1676054520665.gif

Many. many thanks!

Message 4 of 5

urizenYHS3W
Advocate
Advocate

Taken the example given with flatten above, if you do something like
    extract(folder('toolpath'),' Name')
what you get back is a list of toolpath names. So you can do something like

STRING LIST names = extract(folder('toolpath'), 'Name')


but what happens if you


extract(folder('toolpath','BadSurfaces.List')


what you get back is a list where each item in the list is a list of names. In effect you have a list of lists. Now you could write something like

STRING LIST badsurfs = {}
FOREACH lst IN extract(folder('toolpath','BadSurfaces.List') {
  FOREACH item IN lst {
    int x = add_last(badsurfs, item)
  }
}

 

the flatten() function takes a list of lists and puts the contents of all the lists into a single list. in effect it 'flattens' the list of list.

 

Message 5 of 5

old_snickers
Advocate
Advocate

Sounds reasonable... I will do some experiments with this (and with a little more plan now) 😉

0 Likes