
Aspose.CAD Cloud SDK for Python
CAD 도면을 생성하고 조작하기 위한 Python REST API
클라우드에서 AutoCAD DWG, DXF, DWF 및 BIM 파일을 만들고, 편집하고, 읽고, 조작하고, 변환하는 데 유용한 기능을 완벽하게 지원하는 강력한 Python API입니다.
Aspose.CAD Cloud Python SDK란 무엇인가요?
Aspose.CAD Cloud Python SDK는 프로그래머가 AutoCAD 및 BIM 도면 작업용 강력한 앱을 설계할 수 있도록 지원하는 매우 유용한 소프트웨어 개발 키트(SDK)입니다. 강력한 REST API를 통해 개발자는 CAD 도면을 PDF, SVG, BMP, PNG, JPEG 등 다양한 파일 형식으로 변환할 수 있습니다. 이 API는 Aspose.CAD Cloud Python SDK에 포함되어 있어 프로그래머가 Python 앱에 다양한 기능을 쉽게 추가할 수 있습니다.
소프트웨어 개발자는 신뢰할 수 있는 Aspose.CAD Cloud Python SDK를 사용하여 CAD 파일 변환 및 조작 기능을 Python 기반 앱에 통합할 수 있습니다. 소프트웨어 개발자는 CAD 도면을 한 형식에서 다른 형식으로 변환할 수 있으며, DWG, DWF, DXF를 PDF 및 BMP, PNG, JPG, JPEG, JPEG2000, TIF, TIFF, PSD, GIF 등의 이미지 형식으로 변환하는 매우 강력한 변환 기능을 제공합니다. Aspose.CAD Cloud Python SDK는 Windows, Linux, macOS 등 Python을 지원하는 모든 플랫폼에서 사용할 수 있습니다.
Aspose.CAD Cloud Python SDK는 CAD 파일 작업을 위한 경제적인 방법을 제공합니다. 확장 가능하고 적응 가능한 클라우드 기반 플랫폼을 제공하며, 값비싼 CAD 소프트웨어와 장비가 필요 없습니다. CAD 파일 작업을 위한 이 SDK는 CAD 파일을 프로그래밍 방식으로 편집하고, CAD 엔티티를 추가 또는 수정하고, 레이어 또는 레이아웃을 추가 또는 제거하고, CAD 파일을 다양한 이미지 형식(PNG, JPG, BMP, TIFF)으로 렌더링하고, CAD 파일 유효성 검사를 지원하고, 클라우드 스토리지와 통합하는 등 다양한 주요 기능을 제공합니다. 모든 것을 고려해 볼 때, Python 기반 앱에서 CAD 파일을 관리해야 하는 프로그래머에게 이상적인 선택입니다.
Aspose.CAD Cloud Python SDK 시작하기
Aspose.CAD Cloud Python SDK는 Python 패키지 관리자인 pip를 사용하여 설치할 수 있습니다. 설치하려면 다음 명령을 실행하세요.
Python API를 통해 CAD 도면을 이미지로 변환
Aspose.CAD Cloud SDK for Python은 클라우드에서 CAD 도면을 여러 지원되는 이미지 파일 형식으로 변환하는 기능을 완벽하게 지원합니다. 이 라이브러리는 CAD 도면을 BMP, PNG, JPG, JPEG, JPEG2000, TIF, TIFF, PSD, GIF, WMF 파일 형식으로 변환하는 기능을 지원합니다. 소프트웨어 개발자는 CAD 도면에서 선택한 레이어와 레이아웃을 내보낼 수도 있습니다. 다음 예시는 Python REST API를 사용하여 기존 이미지를 다른 형식으로 내보내는 방법을 보여줍니다.
Python API를 통해 이미지 일부 내보내기
Aspose.CAD Cloud SDK for Python을 사용하면 소프트웨어 개발자가 Python 명령을 사용하여 CAD 이미지의 일부를 다른 지원되는 파일 형식으로 내보낼 수 있습니다. 이 작업을 수행하려면 먼저 이미지를 로드하고 get_drawing_properties 메서드를 사용하여 이미지 정보를 가져와야 합니다. 그런 다음 내보낼 이미지 영역의 크기를 가져와야 합니다. 이미지의 파일 이름과 폴더 이름, 그리고 영역의 왼쪽 상단과 오른쪽 하단 모서리의 좌표를 전달해야 합니다. 이제 이미지를 내보낼 준비가 되었습니다. 이미지의 파일 이름과 폴더 이름, 그리고 이미지를 내보낼 형식을 전달해 주세요. 다음 코드는 이미지의 일부를 다른 지원되는 파일 형식으로 내보내기 위한 코드입니다.
Python API를 통해 이미지의 일부를 내보내는 방법은 무엇입니까?
import asposecadcloud
from asposecadcloud.apis.cad_api import CadApi
# Your Aspose Cloud credentials
client_id = 'your_client_id'
client_secret = 'your_client_secret'
base_url = 'https://api.aspose.cloud'
# Create an instance of the ApiClient class
configuration = asposecadcloud.Configuration()
configuration.api_key['ClientId'] = client_id
configuration.api_key['ClientSecret'] = client_secret
configuration.host = base_url
api_client = asposecadcloud.ApiClient(configuration)
# Create an instance of the CadApi class
cad_api = CadApi(api_client)
# Get the properties of the drawing
filename = 'sample.dwg'
folder_name = 'CAD'
drawing_properties = cad_api.get_drawing_properties(filename, folder=folder_name)
# Get the dimensions of the area to export
top_left_x = 0
top_left_y = 0
bottom_right_x = 100
bottom_right_y = 100
drawing_area = cad_api.get_drawing_area(filename, folder=folder_name, x=top_left_x, y=top_left_y, width=bottom_right_x-top_left_x, height=bottom_right_y-top_left_y)
# Export the area as a PNG image
export_format = 'png'
output_filename = 'output.png'
export_options = asposecadcloud.PngOptions()
export_options.area = drawing_area
cad_api.get_drawing_save_as(filename, export_format, folder=folder_name, out_path=output_filename, export_options=export_options)
Python API를 통한 CAD 도면 크기 관리
Python용 Aspose.CAD Cloud SDK는 CAD 도면 및 크기 처리를 위한 강력한 기능을 제공합니다. 이 라이브러리는 UnitType 열거형을 사용하여 자동 크기 조정 또는 크기 조정 기능을 지원합니다. 이미지 크기를 조정하려면 먼저 기존 이미지를 로드하고 도면의 현재 크기를 가져온 후 새 내보내기 옵션 인스턴스를 생성해야 합니다. 그런 다음 새 도면 크기를 설정하고 도면을 새 크기로 변환합니다. format with the new size. Now save it to the specified output file path. The following example shows how to achieve this.
Python API를 통해 CAD 도면의 크기를 조정하는 방법은 무엇입니까?
import asposecadcloud
from asposecadcloud.apis.cad_api import CadApi
from asposecadcloud.models.cad_bmp_export_options import CadBmpExportOptions
# set up the API client
cad_api = CadApi(api_key, app_sid, api_base_url)
# specify the input and output file paths
input_file = "input.dwg"
output_file = "output.dwg"
# get the current size of the drawing
size = cad_api.get_drawing_properties(input_file).drawing_size
# create an instance of the BMP export options
bmp_export_options = CadBmpExportOptions()
# set the new size of the drawing
bmp_export_options.width = size.width * 2
bmp_export_options.height = size.height * 2
# convert the drawing to BMP format with the new size
cad_api.put_drawing_bmp(input_file, bmp_export_options, output_file)
Python API를 통한 CAD 이미지 회전 및 뒤집기
Python용 Aspose.CAD Cloud SDK에는 Python REST API를 사용하여 이미지를 조작하고 다른 지원 파일 형식으로 변환하는 데 유용한 기능이 포함되어 있습니다. 기존 이미지를 회전하고 뒤집으려면 먼저 입력 및 출력 파일 이름과 형식을 설정해야 합니다. 그런 다음 회전 및 뒤집기 속성을 설정하고 도면을 회전하거나 뒤집습니다. 이제 회전 및 뒤집힌 도면을 다운로드하여 원하는 위치에 저장할 수 있습니다.
Python 애플리케이션 내에서 CAD 이미지를 회전하고 뒤집는 방법은 무엇인가요?
import asposecadcloud
from asposecadcloud.apis.cad_api import CadApi
from asposecadcloud.models.requests import PutDrawingRotateFlipRequest
from asposecadcloud.models.rotate_flip_type import RotateFlipType
# Configure API key authorization
configuration = asposecadcloud.Configuration()
configuration.api_key['api_key'] = 'YOUR_APP_KEY'
configuration.api_key['app_sid'] = 'YOUR_APP_SID'
# Create a CAD API instance
cad_api = CadApi(asposecadcloud.ApiClient(configuration))
# Set input file name and format
filename = 'input.dwg'
format = 'dwg'
# Set output file name and format
output_filename = 'output.dwg'
output_format = 'dwg'
# Set rotation and flip properties
rotate_flip_type = RotateFlipType.FlipX
# Rotate and flip the drawing
request = PutDrawingRotateFlipRequest(filename, rotate_flip_type, output_format, folder=None, storage=None, output_path=output_filename)
response = cad_api.put_drawing_rotate_flip(request)
# Download the rotated and flipped drawing
download_request = asposecadcloud.DownloadFileRequest(output_filename)
download_response = cad_api.download_file(download_request)