Can't import or find auxillay library shapes, or Polygon, path, etc

56 views
Skip to first unread message

Michael Huster

unread,
Aug 18, 2016, 12:34:09 PM8/18/16
to VPython-users
This seems simple, but I can't find the auxiliary libraries. I want to extrude an aperture with various shaped holes. I tried looking for visual.shapes, import shapes, etc. I've tried searching vpython.org and can't find help. I've tried several different platforms, like SageMath Cloud - jupyter notebook. VPython works great, I just can't find these other objects.

(BTW, I also can't find a way to search the google group.)

Bruce Sherwood

unread,
Aug 18, 2016, 1:44:13 PM8/18/16
to VPython-users
For Classic VPython, at vpython.org click "Documentation" at the upper left, then click "Full documentation", or if you are in the VIDLE editor of Classic VPython, on the Help menu choose VPython, or if you are using GlowScript VPython, at glowscript.org click Help.

Then on the pull-down menu "Work with 3D objects" choose "Shapes library". Or on the "Choose a 3D object" choose "extrusion", which gives links to the shapes and paths libraries.

Googling "vpython shapes" gives a link to the Classic VPython shapes library documentation.

The VPython documentation can definitely be improved, but can you provide some sense of how it proved impossible to find this information?

P.S. The extrusion object is not yet available in Jupyter VPython, and the extrusion object in GlowScript VPython is quite rudimentary. I'm working on this.



Michael Huster

unread,
Aug 19, 2016, 7:14:41 AM8/19/16
to vpytho...@googlegroups.com
I found all of the documentation, but my scripts were not finding the
shape and path libraries. I imported visual with a name, so my code
was:

import visual as v
sp1 = v.sphere(color=v.color.red)
rect = v.shapes.rectangle(width=0.2, height=0.4)
circpath = v.paths.circle(radius=3)
ext1 = v.extrusion(pos=circpath, shape=rect)

I got "TypeError: Cannot read property 'rectangle' of undefined. rect
= v.shapes.rectangle(width=0.2, height=0.4)", so I thought that I had
to explicitly import shapes and path.

Michael Huster

Steve Spicklemire

unread,
Aug 19, 2016, 8:04:11 AM8/19/16
to VPython-users
Hi Michael,

I think you're probably mixing environments somehow. Your use of 'visual' implies classic vpython, the but error "TypeError: Cannot read property 'rectangle' of undefined" sounds more like Javascript. What is your environment exactly? Your example works fine in classic vpython.

thanks,
-steve

Bruce Sherwood

unread,
Aug 19, 2016, 10:49:14 AM8/19/16
to VPython-users
The basic problem is, as I commented earlier, that the extrusion object in GlowScript VPython and the associated shapes and paths libraries are pretty rudimentary. For the moment, don't import by name and your program will work. I do expect to release very soon a much improved extrusion object, with far more extensive shapes and paths libraries.

Michael Huster

unread,
Aug 19, 2016, 4:42:41 PM8/19/16
to vpytho...@googlegroups.com
Thanks
Reply all
Reply to author
Forward
0 new messages