[Closed] combine $ with a variable string
this should be fairly simple, but somehow i cant combine the $ with a variable.VRayProxy_Bridge3 is the object name. This code works:
move $VRayProxy_Bridge3 [xPosvalue,yPosvalue,zPosvalue]
instead i want it to be, but this one deosnt work:
move $+“variable” [xPosvalue,yPosvalue,zPosvalue]
here the variable is a string
thx for quick help!
It doesn’t look like good practice.
Maybe you should post the whole code of what you’re trying to do.
nope didnt work, thx though, attaching the code, when i execute with your suggestion we dont reach the bottom to print commands
errorstate = false
Global f2
Global BldgRootFolder
Global SaveLocation
rollout CEL "CityEngine layout" width:467 height:321
(
groupBox grp3 "City Layout" pos:[4,3] width:460 height:310
label InputfileName "Layout TXT" pos:[24,180] width:300 height:30
label InputBldgDirName "Building Directory" pos:[24,80] width:300 height:30
button InputLayout "Load CityEngine layout" pos:[84,130] width:188 height:43
button InputBldgDir "Load Building root Directory" pos:[84,35] width:188 height:43
on InputBldgDir pressed do
(
SaveLocation = getSavePath caption:"Pick buidling Root location" initialDir:"Q:\Public\lpeterffy\ProxyTest"
BldgRootFolder = SaveLocation
if BldgRootFolder == undefined do(print "No Buidling Root Folder Chosen"; errorstate = true)
if BldgRootFolder != undefined do(InputBldgDirName.text = "Buidling Root Directory :" + BldgRootFolder)
)
-- events that have to happen such as button pressed
on InputLayout pressed do
(
f = getOpenFileName types:"Text(*.txt)|*.txt|All files|*.*|"
if f == undefined do (print "No layout TXT file Chosen"; errorstate = true)
if f != undefined do (f2 = openFile f mode:"rt")
if f2 == undefined do (print "Layout file Not Found"; errorstate = true)
if f != undefined do (InputfileName.text = "Layout file: "+f)
if f2 == undefined do (Messagebox "Layout file Not Found"; errorState = true)
try
(
while not eof f2 AND not errorstate do
(
inputData = readLine f2
inputData = trimright inputData
inputArray = filterString inputData " , "
if inputArray.count == 11 do (
BldgNr = inputArray[1] +" "
AssetName =inputArray[2]
AssetName=substring AssetName 1 (findString AssetName "." - 1)
xPosvalue = inputArray[3] as float
yPosvalue = inputArray[4] as float
zPosvalue = inputArray[5] as float
xRotvalue = inputArray[6] as float
yRotvalue = inputArray[7] as float
zRotvalue = inputArray[8] as float
xScalevalue = inputArray[9] as float
yScalevalue = inputArray[10] as float
zScalevalue = inputArray[11] as float
print BldgNr
print AssetName
print xPosvalue
print yPosvalue
print zPosvalue
print xRotvalue
print yRotvalue
print zRotvalue
print xScalevalue
print yScalevalue
print zScalevalue
ImportingMaxfile = BldgRootFolder+"/" + AssetName+".max"
ProxyObjName= getmaxfileobjectnames ImportingMaxfile
mergemaxfile ImportingMaxfile ProxyObjName #select
--move getNodebyName ProxyObjName [40,0,0]
move $VRayProxy_Bridge3 [xPosvalue,yPosvalue,zPosvalue]
print ProxyObjName
print ImportingMaxfile
)
)
)
catch()
)
)
CreateDialog CEL
what i am trying to do is loading data from a text file , this data has RTS values i want to use to distribute vrayproxy models from an external max file…
getnodebyname needs a single item, the ProxyObjName will return an array not a string. Also, you need to wrap it in () so that is executed as a single item in the move command. Currently your code says:
move <node>getNodeByName <point3>ProxyObjName
instead of:
move <node>(getNodeByName ProxyObjName) <point3>[40,0,0]
You will need to put ProxyObjName in a for loop and access the array index:
for val in 1 to ProxyObjName.count do (
move (getNodeByName ProxyObjName[val]) [40,0,0]
)
-Eric
ah yes! forgot that one was an array.
Loops through fine now, thx Eric