stelz-aleks
06-22-2010, 05:07 PM
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
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
