1. 产品
  2.   3D
  3.   Perl
  4.   Aspose.3D Cloud Perl SDK

Aspose.3D Cloud Perl SDK

 
 

Perl SDK 用于创建、编辑、操作和转换 3D 文件

强大的 REST API,用于创建、编辑、操作和转换 3D 模型,包括 FBX、STL、OBJ、3DS、OBJ,并在云应用中提取 3D 场景。

什么是 Aspose.3D Cloud Perl SDK?

在瞬息万变的软件开发世界中,对强大工具以简化复杂任务的需求日益增长。随着技术的进步,在应用程序中加入诸如 3D 建模等高级功能变得至关重要。如果您是一名探索 3D 建模和处理的软件开发者, Aspose.3D Cloud Perl SDK 可以成为您值得信赖的合作伙伴。它在 Perl 应用程序与前沿 3D 功能之间提供了流畅的连接。该 SDK 封装了安全最佳实践,确保软件开发者以安全的方式与 Aspose.3D Cloud API 进行通信。

Aspose.3D Cloud Perl SDK 的一个很棒的地方是它与 Aspose.3D Cloud API 的配合非常简便。这个软件工具让开发者能够轻松地在 Perl 应用中添加强大的 3D 功能。SDK 如同一个连接器,使开发者更容易使用 API 进行 3D 建模。该库包含关键特性,如从头创建 3D 场景、将 3D 场景保存为 PDF、3D 建模操作、从 3D 文件中提取场景、将 3D 文件转换为其他格式、参数化建模支持、创建 3D 实体、处理三角网格等。

Aspose.3D Cloud Perl SDK 非常易于使用。它内置支持多种主流 3D 文件格式,如 FBX、STL、VRML、ASE、OBJ、3DS、U3D、DAE、DRC、GLTF、RVM、PDF、AMF、PLY、X、JT、DXF、3MF、HTML 等。此外,它被设计为在不同平台上平稳运行。因此,无论您使用哪个平台,都可以轻松为 Perl 应用程序添加 3D 功能。总之,Perl SDK 如同软件开发者探索激动人心的 3D 建模与处理世界的指路明灯。通过与 API 的平滑集成、跨平台的适应性、易用性以及持续的支持,该 SDK 使您能够使用 3D 技术的强大功能来增强 Perl 应用程序。

Previous Next

Aspose.3D Cloud Perl SDK 入门指南

推荐的安装 Aspose.3D Cloud Perl SDK 方法是使用 Comprehensive Perl Archive Network(CPAN)。请使用以下命令进行顺利安装。

通过 CocoaPods 安装 Aspose.3D Cloud Perl SDK

cpan AsposeCloud::3D

您可以从 Aspose.3D Cloud Perl SDK 产品页面下载已编译的共享库。

在云端将 3D 文件转换为 PDF

Aspose.3D Cloud Perl SDK 已全面支持加载和转换 3D 模型为其他受支持的文件格式,如 PDF、XPS、JPEG、PNG 等。库中包含多项重要功能,帮助用户顺利完成转换过程。它支持将整个 3D 文件转换为 PDF,也支持仅将特定部分转换为 PDF。以下示例演示了 Perl 开发者如何使用 Perl 命令将现有 3D 文件转换为 PDF 文件。

如何使用 Perl SDK 将 3D 模型转换为 PDF?

# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
	
	my $config = AsposeThreeDCloud::Configuration->new('base_url' => 'https://api.aspose.cloud');
    my $client = AsposeThreeDCloud::ApiClient->new( $config);
    my $oauth_api = AsposeThreeDCloud::OAuthApi->new($client);

    my $grant_type = 'client_credentials';
    my $client_id = 'MY_CLIENT_ID';
    my $client_secret =  'MY_CLIENT_SECRET';
    my $result = $oauth_api->o_auth_post(grant_type => $grant_type, client_id => $client_id, client_secret => $client_secret);
    my $access_token  = $result->access_token;

    my $new_config = AsposeThreeDCloud::Configuration->new('access_token' =>  $access_token, 'base_url' => 'https://api.aspose.cloud/v3.0');
    $new_client = AsposeThreeDCloud::ApiClient->new( $new_config);
	my $api = AsposeThreeDCloud::ThreeDCloudApi->new($new_client)
	
	my $name = 'Aspose.Upload.3d';
    my $newformat = 'pdf';
    my $newfilename = 'saveasformat.pdf';
    my $folder = '3DTest';
    my $is_overwrite = 'true';
    my $storage = undef;

	my $result = $api->post_convert_by_format(name => $name, newformat => $newformat, newfilename => $newfilename, folder => $folder, is_overwrite => $is_overwrite, storage => $storage);

