Format GLB minangka salah sawijining format file 3D sing populer kanggo pemandangan & model 3D lan kanggo ndeleng, kita kudu nggunakake Microsoft Paint 3D, Microsoft Remix 3D, Trimble 3D Warehouse, utawa program apa wae sing ndhukung file glTF. . Nanging ing sisih liya, format file PDF minangka salah sawijining format sing didhukung akeh kanggo enggo bareng informasi lan akeh browser web modern sing bisa nampilake file PDF. Mulane, considering ease iki, ing artikel iki, kita bakal ngrembug rincian carane ngowahi GLB kanggo PDF nggunakake basa Python lan uga, langkah-langkah kanggo ngowahi FBX kanggo PDF nggunakake Python.
- API Konversi 3D menyang PDF
- Ngonversi GLB menyang PDF nggunakake Python
- Ngonversi FBX menyang PDF nggunakake Python
- GLB menyang PDF nggunakake CURL Command
- FBX menyang PDF nggunakake CURL Command
API Konversi 3D menyang PDF
Solusi adhedhasar REST sing jenenge Aspose.3D Cloud nyedhiyakake fitur kanggo ngasilake, maca, lan ngapusi dokumen 3D. Saiki supaya bisa nggunakake fitur kasebut ing aplikasi Python, kita kudu nyoba nggunakake Aspose.3D Cloud SDK kanggo Python. Dadi langkah pisanan yaiku nginstal SDK sing kasedhiya kanggo diundhuh ing PIP lan GitHub. Mangga nglakokake printah ing ngisor iki ing terminal baris printah kanggo nginstal SDK:
pip install aspose3dcloud
Saiki entuk rincian ClientID lan ClientSecret pribadi kanthi ngunjungi dasbor Aspose.Cloud.
Ngonversi GLB menyang PDF nggunakake Python
Tututi langkah-langkah ing ngisor iki kanggo mbukak file GLB saka panyimpenan maya lan ngowahi dadi format PDF.
- Nggawe conto ThreeDCloudApi nalika ngliwati ID Klien lan rahasia Klien minangka argumen
- Netepake jeneng input GLB, format output minangka PDF lan informasi jeneng file asil
- Pungkasan, nelpon metode postconvertbyformat(…) saka kelas ThreeDCloudApi kanggo nindakake operasi konversi
# Kanggo conto liyane, bukak https://github.com/Aspose-3D-Cloud/aspose-3d-cloud-python
def glbToPdf():
try:
client_secret = "1c9379bb7d701c26cc87e741a29987bb"
client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e"
# Nggawe conto saka Aspose.3D Cloud
threeDCloudApi = aspose3dcloud.ThreeDCloudApi("client_credentials", client_id, client_secret)
# input file GLB
name = "Wolf-Blender-2.82a.glb"
# format file PDF asil
newformat = "pdf"
# jeneng file PDF asil
newfilename = "Converted.pdf"
# nyetel gendera kanggo nimpa file sing wis ana
isOverwrite = "true"
# nelpon cara API kanggo miwiti prosedur konversi file
result = threeDCloudApi.post_convert_by_format(name, newformat, newfilename, folder = None, is_overwrite = isOverwrite)
# pesen print ing konsol (opsional)
print('Conversion process completed successfully !')
except ApiException as e:
print("Exception while calling 3DApi: {0}".format(e))
glbToPdf()
Ngonversi FBX menyang PDF nggunakake Python
Supaya bisa ngowahi file FBX sing disimpen ing panyimpenan maya menyang format PDF lan file asil uga disimpen ing panyimpenan maya.
- Nggawe conto ThreeDCloudApi nalika ngliwati ID Klien lan rahasia Klien minangka argumen
- Nemtokake jeneng input jeneng FBX, format output minangka PDF lan asil informasi jeneng file
- Saiki, nelpon metode postconvertbyformat(…) saka kelas ThreeDCloudApi kanggo nindakake operasi konversi
# Kanggo conto liyane, bukak https://github.com/Aspose-3D-Cloud/aspose-3d-cloud-python
def fbxToPdf():
try:
# Nggawe conto saka Aspose.3D Cloud
threeDCloudApi = aspose3dcloud.ThreeDCloudApi("client_credentials", "bbf94a2c-6d7e-4020-b4d2-b9809741374e","1c9379bb7d701c26cc87e741a29987bb")
# input file FBX
name = "Wolf-Blender.fbx"
# format file PDF asil
newformat = "pdf"
# jeneng file PDF asil
newfilename = "Converted.pdf"
# nyetel gendera kanggo nimpa file sing wis ana
isOverwrite = "true"
# miwiti operasi konversi file
result = threeDCloudApi.post_convert_by_format(name, newformat, newfilename, folder = None, is_overwrite = isOverwrite)
# pesen print ing konsol (opsional)
print('Conversion process completed successfully !')
except ApiException as e:
print("Exception while calling 3DApi: {0}".format(e))
fbxToPdf()
File sampel sing digunakake ing conto ing ndhuwur bisa diundhuh saka Wolf-Blender-2.82a.glb lan Wolf-Blender-Converted.fbx.
GLB menyang PDF nggunakake CURL Command
Aspose.3D Cloud dikembangake miturut arsitektur REST, mula ing bagean iki, kita bakal sinau langkah-langkah kanggo ngowahi GLB dadi PDF nggunakake perintah cURL. Nanging, langkah pisanan ing proses iki yaiku nggawe token akses JWT adhedhasar kredensial klien sampeyan. Mangga nglakokake printah ing ngisor iki kanggo ngasilake token.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Sawise kita duwe token JWT, kita kudu nglakokake perintah ing ngisor iki kanggo ngowahi GLB dadi format PDF.
curl -v -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=Wolf-Blender-2.82a(2).glb&newformat=PDF&newfilename=Converted.pdf&IsOverwrite=true" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>" \
-d{}
FBX menyang PDF nggunakake CURL Command
Mangga nglakokake printah ing ngisor iki kanggo mbukak file FBX saka panyimpenan Cloud lan ngowahi menyang format PDF. File asil banjur disimpen menyang panyimpenan maya.
curl -v -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=Wolf-Blender-Converted(1).fbx&newformat=PDF&newfilename=Converted.pdf&IsOverwrite=true" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>" \
-d{}
Kesimpulan
Ing artikel iki, kita wis njelajah rincian kanggo ngowahi 3D dadi PDF, GLB dadi PDF lan FBX dadi PDF nggunakake potongan kode Python. Ing wektu sing padha, kita uga wis sinau langkah-langkah kanggo ngowahi FBX dadi PDF nggunakake potongan kode Python. Gawe pembuat PDF 3D kanthi nuruti langkah-langkah ing ngendi kita ngowahi GLB lan FBX dadi PDF nggunakake perintah cURL. Salajengipun, API uga nawakake fitur kanggo ngowahi FBX dadi OBJ, OBJ dadi FBX, utawa nyimpen FBX menyang format STL. Gunakake API kanggo ngowahi sampel Mercedes glb utawa glb 250 etc file menyang format output sing dipengini.
Wigati dimangerteni manawa Pandhuan Pangembang minangka sumber informasi sing apik kanggo sinau babagan kemampuan luar biasa sing ditawakake SDK. Yen sampeyan nemoni masalah nalika nggunakake API, hubungi kita liwat Forum dhukungan gratis.
Artikel sing gegandhengan
Kita uga menehi saran kanggo ngunjungi link ing ngisor iki kanggo sinau luwih lengkap babagan: