Method line
- Namespace
- vdWebLibrary
- Assembly
- JsPropertiesExtractor.dll
line(object[], ScriptEntityDelegate)
Add a line to the document. Check the function finished throw the passed callback delegate
public void line(object[] parameters, ScriptEntityDelegate callback)
Parameters
parametersobject[]A array of parameters in the following order, used for no user action. 1.Start point as an array of 3 numbers(X,Y,Z) 2.End point as an array of 3 numbers(X,Y,Z)
callbackScriptEntityDelegateA user function of ScriptEntityDelegate type, that will be called when the command finish.It can be ignored.
Examples
vdrawobj.scriptCommand.line(); // begins a user action to draw a line
// draw a line using active color , linetype,layer etc properties, from 1,1 to 2,2
//after this command is finished the object is not drawn on screen.
//You can call the vdrawObj.redraw after adding an amount of commands
vdrawobj.scriptCommand.line([[1,1,0],[2,2,0]]);
setTimeout(vdrawObj.redraw);//post a redraw command
// draw a line using active color , linetype,layer etc properties, from 1,1 to 2,2
//after this command is finished the object is not drawn on screen.
//In order to display it call vdrawObj.DrawEntity and inside the user define callback .See example.
function actionentityadded(vdraw, entity) {
vdraw.DrawEntity(entity);
setTimeout(vdraw.Refresh);//post a refresh command
}
vdcanvas.scriptCommand.line([[1, 1, 0], [2, 2, 0]], actionentityadded);
vdcanvas.scriptCommand.line([[1, 1, 0], [3, 1, 0]], actionentityadded);
Remarks
if passed parameters not exist or it is null then start a new user action and prompts the user to draw a line. If parameters are not null then a new line is added synchronously depend on the passed parameters. The command add the action to undo history and also to script lines getCommands() If parameters are not null and after this command is finished the object is not drawn on screen In order to display it call DrawEntity(object, object, int) and Refresh() inside the user define callback .See example.