I need help with my script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2010   #1
Question I need help with my script

hello everybody. I'm sorry for my english it's still not good, but I need you help, I just start to learn maxscript and I don't know much about it and I count on you help.
There is a problem with my script, when I try to use it as a function I get error "object is not part of simulation" however it works perfect in Maxscript Listiner and Maxscript Editor, if I don't use it as a function. Why it so?And how to fix it, because I have to use this code as a function, when I press button on rollout form.

delete $*
		tb=tube sides:18 heightsegs:20 radius1:7 radius2:15 height:70 pos:[0,0,-35]
		pln=plane length:120 width:100 pos:[20,-5,45] lengthSegs:24 widthSegs:20
		bnd= bend bendAngle:45 bendDir:45 bendAxis:2
		clth=cloth()
		clth.UseGravity=true
		addModifier tb bnd 
		addModifier pln clth
		addModifier tb clth
		clth.ClothOps.SetObjectType pln 2 true 		
		clth.ClothOps.SetObjectProperty pln "bCurve" 0.0 
		clth.ClothOps.SetObjectProperty pln "stretch" 100.0
		clth.ClothOps.SetObjectProperty pln "shear" 225
		clth.ClothOps.SetObjectProperty pln "density" 0.01
		clth.ClothOps.SetObjectProperty pln "thickness" 0.2
		clth.ClothOps.SetObjectProperty pln "repulsion" 2.0
		clth.ClothOps.SetObjectProperty pln "damping" 0.1
		clth.ClothOps.SetObjectProperty pln "airres" 0.02
		clth.ClothOps.SetObjectProperty pln "dynFric" 0.1
		clth.ClothOps.SetObjectProperty pln "staticFric" 0.5
		clth.ClothOps.SetObjectProperty pln "selfFric" 0.5
		clth.ClothOps.SetObjectProperty pln "seamForce" 5000.0
		clth.ClothOps.SetObjectProperty pln "uScale" 1.0
		clth.ClothOps.SetObjectProperty pln "vScale" 1.0
		clth.ClothOps.SetObjectProperty pln "useEdgeSprings" false
		clth.ClothOps.SetObjectProperty pln "useSolidFriction" false
		clth.ClothOps.SetObjectProperty pln "depth" 1.0
		clth.ClothOps.SetObjectProperty pln "offset" 1.0
		clth.ClothOps.SetObjectProperty pln "enableCollisions" true
		clth.ClothOps.SetObjectProperty pln "uBend" 25
		clth.ClothOps.SetObjectProperty pln "vBend" 25
		clth.ClothOps.SetObjectProperty pln "ubCurve" 0.0
		clth.ClothOps.SetObjectProperty pln "vbCurve" 0.0
		clth.ClothOps.SetObjectProperty pln "uStretch" 75
		clth.ClothOps.SetObjectProperty pln "vStretch" 75
		clth.ClothOps.SetObjectProperty pln "keepShape" false
		clth.ClothOps.SetObjectProperty pln "plasticity" 0.0
		clth.ClothOps.SetObjectProperty pln "layer" 0
		clth.ClothOps.SetObjectProperty pln "compress" true
		clth.ClothOps.SetObjectProperty pln "ucompress" 75
		clth.ClothOps.SetObjectProperty pln "vcompress" 75
--Animation Guy
clth.ClothOps.SetObjectType  tb 1 true
clth.ClothOps.SetObjectProperty tb "depth" 1
clth.ClothOps.SetObjectProperty tb "offSet" 5
clth.ClothOps.SetObjectProperty tb "dynFric" 0.1
clth.ClothOps.SetObjectProperty tb "staticFric" 0.5
clth.ClothOps.SetObjectProperty tb "EnableCollisions" true
select pln
max modify mode
clth.ClothOps.EraseSimulation()
clth.ClothOps.Simulate true
 
Old 06 June 2010   #2

delete $*
(
	tb=tube sides:18 heightsegs:20 radius1:7 radius2:15 height:70 pos:[0,0,-35]
	p=plane length:120 width:100 pos:[20,-5,45] lengthSegs:24 widthSegs:20
	bnd= bend bendAngle:45 bendDir:45 bendAxis:2
	clth=cloth()
	clth.UseGravity=true
	addModifier tb bnd 
	addModifier p clth
	addModifier tb clth

    max modify mode
	modpanel.setcurrentobject clth
	clth.ClothOps.SetObjectType p 2 true 		
	clth.ClothOps.SetObjectProperty p "bCurve" 0.0 
	clth.ClothOps.SetObjectProperty p "stretch" 100.0
	clth.ClothOps.SetObjectProperty p "shear" 225
	clth.ClothOps.SetObjectProperty p "density" 0.01
	clth.ClothOps.SetObjectProperty p "thickness" 0.2
	clth.ClothOps.SetObjectProperty p "repulsion" 2.0
	clth.ClothOps.SetObjectProperty p "damping" 0.1
	clth.ClothOps.SetObjectProperty p "airres" 0.02
	clth.ClothOps.SetObjectProperty p "dynFric" 0.1
	clth.ClothOps.SetObjectProperty p "staticFric" 0.5
	clth.ClothOps.SetObjectProperty p "selfFric" 0.5
	clth.ClothOps.SetObjectProperty p "seamForce" 5000.0
	clth.ClothOps.SetObjectProperty p "uScale" 1.0
	clth.ClothOps.SetObjectProperty p "vScale" 1.0
	clth.ClothOps.SetObjectProperty p "useEdgeSprings" false
	clth.ClothOps.SetObjectProperty p "useSolidFriction" false
	clth.ClothOps.SetObjectProperty p "depth" 1.0
	clth.ClothOps.SetObjectProperty p "offset" 1.0
	clth.ClothOps.SetObjectProperty p "enableCollisions" true
	clth.ClothOps.SetObjectProperty p "uBend" 25
	clth.ClothOps.SetObjectProperty p "vBend" 25
	clth.ClothOps.SetObjectProperty p "ubCurve" 0.0
	clth.ClothOps.SetObjectProperty p "vbCurve" 0.0
	clth.ClothOps.SetObjectProperty p "uStretch" 75
	clth.ClothOps.SetObjectProperty p "vStretch" 75
	clth.ClothOps.SetObjectProperty p "keepShape" false
	clth.ClothOps.SetObjectProperty p "plasticity" 0.0
	clth.ClothOps.SetObjectProperty p "layer" 0
	clth.ClothOps.SetObjectProperty p "compress" true
	clth.ClothOps.SetObjectProperty p "ucompress" 75
	clth.ClothOps.SetObjectProperty p "vcompress" 75
	
	--Animation Guy
    modpanel.setcurrentobject tb
	clth.ClothOps.SetObjectType  tb 1 true
	clth.ClothOps.SetObjectProperty tb "depth" 1
	clth.ClothOps.SetObjectProperty tb "offSet" 5
	clth.ClothOps.SetObjectProperty tb "dynFric" 0.1
	clth.ClothOps.SetObjectProperty tb "staticFric" 0.5
	clth.ClothOps.SetObjectProperty tb "EnableCollisions" true
	
	select p
	clth.ClothOps.EraseSimulation()
	clth.ClothOps.Simulate true
)
 
Old 06 June 2010   #3
denisT Thanks so much for helping me
 
Old 06 June 2010   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:05 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.