1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wizoscript Python syntax question.

Discussion in '3rd Party Add-ons' started by oldfox, Jan 9, 2018.

  1. oldfox

    oldfox Senior Member

    I need the correct syntax for line 5 for this to work.

    Here's the script:

    ****************************************************************************************************************
    # open an existing assembly
    Asm = Assembly(r'C:\Users\Chris\Desktop\Animation', 'Main Unit')

    # This is the hierarchy of the part, drilling down thru the file "Main Unit.AD_ASM"
    Item = Asm.GetPart('001 - Rotating Parts<1>, 01 - Crankshaft<1>, Part 19 - Crankshaft<1>')

    for loop in range(0, 3):
    for z in range(0, 36):
    Asm.RotatePart(Item, 0, 0, 10)
    ****************************************************************************************************************

    And here's the error report
    ****************************************************************************************************************
    IronPython 2.7.7.0 Interactive Console
    For documentation visit http://docs.python.org/2.7
    The complete standard library is available

    Console commands available:
    history - Prints history of entered commands
    cls - Clears the screen
    help - Shows the list of console commands
    run - Executes the current script

    >>>
    Traceback (most recent call last):
    File "<string>", line 5, in <module>
    Exception: Part 001 - Rotating Parts<1>, 01 - Crankshaft<1>, Part 19 - Crankshaft<1> was not found.

    >>>
    ****************************************************************************************************************

    The model opens and I can *manually* rotate "Part 19 - Crankshaft<1>" perfectly. So I assume it is only the
    syntax that's wrong. That is, if this script can even be written to drill down through 3 sub-assemblies.

    Thanks
     
  2. ajayre

    ajayre Senior Member

    Try something like this:

    Code:
    MyPart = Part('Foo')
    Bar1 = MyPart.GetSubAssembly('Bar<1>')
    Baz3 = Bar1.GetSubAssembly('Baz<3>')
    Barfoo2 = Baz3.GetPart('BarFoo<2>')
    
     
  3. oldfox

    oldfox Senior Member

    Got it. Thanks a lot! I knew there had to be a way. I'll show what I have when I have it working. This is related to the "rotate about named
    axis" as opposed to XYZ. For now, I can make it work by rotating about a *part*.
    Thanks again.
     

Share This Page