Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Maya Programming with Python Cookbook

You're reading from  Maya Programming with Python Cookbook

Product type Book
Published in Jul 2016
Publisher Packt
ISBN-13 9781785283987
Pages 266 pages
Edition 1st Edition
Languages
Author (1):
Adrian Herbez Adrian Herbez
Profile icon Adrian Herbez

Table of Contents (17) Chapters

Maya Programming with Python Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with Maya 2. Creating User Interfaces 3. Working with Geometry 4. Giving Things a Coat of Paint – UVs and Materials 5. Adding Controls – Scripting for Rigging 6. Making Things Move – Scripting for Animation 7. Scripting for Rendering 8. Working with File Input/Output 9. Communicating with the Web 10. Advanced Topics Index

Accessing geometric data in NURBS objects


In this example, we'll be looking at how to retrieve information about NURBS surfaces, starting with the number of control vertices (CVs) they contain.

However, the number of CVs in a NURBS object isn't quite as straightforward as the number of vertices in a polygonal object. Although polygonal objects are relatively simple, with their shape determined directly by the position of the vertices, the curvature at any given point of a NURBS object is influenced by multiple points. The exact number of points that influence a given area depends on the degree of the surface.

To see how this works, we'll create a script that will determine the total number of CVs in each direction (U and V) of a NURBS surface, and we'll look at how to select a particular CV.

Getting ready

Make sure that you have a scene containing at least one NURBS surface.

How to do it...

Create a new file, name it getNURBSinfo.py (or similar), and add the following code:

import maya.cmds as...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}