Hello everyone... I'm working on a extension script to tweak out some of the functions in inkscape's verb option.
My question is I need a special loop that does something like this: using the self.selected feature:
I am baffled with nested loops on python
All I need to figure out is how I can use the selected layers in this method
As first value is one object and the second is another one?
The format I tried was
for iterating_var in sequence:
for iterating_var in sequence:
statements(s)
statements(s)
Which would loop properly however same object and object that is more than the second one are skipped.
1-2
1-3
1-4
2-3
2-4
3-4
I'm just stumped on how I can in a way skip the bad combos and making sure the objects are re-used?
Not asking for code I'll be happy just knowing the term for theses sets of numbers or for searching (I even tried to find a lottery type of all combinations source code but in vain)
Once my extension is done I'll add it to github for all to use.
P.S: Only code that gave me some pointers was multiple differences that I looked at but it was a single loop process which doesn't help for a automated verb option.
Thanks all in advance.
Issues with a extension (Nested Loops)
Re: Issues with a extension (Nested Loops)
Not a lot of developers participate here, although you may well get an answer from some of our really very skilled members. But in case you don't, you might want to post on the Inkscape Users mailing list, where undoubtedly many more developers will see it. https://inkscape.org/en/community/mailing-lists/
Please try to get it listed here (on the wiki) http://wiki.inkscape.org/wiki/index.php ... Repository and/or here https://inkscape.org/en/download/addons/. All you have to do to get edit permission for the wiki is ask for it on the developer mailing list. You can register for a membership on the website...I don't have a link, but I think it's fairly prominent, and not hard to find.
OR - I'm working on making a list of all the Inkscape extensions, with links to where they can be downloaded. If everyone would put their extensions in one of those 2 places above, an extra list would not be necessary. But I'm making it, so there can be a centralized source, to make it easier for people to find what they need. So if not in one of those 2 places, would you at least post a link to it on github, in a reply to this topic? Then I can add it to the list
Once my extension is done I'll add it to github for all to use.
Please try to get it listed here (on the wiki) http://wiki.inkscape.org/wiki/index.php ... Repository and/or here https://inkscape.org/en/download/addons/. All you have to do to get edit permission for the wiki is ask for it on the developer mailing list. You can register for a membership on the website...I don't have a link, but I think it's fairly prominent, and not hard to find.
OR - I'm working on making a list of all the Inkscape extensions, with links to where they can be downloaded. If everyone would put their extensions in one of those 2 places above, an extra list would not be necessary. But I'm making it, so there can be a centralized source, to make it easier for people to find what they need. So if not in one of those 2 places, would you at least post a link to it on github, in a reply to this topic? Then I can add it to the list
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Issues with a extension (Nested Loops)
I know not many dev's are on the forum believe me I searched every corner for a simple trick on a simple nested loop similar to searching all lotto combinations (Reason for it is that it's going to be quite rare that you'll use a object on itself).
I'll definitely take your advice who knows I might get lucky and search for something and find something else that fixes it.
As for the extension It's definitely a share once I'm done because seriously I know people that have never heard of DOS and it frightens me to see them attempt manual commands to get results.
Shawn
I'll definitely take your advice who knows I might get lucky and search for something and find something else that fixes it.
As for the extension It's definitely a share once I'm done because seriously I know people that have never heard of DOS and it frightens me to see them attempt manual commands to get results.
Shawn
Re: Issues with a extension (Nested Loops)
Not that I can get a little part of the idea what is going on in the codes, but perhaps you have to start the sequence with 0 as how the colour values start from?
And on the layers, is the root layer taken into calculation?
Would suggest to use the live chat.
And on the layers, is the root layer taken into calculation?
Would suggest to use the live chat.
Re: Issues with a extension (Nested Loops)
The idea for the code (And thanks for the live chat channel) is that using Page for Python I made a selection list tool that gives you all the "verb functions" and different ways of using them.
The reason of this part of the code (And it's funny because now if I search for this I'm going to kick myself) is like the Tower of Hanoi where you need to move the stack to the third post well in my case the tool I wanted to offer a loop through all the objects from top to bottom and give conditions to it such as 1 and 2, 1 and 3, 1 and 4, 2 and 3, 2 and 4, 3 and 4 combo loops was the only combinations of object interaction I was missing and that required a hefty nested loop that can do x type of nested.
I actually did find about 1h ago a example in pseudo code of what I needed so I'll be able to finish the touches on this and share the extension.
FOR i = 0 TO K - 1 <<-----------This was the parts driving me nuts. (one less than max)
FOR n = c(i) + 1 TO c(i + 1) - 1 <------------This was the parts driving me nuts. (start +1 higher than i)
t# = 1
d = V - n
FOR h = 1 TO V - K - n + i + 1
t# = t# * d / h
d = d - 1
NEXT h
idx# = idx# + t#
NEXT n
NEXT i
So I'm off to finish this I'm hoping to get it totally done by August 1st and Thank You all for you help and directions they will definitely be useful for other projects.
Shawn Dion
The reason of this part of the code (And it's funny because now if I search for this I'm going to kick myself) is like the Tower of Hanoi where you need to move the stack to the third post well in my case the tool I wanted to offer a loop through all the objects from top to bottom and give conditions to it such as 1 and 2, 1 and 3, 1 and 4, 2 and 3, 2 and 4, 3 and 4 combo loops was the only combinations of object interaction I was missing and that required a hefty nested loop that can do x type of nested.
I actually did find about 1h ago a example in pseudo code of what I needed so I'll be able to finish the touches on this and share the extension.
FOR i = 0 TO K - 1 <<-----------This was the parts driving me nuts. (one less than max)
FOR n = c(i) + 1 TO c(i + 1) - 1 <------------This was the parts driving me nuts. (start +1 higher than i)
t# = 1
d = V - n
FOR h = 1 TO V - K - n + i + 1
t# = t# * d / h
d = d - 1
NEXT h
idx# = idx# + t#
NEXT n
NEXT i
So I'm off to finish this I'm hoping to get it totally done by August 1st and Thank You all for you help and directions they will definitely be useful for other projects.
Shawn Dion