Drawing functions in iLogic

Use Drawing functions to customize the way that changes to the model are reflected in the drawing sheets. Drawing functions can facilitate efficient model updates, and they can be included in rules triggered by the iLogic Drawing View Change event.

ThisDrawing

Accesses the current drawing in a rule.

ActiveSheet

Accesses the active sheet in a drawing. This function is an alias for ThisDrawing.ActiveSheet. Most drawing operations are performed on the active sheet, because the other sheets may not be up-to-date.

ThisDrawing.Sheet

Accesses a sheet in the drawing.

Syntax

ThisDrawing.Sheet(“sheetname”)

ResourceFileName

You can assign a filename string to this property to specify the name of another drawing from which to pull title block and border definitions. When you use the TitleBlock or Border Sheet function, iLogic looks in this drawing for resources that are not found in the current drawing. Use a relative path name for this file name. iLogic searches for this file in the folder of the current drawing and in the project workspace folder. You can specify subfolders relative to either of these locations.

Example

ThisDrawing.ResourceFileName = “DrawingResources1.idw”

KeepExtraResources

Set this property to False if copies of the resources from the external resource file are not kept in the current drawing.

If you set this property to False, a resource is deleted when another resource replaces it. Deletion only happens if the ResourceFileName is not blank. It is assumed that all the resources you need can be found in the external resource file.

Example

ThisDrawing.KeepExtraResources = False

Sheet functions

Sheet functions for drawings usually operate on the active sheet. To restrict a rule so that it only runs for a particular sheet, you can add code at the top of a rule. For example:

If (ActiveSheet.Name <> "Sheet:2") Then Return

ChangeSize (using text string value)

Changes the size of the sheet, using a text string as the value of the new size.

Syntax

Sheet.ChangeSize (“value”,<MoveBorderItems = True>)

value

The value of the new size.

MoveBorderItems

This parameter is optional. If MoveBorderItems is set to False, any tables and parts lists currently located on the border or edge of the sheet are not moved to the new border.

Examples

ActiveSheet.ChangeSize (“A”)
ActiveSheet.ChangeSize (“B1”, MoveBorderItems := False)

ChangeSize (using custom values)

Changes the size of the sheet, using a custom height and width, in document units.

Syntax

Sheet.ChangeSize (customHeight, customWidth, <MoveBorderItems = True>)

height

The height in document units.

width

The width in document units.

MoveBorderItems

This parameter is optional. If MoveBorderItems is set to False, any tables and parts lists currently located on the border or edge of the sheet are not moved to the new border.

Examples

ActiveSheet.ChangeSize (7.2, 4)
ActiveSheet.ChangeSize ( 7.2, 4, MoveBorderItems = False)

Sheet.Border

Change the current border on the sheet by specifying a different name. The name must be found in the drawing resources of the current drawing, or in the ResourceFileName drawing if it is specified.

Examples

ActiveSheet.Border = “OtherBorder”
currentName = ActiveSheet.Border

Sheet.TitleBlock

Change the current title block on the sheet by specifying a different name. The name must be found in the drawing resources of the current drawing, or in the ResourceFileName drawing if it is specified..

Examples

ActiveSheet.TitleBlock = “ANSI - A”
currentName = ActiveSheet.TitleBlock

Example when using an external source file -

ThisDrawing.ResourceFileName = “DrawingResources1.idw”
ActiveSheet.TitleBlock = “Custom - A”

ActiveSheet.Name

Gets the name of the sheet.

ActiveSheet.Size

Gets the size of the sheet as a text string, such as "A" or “B0”.

ActiveSheet.Height

Gets the height of the sheet, in document units.

ActiveSheet.Width

Gets the width of the sheet, in document units.

ActiveSheet.View(“viewName”)

Gets access to a view on the sheet.

View functions

View functions for drawings usually operate on active sheet (recommended).

View.Name

Gets the name of the view.

View.Height

Gets the height of the view, in drawing document units.

View.Width

Gets the width of the view, in drawing document units.

View.Scale

Gets or sets the view scale as a number.

View.ScaleString

Gets or sets the view scale as a text string, such as “1:2” or “4.1”.

View.SetCenter(centerX,centerY)

Sets the center point of the view (moves the view). Coordinates are specified in drawing document units.

View.SetSpacingToCorner(distanceX, distanceY, corner)

Sets the view position (moves the view) by specifying the distance from a view corner to the nearest sheet corner. The variable corner can be one of the following:

SheetCorner.BottomLeft
SheetCorner.BottomRight
SheetCorner.TopLeft
SheetCorner.TopRight

Coordinates are specified in drawing units. iLogic finds the corner that is closest to a sheet corner.

View.SpacingBetween(“otherViewName”)

Sets the view position (moves the view) by specifying the space between this view and another view. The other view name is typically an adjacent view on the sheet. The spacing is between view edges, in the X or Y direction. Specify a positive spacing value to place this view to the right or above the other view. Specify a negative value to place this view to the left or below the other view. For example:

ActiveSheet.View("VIEW2").SpacingBetween("VIEW1") = 30 mm  '

VIEW2 is to the right of VIEW1.

ActiveSheet.View("VIEW3").SpacingBetween("VIEW1") = -40 mm  '

VIEW3 is below VIEW1.

View.Balloons

Accesses the balloons in the view.

Balloon functions

Balloon functions for drawings are tied to a particular view.

Balloons.Reattach

For views of assembly documents, this function checks for unattached balloons in the view and attaches them to a component, if possible. The first choice is a component at the arrowhead location. If none is found, the closest eligible component without a balloon is used. If the balloon cannot be attached at this time, it is moved to a hidden layer. The hidden layer is a layer created (if necessary) for this purpose.

Note: This function requires that the Preserve Orphaned Annotations option is set for the drawing (under Tools Options Document Settings). If this option is not set, the function sets it automatically.

Balloons.AttachToComponent(“componentName”)

Specifies a component that requires a balloon. The componentName specifies a component occurrence, such as "Pin:1". When you use this function, balloons are only reattached to the components that you specify. If you do not use this function, balloons are reattached to any available component (unless disqualified by the DoNotAttachToComponent function).

Balloons.DoNotAttachToComponent(“componentName”)

Specifies a component that does not require a balloon. The componentName specifies a component occurrence, such as "Pin:1".