Page 1 of 1

LineType macro crash

Posted: Mon Jul 11, 2011 12:57 pm
by James Gran
This macro crashes on LineType[n,1] when the graph has fewer than n lines. Color[n, x,x,x] keeps going without crash. Suggestion?

' Postpone redrawing until done
'
PostponeRedraw()
Color(1,255,0,0)
Color(2,255,0,0)
Color(3,0,0,255)
Color(4,0,0,255)
Color(5,0,128,0)
Color(6,0,128,0)
Color(7,255,128,0)
Color(8,255,128,0)
Color(9,128,0,0)
Color(10,128,0,0)
Color(11,128,128,255)
Color(12,128,128,255)
'Color(13,0,255,0)
'Color(14,0,255,0)
'Color(15,255,0,255)
'Color(16,255,0,255)
'Color(17,0,255,255)
'Color(18,0,255,255)
'Color(19,255,255,0)
'Color(20,255,255,0)

'set all line widths to 0.020"
LineWidth(-2,20)

'make odd numbered lines solid
'and even numbered lines dashed
LineType(1,1)
LineType(2,5)
LineType(3,1)
LineType(4,5)
LineType(5,1)
LineType(6,5)
LineType(7,1)
LineType(8,5)
LineType(9,1)
LineType(10,5)
LineType(11,1)
LineType(12,5)
'LineType(13,1)
'LineType(14,5)
'LineType(15,1)
'LineType(16,5)
'LineType(17,1)
'LineType(18,5)
'LineType(19,1)
'LineType(20,5)
'
'Now redraw the plot:
'
ViewRedraw()

Posted: Mon Jul 11, 2011 4:44 pm
by DPlotAdmin
Whoa, now! I cause enough crashes without calling a legitimate error message a crash! :D

It bothers me a bit that Color and LineType aren't consistent and I'll likely change this. In the meantime you can get around the error message by setting the maximum number of curves to the largest curve index you'll use in your macro. (Double click on the Max Size area of the status bar).

Posted: Mon Jul 11, 2011 6:03 pm
by James Gran
Sorry to have overstated the severity of the problem. My work-around is to Redraw after the error message.

Posted: Fri Jul 15, 2011 11:23 am
by James Gran
2.3.1.6 fixed this problem. Thanks.