Skip to main content

Shape

Shape

This file contains shape functionality you can create / delete shape, add edges to shape etc...

BwApiShapeCreate

Creates a new shape and adds it to the current garment.

Python

BwApi.ShapeCreate(garmentId)

C++

BwApiShapeCreate(garmentId, newShapeId);

C#

BwApi.ShapeCreate(garmentId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

Out

newShapeId

The ID of the newly created shape.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: When creating a shape the rotate value is equal to 0 degrees unlike the UI where the value is 90 degrees.

---

BwApiShapeDelete

Deletes a shape.

Python

BwApi.ShapeDelete(garmentId, shapeId)

C++

BwApiShapeDelete(garmentId, shapeId);

C#

BwApi.ShapeDelete(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

The ID of the shape to delete.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Removing the parent shape will delete all its symmetry shapes.

---

BwApiShapePropertiesGet

Get a shape's properties.

Python

BwApi.ShapePropertiesGet(garmentId, shapeId)

C++

BwApiShapePropertiesGet(garmentId, shapeId, shapeProperties);

C#

BwApi.ShapePropertiesGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

shapeProperties

JSON object as a string that represents a shape object (see shape_properties.json schema).

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapePropertiesSet

Set a shape's properties.

Python

BwApi.ShapePropertiesSet(garmentId, shapeId, shapeProperties)

C++

BwApiShapePropertiesSet(garmentId, shapeId, shapeProperties);

C#

BwApi.ShapePropertiesSet(garmentId, shapeId, shapeProperties);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

shapeProperties

JSON object as a string that represents a shape object (see shape_properties.json schema).

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeClone

Clone a shape.

Python

BwApi.ShapeClone(garmentId, shapeId)

C++

BwApiShapeClone(garmentId, shapeId, newShapeId);

C#

BwApi.ShapeClone(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

The ID of an existing complete shape.

Out

newShapeId

The ID of the newly created shape.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: The source shape must be in a complete state (see BwApiShapeStateGet).

---

BwApiShapeCloneEx

Clone a shape - extended.

Python

BwApi.ShapeCloneEx(garmentId, shapeId, options)

C++

BwApiShapeCloneEx(garmentId, shapeId, options, newShapeId);

C#

BwApi.ShapeCloneEx(garmentId, shapeId, options);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

The ID of an existing complete shape.

In

options

The options to clone the shape (see BwApiCloneShapeOption).

Out

newShapeId

The ID of the newly created shape.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: The source shape must be in a complete state (see BwApiShapeStateGet).

---

BwApiShapeNameGet

Get a shape's name.

Python

BwApi.ShapeNameGet(garmentId, shapeId)

C++

BwApiShapeNameGet(garmentId, shapeId, shapeName);

C#

BwApi.ShapeNameGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

shapeName

Get the shape's name.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeNameSet

Set a shape's name.

Python

BwApi.ShapeNameSet(garmentId, shapeId, shapeName)

C++

BwApiShapeNameSet(garmentId, shapeId, shapeName);

C#

BwApi.ShapeNameSet(garmentId, shapeId, shapeName);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

shapeName

Set the shape's name.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeEdgeIds

Get a shape's edge IDs.

Python

BwApi.ShapeEdgeIds(garmentId, shapeId)

C++

BwApiShapeEdgeIds(garmentId, shapeId, edgeIds);

C#

BwApi.ShapeEdgeIds(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

edgeIds

Array of int containing the edge IDs.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapePoints

Get a shape's points.

Python

BwApi.ShapePoints(garmentId, shapeId)

C++

BwApiShapePoints(garmentId, shapeId, points);

C#

BwApi.ShapePoints(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

points

Array of BwApiPoint that represents all the points within the given shape.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapePointsAsBezier

Get a shape's points as Bezier.

Python

BwApi.ShapePointsAsBezier(garmentId, shapeId)

C++

BwApiShapePointsAsBezier(garmentId, shapeId, points);

C#

BwApi.ShapePointsAsBezier(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

points

Array of BwApiBezierPoint that represents all the points within the given shape.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeTransformationGet

Get a shape's transformation properties.

Python

BwApi.ShapeTransformationGet(garmentId, shapeId)

C++

BwApiShapeTransformationGet(garmentId, shapeId, transformation);

C#

BwApi.ShapeTransformationGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

transformation

Shape transformation (see BwApiShapeTransformation).

Returns: Error/success code (see BwApiErrorCodes enum).

Note: For attachments coordinates depend on the current size of garment and originate from the center of the attachment on the X/Y axis of the parent shape.

---

BwApiShapeTransformationSet

Set a shape's transformation properties.

Python

BwApi.ShapeTransformationSet(garmentId, shapeId, transformation)

C++

BwApiShapeTransformationSet(garmentId, shapeId, transformation);

C#

BwApi.ShapeTransformationSet(garmentId, shapeId, transformation);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

transformation

Shape transformation (see BwApiShapeTransformation).

Returns: Error/success code (see BwApiErrorCodes enum).

Note: For attachments coordinates depend on the current size of garment and originate from the center of the attachment on the X/Y axis of the parent shape.

---

BwApiShapeGrainLineAngleGet

Get a shape's grain line angle.

Python

BwApi.ShapeGrainLineAngleGet(garmentId, shapeId)

C++

BwApiShapeGrainLineAngleGet(garmentId, shapeId, angle);

C#

BwApi.ShapeGrainLineAngleGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

angle

Get the current grain line angle (radians).

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeGrainLineAngleSet

Set a shape's grain line angle.

Python

BwApi.ShapeGrainLineAngleSet(garmentId, shapeId, angle)

C++

BwApiShapeGrainLineAngleSet(garmentId, shapeId, angle);

C#

BwApi.ShapeGrainLineAngleSet(garmentId, shapeId, angle);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

angle

Set the grain line angle (radians).

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeSymmetryCreate

Create a new symmetry shape.

Python

BwApi.ShapeSymmetryCreate(garmentId, parentShapeId, type, edgeId)

C++

BwApiShapeSymmetryCreate(garmentId, parentShapeId, type, edgeId, newSymmetryShapeId);

C#

BwApi.ShapeSymmetryCreate(garmentId, parentShapeId, type, edgeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

parentShapeId

Existing parent shape ID, create symmetry from this shape.

In

type

Symmetry type to use (see BwApiShapeSymmetryType).

In

edgeId

Relevant only for inner symmetry (type == BW_API_SHAPE_SYMMETRY_TYPE_INNER), for other symmetry types pass -1 as the edge ID.

Out

newSymmetryShapeId

The newly created child(symmetry) shape ID, in case of inner symmetry this value will be the same as parentShapeId upon success.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: When creating inner symmetry (BW_API_SHAPE_SYMMETRY_TYPE_INNER) the order of the edges will be modified.

---

BwApiShapeSymmetryCancel

Detach the child (symmetry) shape from its parent.

Python

BwApi.ShapeSymmetryCancel(garmentId, childShapeId)

C++

BwApiShapeSymmetryCancel(garmentId, childShapeId);

C#

BwApi.ShapeSymmetryCancel(garmentId, childShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

childShapeId

Existing child(symmetry) shape ID to detach from his parent.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: This will convert symmetry shape to regular shape.

---

BwApiShapeInnerSymmetryCancel

Cancel an inner symmetry (only for parent shape).

Python

BwApi.ShapeInnerSymmetryCancel(garmentId, shapeId, keepBoth)

C++

BwApiShapeInnerSymmetryCancel(garmentId, shapeId, keepBoth);

C#

BwApi.ShapeInnerSymmetryCancel(garmentId, shapeId, keepBoth);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing symmetry shape ID.

In

keepBoth

Boolean. keep both = 1, keep half = 0.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: This will convert symmetry shape to regular shape.

---

BwApiShapeSymmetryParentGet

Get a shape's symmetry parent shape ID.

Python

BwApi.ShapeSymmetryParentGet(garmentId, childShapeId)

C++

BwApiShapeSymmetryParentGet(garmentId, childShapeId, parentShapeId);

C#

BwApi.ShapeSymmetryParentGet(garmentId, childShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

childShapeId

The ID of the child(symmetry) shape.

Out

parentShapeId

The parent shape ID for the give child(symmetry) shape ID.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeSymmetryChildGet

Get an array of a shape's symmetry children shapes.

Python

BwApi.ShapeSymmetryChildGet(garmentId, parentShapeId)

C++

BwApiShapeSymmetryChildGet(garmentId, parentShapeId, childShapeIds);

C#

BwApi.ShapeSymmetryChildGet(garmentId, parentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

parentShapeId

The ID of the parent shape.

Out

childShapeIds

Array containing all the child(symmetry) shape IDs.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeAttachmentAttach

Attach an existing shape to another shape. This will define the added shape as an attachment shape.

Python

BwApi.ShapeAttachmentAttach(garmentId, parentShapeId, drawPlace, attachmentShapeId)

C++

BwApiShapeAttachmentAttach(garmentId, parentShapeId, drawPlace, attachmentShapeId);

C#

BwApi.ShapeAttachmentAttach(garmentId, parentShapeId, drawPlace, attachmentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

parentShapeId

Existing shape ID that will be the parent of the added shape (attachmentShape).

In

drawPlace

Where to draw the attachment, on the inside or outside layer.

In

attachmentShapeId

Existing shape to be added to the parent shape as an attachment.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeAttachmentDetach

Detach an attachment shape from its parent.

Python

BwApi.ShapeAttachmentDetach(garmentId, attachmentShapeId)

C++

BwApiShapeAttachmentDetach(garmentId, attachmentShapeId);

C#

BwApi.ShapeAttachmentDetach(garmentId, attachmentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

attachmentShapeId

Existing shape ID which is defined as an attachment.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Calling this function with none attachment shape will return error.

---

BwApiShapeAttachmentDrawingPlace

Get the drawing place (inside / outside) of the given attachment shape.

Python

BwApi.ShapeAttachmentDrawingPlace(garmentId, attachmentShapeId, drawPlace)

C++

BwApiShapeAttachmentDrawingPlace(garmentId, attachmentShapeId, drawPlace);

C#

BwApi.ShapeAttachmentDrawingPlace(garmentId, attachmentShapeId, drawPlace);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

attachmentShapeId

Existing shape defined as attachment

In

drawPlace

Where attachment is drawen, on the inside or outside parent's layer.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeAttachmentIds

Get all shape's attached shape IDs.

Python

BwApi.ShapeAttachmentIds(garmentId, parentShapeId)

C++

BwApiShapeAttachmentIds(garmentId, parentShapeId, attachmentShapeId);

C#

BwApi.ShapeAttachmentIds(garmentId, parentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

parentShapeId

Existing shape ID.

Out

attachmentShapeId

Array containing all attachment shape IDs that are attached to the given parent shape ID.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeAttachmentParentGet

Get attatched shape's attachment parent shape ID.

Python

BwApi.ShapeAttachmentParentGet(garmentId, attachmentShapeId)

C++

BwApiShapeAttachmentParentGet(garmentId, attachmentShapeId, parentShapeId);

C#

BwApi.ShapeAttachmentParentGet(garmentId, attachmentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

attachmentShapeId

Existing shape to check if it's attachment or not.

Out

parentShapeId

If attachmentShapeId is attachment, return his parent shape ID otherwise return -1.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Shape turns into attachment only after calling to BwApiShapeAttachmentAttach.

---

BwApiShapeAttachment

Check if shape is attachment or not.

Python

BwApi.ShapeAttachment(garmentId, attachmentShapeId)

C++

BwApiShapeAttachment(garmentId, attachmentShapeId, attachment);

C#

BwApi.ShapeAttachment(garmentId, attachmentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

attachmentShapeId

Existing shape to check if it's attachment or not.

Out

attachment

Boolean (1/0) if the given shape ID is attachment or not.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Shape turns into attachment only after calling to BwApiShapeAttachmentAttach.

---

BwApiShapeShowIn2DGet

Check if shape is visible in the 2D window or not.

Python

BwApi.ShapeShowIn2DGet(garmentId, shapeId)

C++

BwApiShapeShowIn2DGet(garmentId, shapeId, show);

C#

BwApi.ShapeShowIn2DGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

show

1 - shape is visible, 0 - not visible.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeShowIn2DSet

Show the shape on the 2D window or not.

Python

BwApi.ShapeShowIn2DSet(garmentId, shapeId, show)

C++

BwApiShapeShowIn2DSet(garmentId, shapeId, show);

C#

BwApi.ShapeShowIn2DSet(garmentId, shapeId, show);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

show

1 - show the shape, 0 - hide the shape.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeMaterialIdGet

Get a shape's material (fabric) ID.

Python

BwApi.ShapeMaterialIdGet(garmentId, shapeId)

C++

BwApiShapeMaterialIdGet(garmentId, shapeId, materialId);

C#

BwApi.ShapeMaterialIdGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

materialId

Get shape's material ID.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeMaterialIdSet

Set a shape's material (fabric) ID.

Python

BwApi.ShapeMaterialIdSet(garmentId, shapeId, materialId)

C++

BwApiShapeMaterialIdSet(garmentId, shapeId, materialId);

C#

BwApi.ShapeMaterialIdSet(garmentId, shapeId, materialId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

materialId

Set shape's material ID.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Set material id as -1 will clear the material from the shape

---

BwApiShapeDrapingGet

Get a shape's draping properties.

Python

BwApi.ShapeDrapingGet(garmentId, shapeId, draping)

C++

BwApiShapeDrapingGet(garmentId, shapeId, draping);

C#

BwApi.ShapeDrapingGet(garmentId, shapeId, draping);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

draping

Shape's draping properties.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeDrapingSet

Set a shape's draping properties.

Python

BwApi.ShapeDrapingSet(garmentId, shapeId, draping)

C++

BwApiShapeDrapingSet(garmentId, shapeId, draping);

C#

BwApi.ShapeDrapingSet(garmentId, shapeId, draping);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

draping

Shape's draping properties.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Use BwApiShapeDrapingGet first to get the current values, update the struct with the desired changes and only then call BwApiShapeDrapingSet with the updated struct.

---

BwApiShapeStateGet

Get a shape's state.

Python

BwApi.ShapeStateGet(garmentId, shapeId)

C++

BwApiShapeStateGet(garmentId, shapeId);

C#

BwApi.ShapeStateGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Returns: Valid shape returns BW_API_ERROR_SUCCESS, if shape edges are not closed returns BW_API_ERROR_SHAPE_INCOMPLETE and if shape not found returns BW_API_ERROR_OBJECT_NOT_FOUND.

---

BwApiShapeCompare

Compare two shapes.

Python

BwApi.ShapeCompare(garmentId, shapeId1, shapeId2)

C++

BwApiShapeCompare(garmentId, shapeId1, shapeId2, equal);

C#

BwApi.ShapeCompare(garmentId, shapeId1, shapeId2);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId1

Existing shape ID.

In

shapeId2

Existing shape ID.

Out

equal

0 = shapes are not equal, 1 = shapes are equal.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeUserDataGet

Gets shape's user data that was previously stored by calling to BwApiShapeUserDataSet.

Python

BwApi.ShapeUserDataGet(garmentId, shapeId, pluginSection, key)

C++

BwApiShapeUserDataGet(garmentId, shapeId, pluginSection, key, buffer);

C#

BwApi.ShapeUserDataGet(garmentId, shapeId, pluginSection, key);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

pluginSection

Specific vendor or plugIn identifier. This key will help VStitcher retrieve the correct data for the appropriate plugin. (You can specify as many sections as needed. Section is not limited to one per vendor).

In

key

Key for a specific property (e.g. "creation date", "plugin version" etc').

Out

buffer

Allocated buffer object to fill with the data previously stored by calling to BwApiGarmentUserDataSet. The returned buffer is a copy of the stored buffer so you are expected to release the buffer when you finish to use it.

Returns: Error/success code (see BwApiErrorCodes enum). C++:

---

BwApiShapeUserDataSet

Sets a shape's user data.

Python

BwApi.ShapeUserDataSet(garmentId, shapeId, pluginSection, key, buffer)

C++

BwApiShapeUserDataSet(garmentId, shapeId, pluginSection, key, buffer);

C#

BwApi.ShapeUserDataSet(garmentId, shapeId, pluginSection, key, buffer);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

pluginSection

Specific vendor or plugIn identifier. This key will help VS retrieving the correct data for the appropriate plugin (you can specify as many sections as needed. section is not limited for one per vendor).

In

key

Key for specific property (e.g. "creation date", "plugin version" etc').

In

buffer

Buffer to store in VStitcher. VStitcher will create a copy of this buffer so you are expected to release it after calling to this function.

Returns: Error/success code (see BwApiErrorCodes enum). C++:

---

BwApiShapeUserDataStrGet

Gets shape's user data that was previously stored by calling to BwApiShapeUserDataStrSet.

Python

BwApi.ShapeUserDataStrGet(garmentId, shapeId, key)

C++

BwApiShapeUserDataStrGet(garmentId, shapeId, key, userDataStr);

C#

BwApi.ShapeUserDataStrGet(garmentId, shapeId, key);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

key

Key for specific property (e.g. "creation date", "plugin version" etc').

Out

userDataStr

The string that was stored in the user data.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeUserDataStrSet

Sets a shape's user data.

Python

BwApi.ShapeUserDataStrSet(garmentId, shapeId, key, userDataStr)

C++

BwApiShapeUserDataStrSet(garmentId, shapeId, key, userDataStr);

C#

BwApi.ShapeUserDataStrSet(garmentId, shapeId, key, userDataStr);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

key

Key for specific property (e.g. "creation date", "plugin version" etc').

In

userDataStr

The string to store in the user data.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: If userDataStr is NULL (Or None in python) then the key will be erase.

---

BwApiShapeSurfaceAreaGet

Get a shape's surface area.

Python

BwApi.ShapeSurfaceAreaGet(garmentId, shapeId, sizeId, seamAllowance, materialId)

C++

BwApiShapeSurfaceAreaGet(garmentId, shapeId, sizeId, seamAllowance, materialId, area);

C#

BwApi.ShapeSurfaceAreaGet(garmentId, shapeId, sizeId, seamAllowance, materialId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

sizeId

Size of the garment.

In

seamAllowance

1 for getting the surface area for the cut line, 0 for getting the surface area for the sew line.

In

materialId

The material ID surface we want to calc, If matrialId is -1 then return the shape surface area.

Out

area

Area of the shape

Returns: For valid shape the return value will be BW_API_ERROR_SUCCESS.

---

BwApiShapeCenterGet

Get a shape's center.

Python

BwApi.ShapeCenterGet(garmentId, sizeId, shapeId)

C++

BwApiShapeCenterGet(garmentId, sizeId, shapeId, centerX, centerY);

C#

BwApi.ShapeCenterGet(garmentId, sizeId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

sizeId

Size of the garment.

In

shapeId

Existing shape ID.

Out

centerX

The x center of the shape.

Out

centerY

The y center of the shape.

Returns: For valid shape the return value will be BW_API_ERROR_SUCCESS.

---

BwApiShapeSymmetryTypeGet

Get a shape's symmetry.

Python

BwApi.ShapeSymmetryTypeGet(garmentId, shapeId)

C++

BwApiShapeSymmetryTypeGet(garmentId, shapeId, type);

C#

BwApi.ShapeSymmetryTypeGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

type

Shape's symmetry type (see BwApiShapeSymmetryType).

Returns: Error/success code (see BwApiErrorCodes enum).

Note: From API version 2 if a shape has more than 1 type of symmetry the result will represent the bitwise result (i.e. BW_API_SHAPE_SYMMETRY_TYPE_INNER | BW_API_SHAPE_SYMMETRY_TYPE_X ).

---

BwApiShapeMaterialIds

Get a shape's materials (fabric) IDs. This function should be used when there are multiple texture on the shape (e.g: intersection fill).

Python

BwApi.ShapeMaterialIds(garmentId, shapeId)

C++

BwApiShapeMaterialIds(garmentId, shapeId, materialIds);

C#

BwApi.ShapeMaterialIds(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

materialIds

Get shape's material IDs.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeTextureOffsetGet

Get the texture offset on the given shape.

Python

BwApi.ShapeTextureOffsetGet(garmentId, shapeId, materialId, front)

C++

BwApiShapeTextureOffsetGet(garmentId, shapeId, materialId, front, offset);

C#

BwApi.ShapeTextureOffsetGet(garmentId, shapeId, materialId, front);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

materialId

Existing material ID on the shape (this can also be group item in case the texture of the shape is group material).

In

front

1 - to get the offset from the front material, 0 - for getting the offset from the back material.

Out

offset

Get shape's offset.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeTextureOffsetBySizeGet

Get the texture offset on the given shape and size.

Python

BwApi.ShapeTextureOffsetBySizeGet(garmentId, shapeId, materialId, sizeId, front)

C++

BwApiShapeTextureOffsetBySizeGet(garmentId, shapeId, materialId, sizeId, front, offset);

C#

BwApi.ShapeTextureOffsetBySizeGet(garmentId, shapeId, materialId, sizeId, front);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

materialId

Existing material ID on the shape (this can also be group item in case the texture of the shape is group material).

In

sizeId

Existing size ID (-1 to get texture offset for a current size).

In

front

1 - to get the offset from the front material, 0 - for getting the offset from the back material.

Out

offset

Get shape's offset.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeTextureOffsetSet

Set the texture offset on a shape.

Python

BwApi.ShapeTextureOffsetSet(garmentId, shapeId, materialId, front, offset)

C++

BwApiShapeTextureOffsetSet(garmentId, shapeId, materialId, front, offset);

C#

BwApi.ShapeTextureOffsetSet(garmentId, shapeId, materialId, front, offset);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

materialId

Existing material ID on the shape (this can also be group item in case the texture of the shape is group material).

In

front

1 - to set the offset of the front material, 0 - for setting the offset of the back material.

In

offset

The texture's offset.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Use BwApiShapeTextureOffsetGet first to get the current values, update the struct and only then call BwApiShapeTextureOffsetSet with the updated struct.

---

BwApiShapeTextureOffsetBySizeSet

Set the texture offset on a given shape and size.

Python

BwApi.ShapeTextureOffsetBySizeSet(garmentId, shapeId, materialId, sizeId, front, offset)

C++

BwApiShapeTextureOffsetBySizeSet(garmentId, shapeId, materialId, sizeId, front, offset);

C#

BwApi.ShapeTextureOffsetBySizeSet(garmentId, shapeId, materialId, sizeId, front, offset);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

materialId

Existing material ID on the shape (this can also be group item in case the texture of the shape is group material).

In

sizeId

Existing size ID (-1 to set texture offset for all sizes).

In

front

1 - to set the offset of the front material, 0 - for setting the offset of the back material.

In

offset

The texture's offset.

Returns: Error/success code (see BwApiErrorCodes enum).

Note: Use BwApiShapeTextureOffsetGet first to get the current values, update the struct and only then call BwApiShapeTextureOffsetSet with the updated struct.

---

BwApiShapeLineIds

Get a shape's line IDs.

Python

BwApi.ShapeLineIds(garmentId, shapeId, cross)

C++

BwApiShapeLineIds(garmentId, shapeId, cross, lineIds);

C#

BwApi.ShapeLineIds(garmentId, shapeId, cross);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

cross

Boolean (1/0) 0 not cross (internal line), 1 cross (design line).

Out

lineIds

Array of internal line IDs (see BwApiVectorInt).

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeLockGet

Check if a shape is locked or not.

Python

BwApi.ShapeLockGet(garmentId, shapeId)

C++

BwApiShapeLockGet(garmentId, shapeId, lock);

C#

BwApi.ShapeLockGet(garmentId, shapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

Out

lock

1 - shape is locked, 0 - not locked.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeLockSet

Lock or unlock a shape.

Python

BwApi.ShapeLockSet(garmentId, shapeId, lock)

C++

BwApiShapeLockSet(garmentId, shapeId, lock);

C#

BwApi.ShapeLockSet(garmentId, shapeId, lock);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

lock

1 - lock the shape, 0 - unlock the shape.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShape3DPosFrom2DPosGet

Returns the 3D position of a 2D position of a shape.

Python

BwApi.Shape3DPosFrom2DPosGet(garmentId, shapeId, pos2D)

C++

BwApiShape3DPosFrom2DPosGet(garmentId, shapeId, pos2D, pos3D);

C#

BwApi.Shape3DPosFrom2DPosGet(garmentId, shapeId, pos2D);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

pos2D

2D position on the given shape.

Out

pos3D

The 3D position of pos2D.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeConvertInternalLineToHole

This section contains the hole functionality you can use to create/delete shapes, add edges to shapes, etc... The holes functionality is very similar to the attachment functionality.

Python

BwApi.ShapeConvertInternalLineToHole()

C++

BwApiShapeConvertInternalLineToHole();

C#

BwApi.ShapeConvertInternalLineToHole();

---

BwApiShapeConvertInternalLineToHole

Convert an internal line to a hole.

Python

BwApi.ShapeConvertInternalLineToHole(garmentId, shapeId, internalLineId)

C++

BwApiShapeConvertInternalLineToHole(garmentId, shapeId, internalLineId, holeId);

C#

BwApi.ShapeConvertInternalLineToHole(garmentId, shapeId, internalLineId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

shapeId

Existing shape ID.

In

internalLineId

Existing internal line ID.

Out

holeId

The ID of the newly created hole.

Returns: Error/success code (see BwApiErrorCodes enum).

---

BwApiShapeHoleIds

Get a shape's hole IDs.

Python

BwApi.ShapeHoleIds(garmentId, parentShapeId)

C++

BwApiShapeHoleIds(garmentId, parentShapeId, holeIds);

C#

BwApi.ShapeHoleIds(garmentId, parentShapeId);

Parameters

Param

Variable

Description

In

garmentId

Existing garment ID.

In

parentShapeId

Existing shape ID.

Out

holeIds

Array containing all hole shape IDs that are attached to the parent shape ID.

Returns: Error/success code (see BwApiErrorCodes enum).

---

Did this answer your question?