User:Alessia/coding+3d

From XPUB & Lens-Based wiki

Python


https://runestone.academy/ns/books/published/thinkcspy/index.html



Blender Python scripting


Python API documentation: https://docs.blender.org/api/current/

A set of rules and tools to let software applications communicate with each other, it defines the methods that apps use to exchange data.
API Application Programming Interface
https://www.youtube.com/watch?v=ByGJQzlzxQg&ab_channel=AaronJack
UI to the user, API for the code. Log in —- UI —- Front End —- API —- Back End
++++Enable Developer Extra and Python Tooltips!++++
The Python Console has autocompletion

The Blender Python API can’t create Blender data that exists outside the main Blender database (accessed through bpy.data)
bpy (Blender Python), there are some specific modules in Blender that may not be found in standard Python

Cheat Sheet
https://docs.blender.org/manual/en/dev/advanced/operators.html#bpy-ops-wm-operator-cheat-sheet


Shell scripting languages

powershell

https://learn.microsoft.com/en-us/training/modules/introduction-to-powershell/

Cmdlets:(pronounced commandlets) commands to perform tasks and operations. Building blocks for Powershell scripts and commands.

Get-Command

To filter the list, keep in mind the verb-noun naming standard for cmdlets. For example, in the Get-Random command, Get is the verb and Random is the noun. Use flags to target either the verb or the noun in the command you want. The flag you specify expects a value that's a string. You can add pattern-matching characters to that string to ensure you express that, for example, a flag's value should start or end with a certain string.

Get-Location / pwd 


Set-Location oppure cd (change directory)
dir / Get-ChildItem per vedere file in directory

(=ls)

Cd .. torna indietro di uno
Cls clear (doesn't affect the command history)

Open a text file with the default associated editor

Start-Process -FilePath "C:\Path\To\Your\Filename.extension"

To open the file with a specific application use the Verb parameter
“Edit” open the file with the default editor

Start-Process -FilePath "C:\Path\To\Your\Filename.extension" -Verb "Edit"

To open the file with a different application (example with visual studio code, “code” is the command to launch vscode)

Start-Process "code" -ArgumentList "C:\Path\To\Your\Filename.extension"

version of powershell

$PSVersionTable



automatic variables: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.4



newrocker.png

To set the timer duration (seconds)

$timerDuration = 30

Display then a message when the timer starts

Write-Host "Timer running for $timerDuration seconds..."

Start the timer

Start-Sleep -Seconds $timerDuration

Display a message when the timer has finished

Write-Host "The end!"