Objects used in Macro programming

Top | Previous | Next

 

The text generated by JS Macro program may require the inclusion of information about the base point of the JS Macro program, about the orientation, etc. A Macro object is provided for this purpose, whose methods and various properties can be used to place that data at the required location in the Front-End program being generated.

 

MicrosoftTeams-image

 

 

Below is a description of the essential properties of the Macro object. Some properties have been omitted from this description and a full description of the methods and data can be found in the description of the Macro API user interface, which is available here:

 

C:\Users\Public\Documents\Woodwork for Inventor\2022\v13\SDK\Macro\Woodwork for Inventor Macro API Help.chm

 

hmtoggle_plus1Macro.Name

 

Returns the name of Macro.

 

 

hmtoggle_plus1Macro.BodyName

 

Returns the name of the sculpt body with which the given Macro was associated.

 

 

hmtoggle_plus1Macro.RefrenceCoordinateSystem

 

Macro.ReferenceCoordinateSystem.<Coordinate system setup methods> sets the reference coordinate system. All coordinate and direction vector queries in the following program commands are returned in the specified reference coordinate system. The method functions on a modal basis. The defined reference coordinate system is valid until otherwise specified. Methods that allow control of the setting of the reference coordinate system::

 

SetToClamping()

Sets the reference coordinate system to the clamping coordinate system of the workpiece.

 

AlignTo (<wVector Xaxis>, <wVector Yaxis>)

Orientates the reference coordinate system according to two vectors given as method arguments. The first vector corresponds to the direction of the X-axis, the second to the Y-axis. The vectors need not be perpendicular to each other, but cannot be collinear. The vectors are expressed in the last reference coordinate system.

 

SetNewOrigin (<wVector ShiftVector>)

Shifts the current reference coordinate system over the specified vector.

 

SetToSide()

Sets the reference coordinate system to the plane of operation.

 

SetToAlignedSide()

Sets the reference coordinate system to the plane of operation and rotates it so that it coincides with the X-axis of the Macro coordinate system.

 

SetToMacro()

Sets the Macro coordinate system as the reference coordinate system.

 

 

 

Example:

 

//Modifies W4INV Clamping Coordinate system to Woodwop 000 Coordinate system by shfting it from top to bottom of workpiece

Macro.ReferenceCoordinateSystem.SetToClamping();

 

var oversize = Macro.Workpiece.Oversize;

var ShiftByX=-oversize.MinusX-oversize.Sizing;

var ShiftByY=-oversize.MinusY-oversize.Sizing;

 

//Creates Shifting Vector for Reference Coordinate system. 

//Vector counts Reference Coordinate shifting from Top to Bottom of Workpiece and shifting because oversize of Workpiece.

 

var ShiftVector = new wVector(ShiftByX,ShiftByY, -Macro.Workpiece.Thickness);

 

Macro.ReferenceCoordinateSystem.SetNewOrigin(ShiftVector);

 

//From this point on the program, all coordinates are given in the offset Reference Coordinate System

 

hmtoggle_plus1Macro.Workpiece

 

Macro.Workpiece.<Property Name> - returns the parameters of the workpiece to which the given Macro processing is applied

 

Type

Types of the processing workpiece:

 

Part
PartWithoutCovers
PartWithOnlySideCovers
PartWithOnlyTopBotomCovers
Workpiece
WorkpieceWithOversize
WorkpieceWithOversizeandTopBottomCovers
WorkpieceWithTopBottomCovers

 

Length

workpiece length

 

Width

workpiece width

 

Thickness

workpiece thickness

 

Oversize.PlusX

workpiece oversize in +X direction

 

Oversize.MinusX

workpiece oversize in -X direction

 

Oversize.PlusY

workpiece oversize in +Y direction

 

Oversize.MinusY

workpiece oversize in -Y direction

 

Oversize.PlusZ

workpiece oversize in +Z direction

 

Oversize.MinusZ

workpiece oversize in -Z direction

 

Oversize.Sizing

Oversize sizing

 

 

hmtoggle_plus1Macro.Side

 

Macro.Side.<Property Name> - returns the properties of the plane coordinate system in which the JS Macro operation itself is placed. .

 

All coordinates and vectors are returned in the current ReferenceCoordinateSystem.

 

Origin.<Property>


Returns the coordinate system data of the plane in which the given Macro resides.

 

 

Point

Coordinates of the origin. wPoint type coordinate array.

For example, the X coordinate is accessed through the following expression: Macro.Side.Origin.Point.X

 

 

XAxis

A vector normalised to the X-axis defining the orientation of the plane. wVector type coordinate array..

 

 

YAxis

A vector normalised to the Y-axis defining the orientation of the plane. wVector type coordinate array.

 

 

ZAxis

A vector normalised to the Z-axis defining the orientation of the plane. wVector type coordinate array.

 

Type

 

Returns plane type. Available types:

 

Top

0

The top side.

Bottom

1

The bottom side.

Front

2

The front side

Back

3

The back side.

Left

4

The left side.

Right

5

The right side.

Custom

6

The free oriented in space side

 

hmtoggle_plus1Macro.AlignedSide

 

Macro.AlignedSide.<Property Name> - returns the properties of the plane coordinate system in which the Macro operation itself is placed. The coordinate system is always oriented in the same way as the Macro coordinate system itself..

 

All coordinates and vectors are returned in the current ReferenceCoordinateSystem.

 

Origin.<Property>


Returns the coordinate system data of the plane in which the given Macro resides.

 

 

Point

Coordinates of the origin. wPoint type coordinate array.

For example, the X coordinate is accessed through the following expression: Macro.Side.Origin.Point.X

 

 

XAxis

A vector normalised to the X-axis defining the orientation of the plane. wVector type coordinate array.

 

 

YAxis

A vector normalised to the Y-axis defining the orientation of the plane. wVector type coordinate array.

 

 

ZAxis

A vector normalised to the Z-axis defining the orientation of the plane. wVector type coordinate array.

 

Type

 

Returns plane type. Available types:

 

Top

0

The top side.

Bottom

1

The bottom side.

Front

2

The front side

Back

3

The back side.

Left

4

The left side.

Right

5

The right side.

Custom

6

The free oriented in space side

 

 

hmtoggle_plus1Macro.Origin

 

Returns Macro coordinate system properties in the current ReferenceCoordinateSystem.

 

Point

Coordinates of the origin of the Macro coordinate system.

XAxis

A vector normalised to the X-axis defining the Macro coordinate system. wVector type coordinate array.

YAxis

A vector normalised to the Y-axis defining the Macro coordinate system. wVector type coordinate array.

ZAxis

A vector normalised to the Z-axis defining the Macro coordinate system. wVector type coordinate array.

GetRotationAngle

The method returns the Macro’s rotation angle in its plane (side) coordinate system.