70001653 Get Entity ECSMatrix and transform a point with it

Article 70001653
Type Wish
Product WebJS
Version 8003
Date Added 12/13/2019
Fixed 8.8004.0.2 (12/16/2019)
Submitted by Bogumil Styczen


I would like to be able to get the entity ECSMatrix and transform a point with it.


In version 8004.0.2 two new methods have been exported in order to be able to get the ECSMatrix of an entity and transorm a point with it.
The two methods are GetEntityECSMatrix(object entity): Gets the matrix which is used to transform vectors or points from the object's coordinate system (OCS) to the World Coordinate System (WCS).
matrixtransform(object matrix, object pt): Transforms the passed point with a matrix.

Example: We create a block and a circle on [0,0,0]. We add the circle in the entities of the block and before we insert it we transform the center point of the circle.

   var blk = vdcanvas.AddBlock("myblock");
   var circle = vdcanvas.AddCircle(vdgeo.newpoint(0, 0, 0), 5, false, blk.Entities); 
   vdcanvas.scriptCommand.blockref('myblock', [[5, 5, 0], 1.0, 0.0], actionentityaddedblk); 
    function actionentityaddedblk(vdraw, entity) {
        var ecs = vdraw.GetEntityECSMatrix(entity);
        var pt =  vdgeo.matrixtransform(ecs,entity.InsertionPoint);
        vdraw.AddBlockSymbol("myblock", [0,0,0], 1, 0, true, null);

Send comments on this topic.