Jump to content
Developer Wiki and Function Reference Links ×

Matrix Multiplication


Recommended Posts

In the function list in Vectorworks there are the commands CE_TransformVector and CE_invTransformVector. They appear to be meant to transform a vector using a matrix (Matrix multiplication). It also says it requires the Handle of the transformation matrix (But I don't know how I can get the handle of a matrix).

 

Has anybody ever used these commands? I can't find anything about them online. I think this might be quite a useful feature if it would be working somehow.

Link to comment

I don't know what it is called but I mean the little command library that you open when you press the first button at the top left within the VS Script interface (Im using VW 2023).

In the category Miscellaneous there is

CE_TransformVector(h: HANDLE; VAR dx: REAL; VAR dy: REAL; VAR dz: REAL);

with the description: 'Transforms a vector using h TransformMatrix'

Maybe it doesn't exist in VW 24

Link to comment

I do not see those items in the stock VW2024.

 

In the Miscellaneous category of the Script Editor window I do see a number of CW_ functions, but none related to matrices.

 

I know the Computerworks (the German distributor) often prefixes their commands CW_

 

My guess is the CE_ is something similar and is not provided by Vectorworks directly but rather by the localizer or some other other source.

 

CE_ may very well be Computer Express who I believe is the Swiss distributor.

 

There is not a Miscellaneous category in the stock Function Reference documentation.

Link to comment

There only are if they have developed them themselves based on some need in their localized content.

 

Anyone can extend Vectorscript by writing a VWLibrary extension.

 

How you would do that beyond the fact that I believe it requires SDK programming is beyond me.

 

There is a CWLibraryUniversal1.vwlibrary that is included in my version of VW. Probably due to the fact that the the Stair tool (and others) are actually CW code that has been licensed back to VW for inclusion in the base version of VW.

  • Like 1
Link to comment

The command must be distributor specific. I just placed your command as you defined it in a simple script and got the following syntax error:

 

Line #10:      CE_TransformVector(H, dx, dy, dz);
                               |
                            { Error: Identifier not declared. }

 

The same error appears in VW 2023 and 2024.

 

Raymond

Link to comment

@FMA,

   Assuming it does exist on your machine, why not try to use it to see what it does?

 

1) Draw an object. Start simple (line, rect, poly, text, etc.) and work your way up to more complicated objects (symbol, extrude, PIO, etc.)

 

2) Create a script.

PROCEDURE xxx;
VAR
	dx, dy, dz :Real;
BEGIN
	CE_TransformVector(FSActLayer, 1, 1, 1);
	SysBeep;
END;
Run(xxx);

 

3) If it compiles, select one of your objects and run the script.

 

4) If it doesn't compile, try:

PROCEDURE xxx;
VAR
	dx, dy, dz :Real;
	V :Vector;
BEGIN
	V := CE_TransformVector(FSActLayer, 1, 1, 1);
	Message(V);
	SysBeep;
END;
Run(xxx);

 

5) If you do get it to compile, try changing the constants for dx, dy, and dz and rerun the script to see what happens. Try (1,0,0), (1,1,0), (1,0,1), (2,1,1); (1,2,1); (1,1,2); etc. 

 

6) Write back if you find anything interesting. 

 

Raymond

 

 

Link to comment

I think the correct way to go about this would be:

 

PROCEDURE xxx;
VAR
	dx, dy, dz :Real;
BEGIN

	dx:= 2;
	dy:= 4;
	dz:= 6;
	
	CE_TransformVector(FSActLayer, dx, dy, dz);
	
	message(dx, dy, dz);
	
	SysBeep;
	
END;
Run(xxx);

 

I think the function is supposed to take a coordinate and multiply it with a transformation matrix, the return values will be the new coordinate.

However I have tried all kinds of objects, layers etc and the output values always remain the same. I don't know how to get a handle to the matrix.

There is a bunch more functions in the category but none of them appear to work with matrices:image.png.f98b2cbce47900d4c5a25ce42c48c539.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...