Notifications
Clear all

[Closed] Wire scale to radius

Hi
Is there any exact way to wire or … to control the scale of (for example) cylinder with the radius of it. I add scale script on the scale of cylinder and this is my try

—- [1, 1, 1]degToRad(sliderApi)/1.65 –sliderA is a slider in attribueholder and i wire the cylinder’s radius to sliderA as well – but the problem is that it works just on this cylinder because of (1.65) i change the value to get exact number. Is there any other way

Thans in advance

8 Replies

I don’t get it, I mean – what are you trying to achieve? First of all, what would you want to change the scale of the object for? With a parametric objects it makes sense to connect other parameters (like height) instead. Second, it would be really confusing, you increase radius and the object gets bigger making the observable radius even bigger.

Sorry. i do my best to make it clear.
we have a wheel which is an editablepoly and we don’t know its radius.
what i want to do is:
creating a (cylinder or circle), as the wheel helper. The rotation of wheel is based on the its movement,(i don’t want to discuss about it here) so i need its radius and if the wheel get bigger it rotate less…etc., i couldn’t get any script to do this, so i try to create a (cylinder or circle) with the same radius (as big as wheel). then i link the wheel to the (cylinder or circle) after wiring the scale to the radius when i increase the radius the scale will increase then wheel will get bigger and …
but when i wire in my way the (cylinder or circle) it gets a little smaller (comparing to same cylinder before wire at the same radius) until i multiplie it here by (1.65) till i get the same volume.

Thanks for your reply

(
	delete objects

	wheel = cylinder name:"wheel" radius:10 dir:x_axis height:4 wirecolor:orange slice:on sliceFrom:345
	centerPivot wheel

	radius = (wheel.max - wheel.min).z/2

	target = circle name:"target" radius:radius dir:x_axis wirecolor:green
	target.center = wheel.center
	target.pivot = wheel.pivot


	wheel.scale = [1./radius,1./radius,1]

	resetxform wheel
	converttopoly wheel

	wheel.scale.controller = scaleXYZ()
	paramWire.connect target.baseObject[#Radius] wheel.scale.controller[#Y_Scale] "Radius"
	paramWire.connect target.baseObject[#Radius] wheel.scale.controller[#Z_Scale] "Radius"
	
	c = target.position.controller = position_constraint()
	c.appendTarget wheel 100
	
	c = target.rotation.controller = orientation_constraint() 
	c.relative = on 
	c.appendTarget wheel 100
)

—radius = ($.max – $.min).z/2—- to get the radius of a mesh or poly that was exactly what i was looking for to make the scriot better

   ---------

  
  (
  delete objects
  
  wheel = cylinder name:"wheel" radius:10 dir:x_axis height:4 wirecolor:orange --slice:on sliceFrom:345
  centerPivot wheel
  converttopoly wheel
  
  radius = (wheel.max - wheel.min).z/2
  
  target = circle name:"target" radius:radius dir:x_axis wirecolor:green
  target.center = wheel.center
  target.pivot = wheel.pivot
  
  
  wheel.scale = [1./radius,1./radius,1./radius]
  
  resetxform wheel
  --converttopoly wheel
  
  wheel.scale.controller = scaleXYZ()
  
  wheel.scale.controller.X_Scale.controller = Float_Expression ()
  wheel.scale.controller.X_Scale.controller.AddScalarTarget "Ra" target.baseObject[#Radius]
  wheel.scale.controller.X_Scale.controller.setExpression "Ra"
  wheel.scale.controller.Y_Scale.controller = Float_Expression ()
  wheel.scale.controller.Y_Scale.controller.AddScalarTarget "Ra" target.baseObject[#Radius]
  wheel.scale.controller.Y_Scale.controller.setExpression "Ra"
  wheel.scale.controller.Z_Scale.controller = Float_Expression ()
  wheel.scale.controller.Z_Scale.controller.AddScalarTarget "Ra" target.baseObject[#Radius]
  wheel.scale.controller.Z_Scale.controller.setExpression "Ra"
  )
  
    ----------
    I just used float expression instead of wire, because wheel is my real wheel's helper ,if you duplicate it wire doesn't work..

please wrap your script in the

 Tags next time! makes it easier to read!

i’m new in this site, what do you mean by “wrap your script in the

"
for above script i write (AddScalarTarget) but it puts blank. isee [denisT]( http://forums.cgsociety.org/member.php?u=384956)  put in a code, how should i do this.
 sorry if it is a funny question

one way is put your code between “

" and "[\code]" manually (change backslash to slash)
  another way is select your code and press "#" button in the message editor toolbar

    Thanks [denisT]( http://forums.cgsociety.org/member.php?u=384956)