WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-30-2010, 01:58 PM
imperialkat imperialkat is offline
Member
 
Join Date: Jan 2010
Posts: 9
Looking for a shape

For a model I'm working on I need a shape that looks like a cone with its tip cut off. I want to be able to control the diameter of both sides. Is there a way to achieve this in Vizard?
Reply With Quote
  #2  
Old 06-30-2010, 02:02 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Code:
import vizshape
myshape = vizshape.addCylinder(height=1.0,bottomRadius=0.5,topRadius=0.1)
Reply With Quote
  #3  
Old 07-02-2010, 12:01 PM
imperialkat imperialkat is offline
Member
 
Join Date: Jan 2010
Posts: 9
Alright, that was what I was looking for. Now I want to manipulate it from within the program. This is what I have:

Code:
import viz
import vizshape

viz.go()

viz.MainView.setPosition(0,0,-4)

slider = viz.addSlider()
slider.setPosition(0.2, 0.1)
slider.set(0.1)

def onSlider():
	x = slider.get()
	print x
	myshape = vizshape.addCylinder(height=1.0,bottomRadius=0.5,topRadius=x)

vizact.onupdate(0, onSlider)
But when I move the slider the top of the cone only gets bigger, not smaller. What am I doing wrong?
Reply With Quote
  #4  
Old 07-05-2010, 03:06 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You'll need to remove the cylinder you already added to see the new clinder you add with a smaller radius:
Code:
import viz
import vizshape

viz.go()

viz.MainView.setPosition(0,0,-4)

slider = viz.addSlider()
slider.setPosition(0.2, 0.1)
slider.set(0.1)

myshape = vizshape.addCylinder(height=1.0,bottomRadius=0.5,topRadius=0.1)

def changeRadius(pos):
	global myshape
	myshape.remove()
	myshape = vizshape.addCylinder(height=1.0,bottomRadius=0.5,topRadius=slider.get())

vizact.onslider(slider, changeRadius)
Reply With Quote
  #5  
Old 07-06-2010, 12:02 PM
imperialkat imperialkat is offline
Member
 
Join Date: Jan 2010
Posts: 9
Thanks, that works well. I was just wondering if there was an easier way to do that--i.e., instead of erasing cones and rendering new ones, could I call, say, the topRadius with a command and change it?
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC