ScriptSpot

Forum topic · General Scripting

Help! error I don't understand....

By maucerichris · 2015-05-23

Description

Hi,

I am trying to buid a spine from proxy point position, so I start creating the proxys with this code:

/*
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
radCLSpin = 10 ------- radius o the controles Ik
MiddleSpineGuideSize = 25 ---- size of the constrained point in midlle o spine
proxySize = 15
/*Spine FK*/

nbFKCtrl= 4 ---- number of Controls fk
lenghtCtrl = 100 ---- lenght of the box
widhtCtrl = 25 ---- width of the box

nNodes = 3 ---- nb of Proxy for spline generation
Size = 80 ---- Size of the spine

boneLs = #()
RootLs = #()
CtrLS = #()
CtrLSFK=#()
ProxyLs=#()
tangant = #()
- ---------------------------------------------------------------- Proxys--------------------------------------------------------------------------------

rootPX = point size:(proxySize*1.2) box: true cross: false name: "Pxy_Root"

free ProxyLs
newPos = rootPX.pos

for i= 1 to nNodes do
(
px= point size: proxySize box: false cross: true name:( "Pxy_Spine_0"+i as string)
px.pos = newPos
newPos = rootPX.pos + [0,0,((size/nNodes)*i)]
append ProxyLs PX
)

SpineSize = distance ProxyLs[1] ProxyLs[ProxyLs.count]
NodPos = for p in ProxyLs collect p.pos

for t = 1 to nNodes+1 do
(
tang = point size: (proxySize*.4) box: true cross: false name: ("Pxy_tangent"+t as string)
tangZ= ((SpineSize/(nNodes+2))*t) as float
tang.pos = [0,0,tangZ]
append tangant tang
)

The first time, it works but know it returns me:

-- No ""="" function for (%u-() Global:rootPX)

and doesn't creeate the root ...

I don't understand why, any idea?

Comments (1)

barigazy · 2015-05-24

Clean up the code a bit. This works. I don't see any error.
Also put yor code inside mxs tags for better readability
http://www.scriptspot.com/forums/3ds-max/general-scripting/kredka-strike…

radCLSpin = 10 ------- radius o the controles Ik
MiddleSpineGuideSize = 25 ---- size of the constrained point in midlle o spine
proxySize = 15
/*Spine FK*/

nbFKCtrl= 4 ---- number of Controls fk
lenghtCtrl = 100 ---- lenght of the box
widhtCtrl = 25 ---- width of the box

nNodes = 3 ---- nb of Proxy for spline generation
Size = 80 ---- Size of the spine

boneLs = #()
RootLs = #()
CtrLS = #()
CtrLSFK=#()
ProxyLs=#()
tangant = #()

rootPX = point size:(proxySize*1.2) box:on cross:off name:"Pxy_Root"
newPos = rootPX.pos

for i= 1 to nNodes do
(
px = point size: proxySize box:off cross:on name:("Pxy_Spine_0"+i as string)
px.pos = newPos
newPos = rootPX.pos + [0,0,((size/nNodes)*i)]
append ProxyLs PX
)

SpineSize = distance ProxyLs[1] ProxyLs[ProxyLs.count]
NodPos = for p in ProxyLs collect p.pos

for t = 1 to nNodes+1 do
(
tang = point size:(proxySize*.4) box:on cross:off name:("Pxy_tangent"+t as string)
tangZ= ((SpineSize/(nNodes+2))*t) as float
tang.pos = [0,0,tangZ]
append tangant tang
)