How to use Graphic Plus
Graphic Plus uses a design pattern based on additively building up graphics on top of geometry. The toolkit is designed to allow for quick visualization of geometry through graphically rich construction of drawings depending on the number of modifiers applied to a piece of geometry.
The simplest way to use the component is to plug geometry directly into the Shapes (S) input. These will automatically have a black outline and transparent fill applied. For single paths, any curve can be used. For compound paths a Brep or Mesh can be used. The naked boundaries of this geometry will be extracted to define the compound shape.
Only the X and Y coordinates are used to create drawings. All geometry should sit on the XY plane. Geometry can be 3d, but the Z value will be ignored "flattening" the geometry.
Adding Graphical Modifiers to geometry changes the appearance of previewed or saved drawings. These are applied individually to geometry, but multiple geometry can be modified at once. When a graphic is applied the geometry is converted over to a Shape object. The Solid Fill component changes the closed curves fill color, but does not alter the default stroke.
Modifying a Shape, rotating, scaling, etc. will revert it back to geometry and remove any graphics. All graphics should be applied immediately prior to constructing a drawing.
Adding a Stroke modifier can change just the Color or any of the stroke properties. Any inputs left empty will not be updated, but will keep the Shape's current settings. In this way certain graphic properties will can be selectively modified.
Note that adding a Stroke modifier does not change the Shape's Fill. Graphics and effects are compounded on one another and only change their specific properties. The order in which these are applied does not matter.
Graphic Plus supports two basic effects at this time, Blur and Drop Shadow. These can be added to a Shape in the same way Graphics are added.
Text shapes, still experimental, are created from a Plane which sets the object position / rotation and Text (string) which sets the contents. A Text Shape can be modified with the Font component to set the Font Styling.
Drawings can be saved to files through the Viewer UI or programmatically. Exported content is a best match to what is previewed in the viewer, but may be a little off.
To do a quick save of a preview raster image or vector SVG. Simply right click at the top of the component and choose Save Image to save a raster file (Bmp, Jpeg, Png) or choose Save SVG to save a graphical vector SVG file. This will open a standard windows Save Dialog.
The Save SVG and Save Image components can also be used to write files directly from Grasshopper with no dialog. If the Save (S) input is set to true, the file can be continuously overwritten, or multiple files can be saved automatically by just adding an iterative / different name.
Arbitrary data can be added to shapes as key / value pairs using the Shape Data Component.
This data is only accessible in the SVG output when an SVG file is saved and opened in a browser.
If the Hover (H) input is set to true, the data will show up as a tooltip.
The data is also written to the SVG element as a
data-property and if Hover is true, the data is written to the title.
points="373.2735 22.5 257.8034 222.5 488.7436 222.5 373.2735 22.5 "
Shape | Triangle
Closed | True
Length | 692.820323
Area | 23094.010768
If a Hyperlink is added with the Shape Link component, the element can be clicked on to open a hyperlink.