70000924 User commands to add line polyline arc rect etc

Article 70000924
Type Wish
Product WebJS
Version 7009
Date Added 11/3/2016 12:00:00 AM
Fixed 7.7010.0.3 (12/8/2016 12:00:00 AM)
Submitted by VectorDraw Team

Summary

User commands to add line polyline arc rect etc

Solution

In version 7010.0.3 new object property scriptCommand was added in vdrawObj canvas control
var scritptObject = vdcanvas.scriptCommand;
Before call any method of this property make sure that a document is selected by vdcanvas.SelectDocument
When a new document selected by vdcanvas.SelectDocument the scriptCommand will reference to a new empty ScriptCommands object

See the vdWebLibrary.chm help file, for ScriptCommands for all methods and properties expoted.

The ScriptCommands return by vdcanvas.scriptCommand, represents an object that exports commands which are support Undo History and exporting to Script
Follow list of methods and properties


Enable / Disable the writing to script commands buffer
bool enableScript(bool bEnable)

Returns true is script is enable else false
bool isActive()

Returns the current script command buffer
string[] getCommands()

Clear the script command buffer.
clearCommands()

Parse the passed command buffer.
If the passed commands are undefined the it parses the active script command buffer
parseCommands(string[] commands)

Begin/Close a group of commands in order to be undo or redo with one single action.
undogroup(string value)

Clears - Empty the Active selection. ,
clearSelection()

Add passed entities to default active selection
select(object[] entities, ScriptSelectDelegate callback)

Returns an array copy of the active selected entities. ,
object[] ActiveSelection()

Erase the default active selection entities, and clear the ActiveSelection by calling the clearSelection method. It also write to and script buffer
erase()

move the passed entities from a point in worldcs to an other in worldcs. It also write to and script buffer
move(object fromPoint, object toPoint, ScriptSelectDelegate callback)

scale the passed entities by a point reference in worldcs. It also write to and script buffer
scale(object originPoint, double scaleFactor, ScriptSelectDelegate callback)

rotate the passed entities around a point reference in worldcs with passed angle in radians. It also write to and script buffer
rotate(object originPoint, double rotation, ScriptSelectDelegate callback)

Copy the passed entities from a point in worldcs to an other in worldcs. It also write to and script buffer
copy(object fromPoint, object toPoint, ScriptSelectDelegate callback)

Set the passed layer name as active.
Commands that create new objects like add the created entities to that layer.
layer(string name)

Set the passed layout name as active.
Commands that create new objects like add the created entities to that layout.
layout(string name)

Selects the passed color as active.
Commands that create new objects like set the color of created entities to that color.
color(string colorstring)

Set the passed linetype name as active.
Commands that create new objects like select this linetype for the created entities.
linetype(string name)

Set the passed lineweight as active.
Commands that create new objects like select this lineweight for the created entities.
lineweight(double nvalue)

Set the passed linetypescale as active.
Commands that create new objects like select this linetypescale for the created entities.
ltscale(double nvalue)

Set the passed textvalue as active tooltip for the new added entities
tooltip(string textvalue)

Set the passed penwidth as active.
Commands that create new objects like select this penwidth for the created entities.
penwidth(double nvalue)

Set the passed thickness value as active.
Commands that create new objects like select this thickness for the created entities and will be drawn extruded to their extrusion vector.
thickness(double nvalue)

Select active hatch properties for hatched filled objects.
hatch(string HatchPatternName, string FillBkColor, string FillColor, double hatchscale, double hatchangle)

Set the passed textstyle name as active.
Commands that create new text objects like select this textstyle for created entities.
textstyle(string name, double height, string horjustify, string verjustify)

Add a line to the document.
line(object[]parameters, ScriptEntityDelegate callback)

Add a polyline to the document.
polyline(object[]parameters, bool closed, int splineflag, ScriptEntityDelegate callback)

Add a circle to the document.
circle(object[] parameters, ScriptEntityDelegate callback)

Add an arc to the document.
arc(object[] parameters, ScriptEntityDelegate callback)

Add a rect to the document.
rect(object[] parameters, ScriptEntityDelegate callback)

Add a text to the document.
text(string textstring, object[] parameters, ScriptEntityDelegate callback)

Add a block reference to the document.
block(string blockname, object[] parameters, ScriptEntityDelegate callback)

Add an image reference to the document.
image(string imagename, object[] parameters, ScriptEntityDelegate callback)

Undone the last item stored in the undo list and the last command in script buffer.If an end group item is last then undone all items of the group in undo history.
undo()

Redone the last item stored in the redo list and the last command in script buffer.If a start group item is last then redones all items of the group in redo history.
redo()

Send comments on this topic.