%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
image Method
See Also  Example
vdWebLibrary Namespace > ScriptCommands Class : image Method
imagename
The name of an existing image in the GetImages . -or- a new table name that will be used for the new added image from the passed urlpath Required.
urlpath
The path from which the image will be loaded -or- an empty string if an existing image will be used.
parameters
An array of parameters in the following order, used for no user action. 1.Insertion point in world coordinate system, as an array of 3 numbers(X,Y,Z) 2.Image size in drawing units 2.Rotation angle in radians
callback
A user function of ScriptEntityDelegate type, that will be called when the command finish successfully.It can be ignored.
Add an image reference to the document.

Syntax

JScript 
public function image( 
   imagename : String,
   urlpath : String,
   parameters : Object[],
   callback : ScriptEntityDelegate
);

Parameters

imagename
The name of an existing image in the GetImages . -or- a new table name that will be used for the new added image from the passed urlpath Required.
urlpath
The path from which the image will be loaded -or- an empty string if an existing image will be used.
parameters
An array of parameters in the following order, used for no user action. 1.Insertion point in world coordinate system, as an array of 3 numbers(X,Y,Z) 2.Image size in drawing units 2.Rotation angle in radians
callback
A user function of ScriptEntityDelegate type, that will be called when the command finish successfully.It can be ignored.

Example

C#Copy Code
             
vdrawobj.scriptCommand.image('VectorDraw'); // begins a user action to add an existing image, reference to image with name 'VectorDraw'
C#Copy Code
// Inserts a new image in the document  using active , color , linetype,layer etc properties,  reference to image with name 'VectorDraw',  insertion point 2,2  Size 2 and rotation angle 45 degrees 
//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.image('VectorDraw', '',[[2,2,0],2.0, vdgeo.DegreesToRadians(45)]);  
setTimeout(vdrawObj.redraw);//post a redraw command
C#Copy Code
// Inserts a new image in the document  using active , color , linetype,layer etc properties,  reference to image with name 'VectorDraw',  insertion point 2,2  Size 2 and rotation angle 45 degrees 
//after this command is finished the object is not drawn on screen. 
In order to display it call vdrawObj.DrawEntity and <see cref="M:vdWebLibrary.vdrawObj.Refresh"/>  inside the user define callback .See example. 
 
function actionentityadded(vdraw, entity) { 
   vdraw.DrawEntity(entity); 
   setTimeout(vdraw.Refresh);//post a refresh command 

vdrawobj.scriptCommand.image('VectorDraw','', [[2,2,0],2.0, vdgeo.DegreesToRadians(45)] , actionentityadded);

Remarks

if passed parameters not exist or it is null then start a new user action and prompts the user to draw a image reference. If parameters are not null then a new image reference 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 and Refresh inside the user define callback .See example.

See Also