ah yes.
once I returned to having an internet connection from being trapped inside
a concrete fortress,
the entire conversation revealed itself and my question seems now a bit
late to the party. please disregard.
--
You received this message because you are subscribed to the Google Groups
On Tue, Sep 20, 2016 at 11:17 AM Geordie Martinez
wrote:
> why don’t you just add a hash to the name which auto-numerates nodes
> without name collision?
>
Because the original request asked to have placeholders in a position other
than the end of the name, and also
why don’t you just add a hash to the name which auto-numerates nodes
without name collision?
import maya.cmds as mc
blah = mc.polyCube(n="someBaseName#") # the hash inside the string
is legal and will resolve to the next unique int
On Mon, Sep 19, 2016 at 3:45 PM, likage
ah... I am still trying to get my head around this...
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
Yea this isn't what you want. It has bugs. Firstly, you seem to be
formatting the number 1 instead of the variable "i" :-)
You can't change the base variable at all. That needs to stay the original
value so that you can use it as the base of building the next name to test.
Here is an updated
I tried to use your case and did an update, and it failed badly...
Even so, my method was wrong to begin with, i think. It already fails if I
am trying to do the counter in the middle of the naming
def uniqueNamePattern(base=""):
i = 1
customRepl = base.format('x') != base
if
Can you post a new version of the code you tried? I have a feeling you are
trying to either update the default case but still passing in a customRepl
solution (a string with a replacement pattern). Or you are changing the
wrong part of the format string.
It should be possible to make the default
Prior to what yann19 has mentioned, having the padding incorporated into the
function instead of writing it out, whenever I need to call it. I thought of
changing the second last line of the function from
name = "{0}{1}".format(base, i)
into
name = "{0:<03}".format(i)
But as I tried to use
Just wondering though - is it not possible to implement the padding into
Justin's code?
Would that not be cleaner? Assuming if thread starter simply wants the
naming to be of version padding 3 throughout, rather than keep
typing uniqueNamePattern("abc_{0:0>3}"), uniqueNamePattern("def_{0:0>3}")
On Thu, Sep 8, 2016 at 10:19 AM likage wrote:
> I did not know that I can write it as {0:0>3}! Works like a charm!
>
For completeness, the equivalent in using the older string formatting
approach would be:
"abc_%03d" % number
But using the format() method is the newer
I did not know that I can write it as {0:0>3}! Works like a charm!
On Wednesday, September 7, 2016 at 12:24:56 PM UTC-7, Justin Israel wrote:
>
>
>
> On Thu, 8 Sep 2016, 6:54 AM likage
> wrote:
>
>> I tried to tweak the code a bit so that it will register version padding
On Thu, 8 Sep 2016, 6:54 AM likage wrote:
> I tried to tweak the code a bit so that it will register version padding -
> eg. abc_001, abc_002 where in my code I am using something like
> uniqueNamePattern("abc_{0}{0}{0}")
>
> While it seems to work in a sense, I got
I tried to tweak the code a bit so that it will register version padding -
eg. abc_001, abc_002 where in my code I am using something like
uniqueNamePattern("abc_{0}{0}{0}")
While it seems to work in a sense, I got abc_111, abc_222 instead... Also I
tried something like
>
>
> @alok
> I guess I could have made the default base use the pattern that likage had
> specified, but I was really just making it generic and then the usage of it
> could specify that custom format. Maybe my docstrings clarified the usage
> though?
>
> Justin
>
> It sure did. I would still
Sorry, I wrote this pretty quickly and didn't do any docstrings. Also
realized I had bugs from when I had to retype it from my internal network
into our public network :-)
Updated here:
https://gist.github.com/justinfx/e06e8496e535badb20e6b4ec5f0f5f77
@likage
Hopefully the new comments help. But
@Justin : Might I suggest a minor change to your example function : using
the *format code* in the default argument would make it more readable
(especially in absence of any example usage)
so the signature becomes:
def uniqueNamePattern(base="whatever_{0}_whatever")
This improves readability for
Hi, was wondering if you could explain more on 'base='object' as I am not
really understanding it... Not to mention about the base.format that you have
used.
Correct me if I am wrong but is that suppose to be the name of object?
--
You received this message because you are subscribed to the
The problem that I see is that you are doing your counter on the inner
loop. This means you will end up getting name clashes for each "geo" in
"all_geos". That is, your defined naming pattern is: TEST__GRP
While you are making sure to increment the name for each inner loopitem,
you will start
18 matches
Mail list logo