Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developer:rhpicture:gdipen [2016/04/07]
sandy
developer:rhpicture:gdipen [2016/04/07] (current)
sandy
Line 30: Line 30:
   * Dash Patterns in conjunction with Compound Pens   * Dash Patterns in conjunction with Compound Pens
  
-\\ 
  
-Most of these properties are self-evident and need little elaboration. However, the lack of predefined enumerations in VBScript requires us to specify these as integers, which is not self-documenting. Note that you do not need Pen objects to draw lines in the RhPicture plug-in. Every method that takes a Pen object is overloaded and can be called with a color and optional width parameter. ​This should be sufficient ​in most cases and makes a much simpler code:+Most of these properties are self-evident and need little elaboration. However, the lack of predefined enumerations in VBScript requires us to specify these as integers, which is not self-documenting. Note that you do not need Pen objects to draw lines in the RhPicture plug-in. Every method that takes a Pen object is overloaded and can be called with a color and optional width parameter. ​In most cases this should be sufficient and makes a much simpler code:
  
   Dim RhPicture : Set RhPicture = Rhin.GetPluginObject("​RhPicture"​)   Dim RhPicture : Set RhPicture = Rhin.GetPluginObject("​RhPicture"​)
Line 46: Line 45:
   Call RhPicture.DrawLine(Array(10,​30),​ Array(40,​10),​ PenObj)   Call RhPicture.DrawLine(Array(10,​30),​ Array(40,​10),​ PenObj)
  
-Note that you can store any number of Pen objects in your script and you can reuse them as often as you like. Pen objects are not bound to the RhPicture instance that created them and you can use them on any RhPicture object. There are two Pen creation methods available, the first one of which is overloaded:+You can store any number of Pen objects in your script and you can reuse them as often as you like. Pen objects are not bound to the RhPicture instance that created them and you can use them on any RhPicture object. There are two Pen creation methods available, the first one of which is overloaded:
  
   RhPicture.CreatePen(Color As GDIColor) As GDIPen   RhPicture.CreatePen(Color As GDIColor) As GDIPen
Line 96: Line 95:
 =====Dash patterns explained===== =====Dash patterns explained=====
  
-In GDI+ (and almost everywhere else as well), dash patterns are defined as a series of gaps and dashes, whose length is relative to the width of the pen. The illustration below shows the Dash coordinate system of a Pen object. The width of this Pen object is 5 pixels and the perpendicular lines are the unit-divisors,​ each spaced 5 units apart along the spline of the Pen object:+In GDI+ (and almost everywhere else), dash patterns are defined as a series of gaps and dashes, whose length is relative to the width of the pen. The illustration below shows the Dash coordinate system of a Pen object. The width of this Pen object is 5 pixels and the perpendicular lines are the unit-divisors,​ each spaced 5 units apart along the spline of the Pen object:
  
 {{:​legacy:​en:​RhPicture_PenCoordinateSystem.png}} {{:​legacy:​en:​RhPicture_PenCoordinateSystem.png}}
Line 130: Line 129:
 =====Compound pens explained===== =====Compound pens explained=====
  
-Compounds ​can be best explained as perpendicular Dash patterns. Instead of drawing a succession of dashes along the line, a compound Pen object draws a number of parallel strands. Compounds are defined in much the same way as Dash patterns:+Compounds ​are best explained as perpendicular Dash patterns. Instead of drawing a succession of dashes along the line, a compound Pen object draws a number of parallel strands. Compounds are defined in much the same way as Dash patterns:
  
   Dim RhPicture : Set RhPicture = Rhino.CreateObject("​RhPicture"​)   Dim RhPicture : Set RhPicture = Rhino.CreateObject("​RhPicture"​)
developer/rhpicture/gdipen.txt ยท Last modified: 2016/04/07 by sandy