Jump to content

Search the Community

Showing results for tags 'variables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Announcements
    • Announcements
    • News You Need
    • Job Board
  • Feedback
    • Roadmap
    • Wishlist - Feature and Content Requests
    • Known Issues
    • Wishes Granted / Issues Resolved
    • Forum Feedback
  • General
    • Troubleshooting
    • General Discussion
    • Architecture
    • Site Design
    • Entertainment
    • Vision and Previsualization
    • Braceworks
    • ConnectCAD
    • Energos
    • Rendering
    • Workflows
    • Buying and Selling Vectorworks Licenses
    • Hardware
  • Customization
    • AI Visualizer
    • Marionette
    • Vectorscript
    • Python Scripting
    • SDK
    • 3rd Party Services, Products and Events
    • Data Tags
  • Solids Modeling and 3D Printing
    • Subdivision
    • Solids Modeling
    • 3D Printing
  • Vectorworks in Action
  • Archive
    • Resource Sharing
    • Machine Design

Calendars

  • Training Events
  • Coffee Breaks
  • Essentials Seminars
  • Webinars
  • Community Groups

Categories

  • Knowledgebase
    • Tech Bulletins
    • Troubleshooting
    • Workflows
    • How To
    • FAQs

Categories

  • Marionette - Objects
  • Marionette - Networks
  • Marionette - Nodes
  • Marionette - Menu Commands

Product Groups

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Occupation


Homepage


Hobbies


Location


Skype

Found 1 result

  1. I like to deconstruct my larger more complicated scripts into smaller files. It helps me stay organized. I'm trying to get imported functions to use global variables that I have created but, it's not working the way I like and I'm not sure why. I have a main script that defines the global variables. The main script also imports demo.py and calls the function draw. The demo.py script is basically an if/else test. I've imported another file named shapes.py which has functions to draw shapes. -If the global variable 'w' is less than 6 call function myrectangle() from shapes.py -If the global variable 'w' is greater than 6 call function myoval() from shapes.py -if the global variable 'w' is equal to 6 print "Hello World" in a Alert Box. When i try to run i get: NameError: global name 'x' is not defined. I thought that if I had global variables defined in the main script i would be able to use them in the imported functions. Am I doing something wrong? main.py import vs import demo w=vs.PLineLength h=vs.PBoxWidth x = 0 y = 0 y = y-h/2 demo.draw() demo.py import vs import shapes def draw(): vs.PenSize(2); if w < 6: shapes.myrectangle() elif w > 6: shapes.myoval() elif w == 6: vs.AlrtDialog('Hello world.') shapes.py import vs def myrectangle(): vs.Rect(x,y, x+w,y+h) def myoval(): vs.Oval(x,y, x+w,y+h)
×
×
  • Create New...