nbrt
1
Hi,
I would like to modify interpolation maxt() value when the function returns only part reference for interpolation. Somehow like this:
from salome.shaper import model
def make_interpolation():
model.begin()
partSet = model.moduleDocument()
part = model.addPart(partSet)
part_document = part.document()
model.addInterpolation(part_document, "t","t*t","0", 0, 10, 100)
return part
part = make_interpolation()
part.document().allFeatures()[0].maxt().setValue(20)
But the last line is not working, can anyone with better programing skills give an advice how I shoud do this?
Hi,
you can either apply .maxt().setValue(20) on the result of addInterpolation:
from salome.shaper import model
def make_interpolation():
model.begin()
partSet = model.moduleDocument()
part = model.addPart(partSet)
part_document = part.document()
interpolation = model.addInterpolation(part_document, "t","t*t","0", 0, 10, 100)
return interpolation
interpolation = make_interpolation()
interpolation.maxt().setValue(20)
model.end()
or set it the advanced way on the feature itself, given its type (real here) and its name (“maxt” here):
from salome.shaper import model
def make_interpolation():
model.begin()
partSet = model.moduleDocument()
part = model.addPart(partSet)
part_document = part.document()
model.addInterpolation(part_document, "t","t*t","0", 0, 10, 100)
return part
part = make_interpolation()
feature = part.document().allFeatures()[0]
feature.real("maxt").setValue(20)
model.end()
Best regards,
Christophe
1 Like