VS:Get3DInfo

From Vectorworks Developer
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure Get3DInfo returns the height, width and depth values of the referenced 3D object.
PROCEDURE Get3DInfo(
h  :HANDLE;
VAR height  :REAL;
VAR width  :REAL;
VAR depth  :REAL);
def vs.Get3DInfo(h):
    return (height, width, depth)

Parameters

h HANDLE Handle to 3D object.
height REAL Height of object.
width REAL Width of object.
depth REAL Depth of object.

Remarks

The "height, width, depth" order of the parameters in this call is misleading. The call returns delta-Y, delta-X and delta-Z IN THAT ORDER. Screwy, I know. The example is not a good one because it makes no use of the X and Y data.

Example

VectorScript

PROCEDURE IncreaseExtr;
{This script increases extruded objects in the selection by a user requested value.}
{by Paolo, on the VectorScript bulletin board}
VAR
oggetto :HANDLE;
increaseValue :REAL;

FUNCTION Increase(h :HANDLE) :BOOLEAN;
VAR
height, width, depth :REAL;
xRot, yRot, zRot :REAL;
p0X, p0Y, p0Z :REAL;
p1X, p1Y, p1Z :REAL;
result, isMirroredXY :BOOLEAN;
BEGIN
{check if the obj is an extrusion}
IF (GetType(h) = 24) THEN BEGIN
result := Get3DOrientation(h, xRot, yRot, zRot, isMirroredXY);
Get3DCntr(h, p0X, p0Y, p0Z);

SetRot3D(h, 0, 0, 0, 0, 0, 0);
{here depth = extrusion value}
Get3DInfo(h, height, width, depth);

{I increase the depth}
SET3DInfo(h, height, width, depth + increaseValue);

SET3DRot(h, xRot, yRot, zRot , 0,0,0);

Get3DCntr(h, p1X, p1Y, p1Z);

{move of the misplacement p0-p1}
Move3DObj(h, p0X-p1X, p0Y-p1Y, p0Z-p1Z);
Get3DCntr(h, p1X, p1Y, p1Z);
END;
increase := FALSE;
END;

BEGIN
{ask the value to increase}
increaseValue := RealDialog('Increase extrusions in the selection of this value','10');
{apply to the selected set of objects}
ForEachObjectInList(increase, 2, 0, oggetto);
END;
RUN(IncreaseExtr);

Python

def Increase( h ):
#{check if the obj is an extrusion}
	vs.Message(increaseValue )
	if (vs.GetType(h) == 24):
		
		result, xRot, yRot, zRot, isMirroredXY = vs.Get3DOrientation(h)
		p0, p0Z = vs.Get3DCntr(h)

	
		vs.SetRot3D(h, 0, 0, 0, 0, 0, 0)
		#{here depth = extrusion value}
		height, width, depth = vs.Get3DInfo(h)

		#{I increase the depth}
		vs.Set3DInfo(h, height, width, depth + increaseValue)

		vs.Set3DRot(h, xRot, yRot, zRot , 0,0,0)

		p1, p1Z = vs.Get3DCntr(h)

		#{move of the misplacement p0-p1}
		vs.Move3DObj(h, p0[0]-p1[0], p0[1]-p1[1], p0Z-p1Z)
		p1, p1Z = vs.Get3DCntr(h)

	increase = False
	
def IncreaseExtr():
	#{This script increases extruded objects in the selection by a user requested value.}
	#{by Paolo, on the VectorScript bulletin board}
	#{ask the value to increase}
	global increaseValue 
	increaseValue = vs.RealDialog('Increase extrusions in the selection of this value','10')
	vs.Message(increaseValue )
	#{apply to the selected set of objects}
	vs.ForEachObjectInList(Increase, 2, 0, vs.FObject())

increaseValue = 0
IncreaseExtr()

Version

Availability: from All Versions
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox