Package com.imc.iss.groovy.autocad
Class AutocadScript2D
java.lang.Object
com.imc.iss.groovy.autocad.AutocadScript
com.imc.iss.groovy.autocad.AutocadScript2D
- All Implemented Interfaces:
Serializable
For working with 2D AutoCAD drawings
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.imc.iss.groovy.autocad.AutocadScript
AutocadScript.TextAnchor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawLine(BigDecimal x_start, BigDecimal y_start, BigDecimal x_end, BigDecimal y_end) Draws a straight line between two points.voidinsertBlock(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate) Inserts an existing block at the specified coordinates.voidinsertBlock(String block_name, BigDecimal x_coordinate, BigDecimal y_coordinate, List<String> attributes) Inserts an existing block at the specified coordinates.voidinsertBlockRotated(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.voidinsertBlockRotated(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.voidinsertBlockScaled(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.voidinsertBlockScaled(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.voidinsertBlockScaledRotated(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.voidinsertBlockScaledRotated(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.voidinsertDimension(BigDecimal x_start, BigDecimal y_start, BigDecimal x_end, BigDecimal y_end, BigDecimal x_pos, BigDecimal y_pos) Inserts the aligned dimension measurement.voidinsertFileAsBlock(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate) Inserts the specified file at the specified coordinates.voidinsertFileAsBlockRotated(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal rotation_angle) Inserts the specified file at the specified coordinates, rotated by the specified angle.voidinsertFileAsBlockScaled(String filename, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal scale_factor) Inserts the specified file at the specified coordinates, with the specified scaling factor.voidinsertFileAsBlockScaledRotated(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.voidinsertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate) Inserts an arbitrary text at the specified coordinates.voidinsertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate, AutocadScript.TextAnchor anchor) Inserts an arbitrary text at the specified coordinates, with a particular anchor type.voidinsertText(String text, BigDecimal x_coordinate, BigDecimal y_coordinate, BigDecimal fontsize) Inserts an arbitrary text at the specified coordinates, with a particular font size.voidinsertText(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.Methods inherited from class com.imc.iss.groovy.autocad.AutocadScript
getDefaultFontSize, getDefaultScaleFactor, getDefaultTextAnchor, getSb, getUsedFiles, insertArbitraryCommand, setDefaultFontSize, setDefaultScaleFactor, setDefaultTextAnchor, setSb, setUsedFiles, updateBlockAttributeValue
-
Constructor Details
-
AutocadScript2D
public AutocadScript2D()The default constructor
-
-
Method Details
-
drawLine
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 pointy_start- The y coordinate for the starting pointx_end- The x coordinate for the end pointy_end- The y coordinate for the end point
-
insertBlock
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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingattributes- 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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingrotation_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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingrotation_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 fileattributes- 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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 fileattributes- 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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 filerotation_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 guaranteedx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 filerotation_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 fileattributes- 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 measuredy_start- The y coordinate for the first point to be measuredx_end- The x coordinate for the second point to be measuredy_end- The y coordinate for the second point to be measuredx_pos- The x coordinate for the position of the measurement valuey_pos- The y coordinate for the position of the measurement value
-
insertFileAsBlock
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 screenx_coordinate- The x coordinate at which the model will be inserted into the drawingy_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 screenx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingrotation_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 screenx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 screenx_coordinate- The x coordinate at which the model will be inserted into the drawingy_coordinate- The y coordinate at which the model will be inserted into the drawingscale_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 filerotation_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
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 printedx_coordinate- The x coordinate at which the text will be inserted into the drawingy_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 printedx_coordinate- The x coordinate at which the text will be inserted into the drawingy_coordinate- The y coordinate at which the text will be inserted into the drawingfontsize- 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 printedx_coordinate- The x coordinate at which the text will be inserted into the drawingy_coordinate- The y coordinate at which the text will be inserted into the drawingfontsize- The font size to useanchor- 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 printedx_coordinate- The x coordinate at which the text will be inserted into the drawingy_coordinate- The y coordinate at which the text will be inserted into the drawinganchor- The anchor type to use
-