1. Products
  2.   CAD
  3.   Ruby
  4.   Aspose.CAD Cloud SDK for Ruby

Aspose.CAD Cloud SDK for Ruby

 
 

Ruby REST API to Generate & Export CAD Drawings

Advanced Ruby SDK enables software professionals to read, write, open, update & convert AutoCAD DWG, DWF drawings to PDF or images in the cloud.

Aspose.CAD Cloud SDK for Ruby is a very powerful and easy-to-use Ruby SDK that enables software developers to work with various AutoCAD file formats in the cloud. CAD (Computer-Aided Design) files are widely used in various industries, such as architecture, engineering, and manufacturing. However, working with CAD files can be challenging, as these files are often complex and proprietary. Moreover, CAD software can be expensive and require a lot of computational power to run. As a result, many developers turn to the cloud to process CAD files.

Aspose.CAD Cloud SDK for Ruby provides a simple and convenient way for working with CAD files in the cloud. With this SDK, developers can perform a wide range of operations on CAD files, such as converting them to PDF, DWG, DXF, DWF, and other formats, modifying existing CAD files, adding or removing layers, changing colors, modifying geometry, CAD file optimization, optimize CAD files to improve their performance, convert CAD drawing to Raster images and many more.

Aspose.CAD Cloud SDK for Ruby provides a simple and easy-to-use API that software developers can use to perform numerous CAD file processing operations in the cloud. The API is well-documented and easy to integrate into existing applications. The SDK fully supports some leading CAD file formats such as DWG, STL, DWT, DGN, IGS, PLT, IFC, DXF, and many more. Software developers can also convert CAD files to different formats, such as PDF, DWG, DXF, DWF, and more. Overall it’s a great choice for working with CAD files in the cloud. Using the Ruby Cloud SDK, software developers can easily convert CAD files to different formats, modify and manipulate CAD drawings, and perform various operations on CAD files.

Previous Next

Getting Started with Aspose.CAD Cloud SDK for Ruby

The recommend way to install Aspose.CAD Cloud SDK for Ruby is using RubyGem. To work with. Run the following command to add the Aspose.CAD Cloud SDK for Ruby to your project.

Install Aspose.CAD Cloud SDK for Ruby via RubyGem

gem install aspose_cad_cloud 
You can also download it directly from Aspose product page.

CAD Drawings Export to Raster Image via Ruby

Aspose.CAD Cloud SDK for Ruby has included various useful features for exporting CAD drawings to other support file formats using Ruby code. Software can also convert AutoCAD files to raster images with just a couple of lines of Ruby code. Raster images such as JPEG, PNG, TIFF, and BMP are some of the widely used file formats. The SDK makes it easy for software developers to export CAD Drawings to BMP, PNG, JPG, JPEG, JPEG2000, TIF, TIFF, PSD, GIF, WMF & many more. The following example shows how to convert a CAD file to a raster image using Ruby commands.

Convert a CAD File to a Raster Image via Ruby API


require 'aspose_cad_cloud'

# create an instance of the CadApi class
cad_api = AsposeCadCloud::CadApi.new

# convert a CAD file to a raster image
input_file = 'input.dwg'
output_format = 'png'
output_file = 'output.png'

cad_api.convert_to_raster_image(input_file, output_format, output_file)

# convert a specific page of a CAD file to a raster image
page_number = 2

cad_api.convert_to_raster_image(
  input_file,
  output_format,
  output_file,
  {
    dpi: 300, # set the DPI to 300
    page_index: page_number # convert only the specified page
  }
)

Get CAD Image Properties via Ruby API

Aspose.CAD Cloud SDK for Ruby provides the capability to get properties of an image and use it according to your needs inside Ruby applications. The library enables software developers to Retrieve CAD drawing properties such as image width, image height, color palette, image size, image bounds, get current unit type, image container, image title and many more. The following example demonstrates how software developers can get CAD image properties inside their own Ruby applications.

How to Get CAD Image Properties via Ruby Commands?

def test_get_properties_drawing_tests

filename = '910609.dxf'

remote_name = filename
dest_name = remote_test_out + remote_name

st_request = PutCreateRequest.new remote_test_folder + remote_name, File.open(local_test_folder + filename, "r").read

@storage_api.put_create st_request
request = GetDrawingPropertiesRequest.new remote_name, remote_test_folder
result = @Cad_api.get_drawing_properties_with_http_info request
assert_equal 200, result[1]

end

Resize, Flip or Rotate CAD Image via Ruby API

Aspose.CAD Cloud SDK for Ruby has included complete support for image manipulation and gives software developers the power to rotate or flip an existing AutoCAD drawing inside their own cloud applications. It supports Rotating images at 180FlipNone, Rotate180FlipX, Rotate180FlipXY, Rotate180FlipY, Rotate270FlipNone, Rotate90FlipX, Rotate90FlipXY, and several others. It is also possible to adjust the size of drawing images according to their own needs using Ruby commands. The following example demonstrates how to change image scale from the body using Ruby code.

How to Change CAD Image Size using Ruby API?

def test_post_drawing_scale

filename = '01.026.385.01.0.I SOPORTE ENFRIADOR.dwg'

remote_name = filename
output_format = 'pdf'
dest_name = remote_test_out + remote_name + '.' + output_format

st_request = PutCreateRequest.new remote_test_folder + remote_name, File.open(local_test_folder + filename, "r").read
@storage_api.put_create st_request

request = PostDrawingResizeRequest.new File.open(local_test_folder + filename, "r"), output_format, 320, 240, remote_test_folder
result = @Cad_api.post_drawing_resize_with_http_info request
assert_equal 200, result[1]

end