ScriptSpot

Forum topic · General Scripting

[request] polyOp

By mambrus · 2009-07-03

Description

hi

i got a tiny problem with my script

i'm reading parameters out of a *.txt file and i'm using those to create a spline with severals knots.
this spline is converted to a editpoly obj.

well .. within the same script i want to extrude the face i got form the spline/editpoly conversion .. but i allways get an error with the message
"face list out of index .. or something simmilar" ..
the strange thing about it is - if i just do all these steps without the extrusion, and manually adding the same code for extrusion after the script finished .. i dont
get any errors

would be glad about help
cheers
masse

Comments (6)

mambrus · 2009-07-03

script works now ... thanks once more

mambrus · 2009-07-03

Thank you!
I'll have a try :)
... maybe I should simply follow the rule that says "never work after 3 a.m." *smile*

cheers
markus (munich/germany)

Marco Brunetta · 2009-07-03

lol, that's a good rule =P

cheers

Marco Brunetta · 2009-07-03

Well seems that the way you are doing it you are not really creating any faces, and so you can't extrude them. What about using an extrude modifier?

pointArray = #([0,0,0],[5,0,0],[5,5,0],[0,5,0],[-5,2.5,0])

fn createPolygons tmpArray =
(
newSplineShape = SplineShape()
addNewSpline newSplineShape
for thePoint in tmpArray DO
(
addKnot newSplineShape 1 #corner #line thePoint
)

newSplineShape.name = (tmpArray[tmpArray.count - 3]) as string

close newSplineShape 1
updateShape newSplineShape

addModifier newSplineShape (extrude height:10)
)

myPoly = createPolygons pointArray

mambrus · 2009-07-03

fn _createPolygons tmpArray =
(
-- the folling pointArray is being filled in
-- original script ... no need for showing you
pointArray = #()

-- create Polygon Object
-- do a spline object 1st
newSplineShape = SplineShape()
addNewSpline newSplineShape
for h = 1 to pointArray.count do
(
addKnot newSplineShape 1 #corner #line pointArray[h]
)

newSplineShape.name = tmpArray[tmpArray.count - 3]

close newSplineShape 1
updateShape newSplineShape

-- convert to Editable Poly
newEditPoly = convertToPoly newSplineShape

-- return
newEditPoly
)

-- -------------------------------------
myPoly = _createPolygon myArray

/*
well ... i wanted to use the newEditPoly to extrude it ... but as I told oyu .. this doesnt work
*/
polyOp.extrudeFaces myPoly #{1} 10.0
-- doesnt work ...

thx for help
masse

Marco Brunetta · 2009-07-03

Probably some mixup with either the variables or the variable scope. Any chance you can post the code or at least the relevant part?