70000162 Methods to add more vdraw primitives

Article 70000162
Type Wish
Product WebJS
Version 7001
Date Added 11/16/2014 12:00:00 AM
Fixed (11/26/2014 12:00:00 AM)
Submitted by Nick Willis

Summary

Methods to add more vdraw primitives.

Solution

In version 7002.0.5 new functions were added in web library. Using those functions the user can create filled 2D curves with hatch properties, as well as use thickness in order to convert 2D curves to 3D.

AddRect(object point1, object point2, bool drawit)

Adds a new vdRect in the document.

  • point1: The first point of the vdRect.
  • point2: The second point of the vdRect
  • drawit: Defines if the vdPolyline object will be drawn right after inserted or it will be drawn next time the whole document is redrawn.
Returns the vdRect object created.

createNewColor(string Parameter)

Creates a new vdColor object.

  • Parameter: A string parameter that defines what kind of vdColor object will be created. There are four possible vdColors you can create. 1. For an RGBA color object simply pass the four values seperated by comma in a single string ("255,100,0,255"). 2. To use one of the colors in the pallette, simply insert a number up to 254 ("134"). 3. To use the layer's color insert the bylayer string ("bylayer"). 4. Finally to use the byblock color type insert a byblock string ("byblock").
Returns the created color or a "bylayer" color as default.

SetActiveThickness(double thickness)

Sets the active thickness value. This property gives all imported curves a stretch on Z axis.

  • thickness: A numeric value to set thickness.

SetActiveHatchProperties(object hatchProperties)

Sets the active HatchProperties to the specified object.

  • hatchProperties: A vdHatchProperties object.

createNewHatchProperties(object HatchPatternName, object FillBkColor, object FillColor)

Creates a new vdHatchProperties object. After that, all created curves will have the active hatch.

  • HatchPatternName: A string of the name of the HatchPattern to be used. Check this for possible values vdConst.FillModeSolid.
  • FillBkColor: The hatch's background color, you could use the vdConst.createNewColor function in order to make a color easily.
  • FillColor: The hatch's front color, you could use the vdConst.createNewColor function in order to make a color easily.
The created object.

Example of use

     var vdcanvas = vdmanager.vdrawObject('canvas');
     var BkColor = vdConst.createNewColor("0,0,0,0"); //transparent
     var FillColor = vdConst.createNewColor("byblock");
     var hPatrn = vdcanvas.createNewHatchProperties(eval(param), BkColor, FillColor);
     vdcanvas.SetActiveHatchProperties(hPatrn);
     vdcanvas.AddRect(vdgeo.newpoint(-10, -10, 0), vdgeo.newpoint(-10, -10, 0), true);

Send comments on this topic.