通过 Perl 创建和管理 3D 实体

Aspose.3D Cloud Perl SDK 使软件开发者能够使用 Perl 代码在 3D 模型中从头创建新的 3D 实体。该 SDK 支持生成常用实体,如盒子(Box)、球体(Sphere)、平面(Plane)、环面(Torus)、圆柱体(Cylinder)等。开发者可以轻松根据自己的需求调整宽度、高度、深度、名称和文件夹等参数。下面是一个简单示例,展示开发者如何使用 Perl 代码创建一个基本的 3D 盒子。

如何通过 Perl API 创建基本的 3D 盒子?

use AsposeCloud::3D::ApiClient;
use AsposeCloud::3D::Configuration;

my $config = AsposeCloud::3D::Configuration->new(
    app_sid => 'YourAppSID',
    app_key => 'YourAppKey',
);

my $api_client = AsposeCloud::3D::ApiClient->new(config => $config);

use AsposeCloud::3D::ObjectByThreeDsModelApi;
use AsposeCloud::3D::CreateEntityRequest;
use AsposeCloud::3D::Box;

my $object_api = AsposeCloud::3D::ObjectByThreeDsModelApi->new(api_client => $api_client);

my $box = AsposeCloud::3D::Box->new(
    width  => 5.0,   # Replace with your desired width
    height => 5.0,   # Replace with your desired height
    depth  => 5.0,   # Replace with your desired depth
);

my $create_entity_request = AsposeCloud::3D::CreateEntityRequest->new(
    name   => 'Box',           # Replace with your entity name
    box    => $box,
    folder => 'your_folder',   # Replace with your desired folder
);

my $result = $object_api->post_create_entity(request => $create_entity_request);

if ($result->status eq 'OK') {
    print "Entity created successfully.\n";
} else {
    print "Error: " . $result->status . "\n";
}

通过 Perl API 将 3D 场景提取为其他格式

Aspose.3D Cloud Perl SDK 让软件开发人员能够轻松在 Perl 应用程序中提取 3D 场景并将其转换为其他格式。此功能在开发需要访问模型元数据或特定属性的应用程序时尤为有用。此外,SDK 提供了用于检索网格统计信息、顶点计数、材质信息等详细信息的实用函数。下面是一个简单示例,展示如何从文件中提取 3D 场景并将其转换为如 GLTF 等不同格式。

如何从文件中提取 3D 场景并将其转换为 GLTF 格式?

use AsposeCloud::3D::SceneApi;
use AsposeCloud::3D::SaveOptions;

my $scene_api = AsposeCloud::3D::SceneApi->new(api_client => $api_client);

my $input_path = 'input_scene.obj';   # Replace with the path to your input 3D scene file
my $output_path = 'output_scene.gltf'; # Replace with the desired output format and path

my $save_options = AsposeCloud::3D::SaveOptions->new(
    save_format => 'gltf',              # Replace with your desired output format
    file_name   => $output_path,
);

my $result = $scene_api->post_export_scene(file => $input_path, save_options => $save_options);

if ($result->status eq 'OK') {
    print "Scene extracted and converted successfully. Output saved at $output_path\n";
} else {
    print "Error: " . $result->status . "\n";
}

安全性与跨平台灵活性

在数字领域,安全至关重要,Aspose.3D Cloud Perl SDK 并未妥协。内置的安全措施确保 SDK 与 Aspose.3D Cloud API 之间的数据交换遵循最佳实践。这一安全承诺使开发者能够构建强大且安全的应用,利用 3D 建模的强大功能。鉴于当今技术生态系统中多样化的开发环境,SDK 确保跨平台兼容性。开发者可以在其 Perl 应用中无缝集成 3D 功能,无论所使用的平台是什么。这种灵活性提升了 SDK 的可访问性,满足了偏好各异的广大开发者群体。

 中国人