Class AutocadScript2D

java.lang.Object
com.imc.iss.groovy.autocad.AutocadScript
com.imc.iss.groovy.autocad.AutocadScript2D
All Implemented Interfaces:
Serializable

public class AutocadScript2D extends AutocadScript implements Serializable
For working with 2D AutoCAD drawings
See Also:
  • Constructor Details

    • AutocadScript2D

      public AutocadScript2D()
      The default constructor
  • Method Details

    • drawLine

      public void drawLine(BigDecimal x_start, BigDecimal y_start, BigDecimal x_end, BigDecimal y_end)
      Draws a straight line between two points.

      The line's parameters (such as width) will follow whatever is currently the default in the drawing.

      Parameters:
      x_start - The x coordinate for the starting point
      y_start - The y coordinate for the starting point
      x_end - The x coordinate for the end point
      y_end - The y coordinate for the end point
    • insertBlock

      public void insertBlock(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate)
      Inserts an existing block at the specified coordinates. The default scaling factor will be used.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
    • insertBlock

      public void insertBlock(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, List<String> attributes)
      Inserts an existing block at the specified coordinates. The default scaling factor will be used.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      attributes - The list of block attributes. These have to be given in the correct order as defined in the block itself
    • insertBlockRotated

      public void insertBlockRotated(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal rotation_angle)
      Inserts an existing block at the specified coordinates, rotated by the specified angle. The default scaling factor will be used.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
    • insertBlockRotated

      public void insertBlockRotated(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal rotation_angle, List<String> attributes)
      Inserts an existing block at the specified coordinates, rotated by the specified angle. The default scaling factor will be used.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
      attributes - The list of block attributes. These have to be given in the correct order as defined in the block itself
    • insertBlockScaled

      public void insertBlockScaled(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor)
      Inserts an existing block at the specified coordinates, with the specified scaling factor.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
    • insertBlockScaled

      public void insertBlockScaled(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor, List<String> attributes)
      Inserts an existing block at the specified coordinates, with the specified scaling factor.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
      attributes - The list of block attributes. These have to be given in the correct order as defined in the block itself
    • insertBlockScaledRotated

      public void insertBlockScaledRotated(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor, BigDecimal rotation_angle)
      Inserts an existing block at the specified coordinates, with the specified scaling factor and rotated by the specified angle.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
    • insertBlockScaledRotated

      public void insertBlockScaledRotated(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor, BigDecimal rotation_angle, List<String> attributes)
      Inserts an existing block at the specified coordinates, with the specified scaling factor and rotated by the specified angle.
      Parameters:
      block_name - The name of the block to be inserted. The block must already exist within the base DWG file. The system cannot check this, and any error will only come once the script is executed on the Autodesk server, thus what kind of error message will be returned cannot be guaranteed
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
      attributes - The list of block attributes. These have to be given in the correct order as defined in the block itself
    • insertDimension

      public void insertDimension(BigDecimal x_start, BigDecimal y_start, BigDecimal x_end, BigDecimal y_end, BigDecimal x_pos, BigDecimal y_pos)
      Inserts the aligned dimension measurement.

      This will measure the straight-line distance between two points and displays the value. The value will be printed parallel to the line between the two measured points at a certain distance away, which is determined by the position of the third point.

      Parameters:
      x_start - The x coordinate for the first point to be measured
      y_start - The y coordinate for the first point to be measured
      x_end - The x coordinate for the second point to be measured
      y_end - The y coordinate for the second point to be measured
      x_pos - The x coordinate for the position of the measurement value
      y_pos - The y coordinate for the position of the measurement value
    • insertFileAsBlock

      public void insertFileAsBlock(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate)
      Inserts the specified file at the specified coordinates. The default scaling factor will be used.
      Parameters:
      filename - The file name of the model to be inserted. The file must have been uploaded already through the Model / AutoCAD Management screen
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
    • insertFileAsBlockRotated

      public void insertFileAsBlockRotated(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal rotation_angle)
      Inserts the specified file at the specified coordinates, rotated by the specified angle. The default scaling factor will be used.
      Parameters:
      filename - The file name of the model to be inserted. The file must have been uploaded already through the Model / AutoCAD Management screen
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
    • insertFileAsBlockScaled

      public void insertFileAsBlockScaled(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor)
      Inserts the specified file at the specified coordinates, with the specified scaling factor.
      Parameters:
      filename - The file name of the model to be inserted. The file must have been uploaded already through the Model / AutoCAD Management screen
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
    • insertFileAsBlockScaledRotated

      public void insertFileAsBlockScaledRotated(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor, BigDecimal rotation_angle)
      Inserts the specified file at the specified coordinates, with the specified scaling factor and rotated by the specified angle.
      Parameters:
      filename - The file name of the model to be inserted. The file must have been uploaded already through the Model / AutoCAD Management screen
      x_coordinate - The x coordinate at which the model will be inserted into the drawing
      y_coordinate - The y coordinate at which the model will be inserted into the drawing
      scale_factor - The the model will be inserted into the drawing scaled according to this factor. For example, if the scaling factor is 0.5, the model will be inserted half as big in both the X and Y direction as in the original file
      rotation_angle - The angle the model will be rotated by. The unit of this rotation (degree, radian, or others) and whether the rotation is clockwise or anti-clockwise depends on the settings in the base DWG file
    • insertText

      public void insertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate)
      Inserts an arbitrary text at the specified coordinates.

      The text will be printed with the default font size and anchor type.

      Parameters:
      text - The text to be printed
      x_coordinate - The x coordinate at which the text will be inserted into the drawing
      y_coordinate - The y coordinate at which the text will be inserted into the drawing
    • insertText

      public void insertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal fontsize)
      Inserts an arbitrary text at the specified coordinates, with a particular font size.

      The text will be printed with the default anchor type.

      Parameters:
      text - The text to be printed
      x_coordinate - The x coordinate at which the text will be inserted into the drawing
      y_coordinate - The y coordinate at which the text will be inserted into the drawing
      fontsize - The font size to use
    • insertText

      public void insertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal fontsize, AutocadScript.TextAnchor anchor)
      Inserts an arbitrary text at the specified coordinates, with a particular font size and anchor type.
      Parameters:
      text - The text to be printed
      x_coordinate - The x coordinate at which the text will be inserted into the drawing
      y_coordinate - The y coordinate at which the text will be inserted into the drawing
      fontsize - The font size to use
      anchor - The anchor type to use
    • insertText

      public void insertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate, AutocadScript.TextAnchor anchor)
      Inserts an arbitrary text at the specified coordinates, with a particular anchor type.

      The text will be printed with the default font size.

      Parameters:
      text - The text to be printed
      x_coordinate - The x coordinate at which the text will be inserted into the drawing
      y_coordinate - The y coordinate at which the text will be inserted into the drawing
      anchor - The anchor type to use