I am trying to change the object print width of a Line/LineCurve object. My program creates the line segment, and then attempts to change the object’s print width through the suggested commands in this post: How to change display line width?
I have adapted it in the following way in my code:
def LineSeg(self, text, weight, lineX, lineY, lineZ, line_set):
block = []
for i in range(len(lineX)):
# Draws line segment
line = rs.AddLine((lineX[i][0], lineY[i][0], lineZ[i][0]), (lineX[i][1], lineY[i][1], lineZ[i][1]))
pws = Rhino.DocObjects.ObjectPlotWeightSource.PlotWeightFromObject
# Changes line width if corresponding element with same index in 'weight' list is greater than 0.0
if weight[i] > 0.0:
#rs.ObjectPrintWidth(line, weight[i])
rh_obj = rs.coercerhinoobject(line, True, True)
rh_obj.Attributes.PlotWeightSource = pws
rh_obj.Attributes.PlotWeight = weight[i]
print (rh_obj)
rh_obj.CommitChanges()
# Collects GUIDs of line segments
block.append(line)
scriptcontext.doc.Views.Redraw()
return block
I have also tried using the rs.ObjectPrintWidth command, but it returns the same error (pictured below)
How would I need to change the handling of the ‘line’ variable or its type, so that I can change the object print width? Is it possible to also change the object’s color through this method?