Hi, I am a novice at MXS but I have picked up some bits and bobs to try and mash what I would like to do.
I have a series of objects that are in a spreadsheet, it produces a text file with a delimiter of "|" with the line name in the first and the name of the custom object in the fourth column I would like to read in all modifications required to the lines.
So far I have this however Max is unable to converts the custom object name to a MaxObject.
n = "C:\\test\\07_Max\\macros\\test.txt"
f = openfile n mode:"r"
count = 0
while not eof f do
(
l = readline f
data = filterstring l "|"
beamz = line name:(data[1])
beamtype = line name:(data[4])
select beamz
for index = beamz.modifiers.count to 1 by -1 do
if ((classOf beamz.modifiers[index]) == Sweep) do
deleteModifier beamz index
sw=sweep() -- create an Edit Mesh modifier
addModifier beamz sw -- add edit mesh mod
select beamz -- select object box01
beamz.modifiers[#Sweep].CustomShape = 1
beamz.modifiers[#Sweep].XOffset = 0
beamz.modifiers[#Sweep].yOffset = 0
beamz.modifiers[#Sweep].MirrorXZPlane = off
beamz.modifiers[#Sweep].shapes[1] = (data[4])
beamz.modifiers[#Sweep].PivotAlignment = 5
beamz.modifiers[#Sweep].Banking = off
)
\
I then would like to change the line name to the data[2] & data[3] & text.
If someone could give a few pointers I would grateful, thank you.
Forum topic · General Scripting
Sweep modifer from textfile
By Mark Roberts · 2015-12-21
Comments (2)
Comment policy
.
I can't understand where is the problem(I don't have your text file), but you can select an object by its name using this:
RE advice
Thank you Miauu, that advice got it to work!
the textfile wasn't the issue
it is broken up into string | Span | Type of Structure | object for use as sweep | delimitated by "|"
the code below is the resultant.