How to get Shipping and Billing address from Order in magento 2?

In Magento 2 we can get Customer billing and Shipping address by order id using below code snippet,
Sometimes we required billing or shipping address of specific order placed by the customer we can get billing and shipping address by order id,
Using Block file get customer order’s billing and shipping address,

Call a required function in the template file, You need to pass Order id to below function. Using Order Id we can get Customer billing and shipping address id and based on respective id we can get billing and shipping address.

 

How to create Shipment programmatically in magento 2?

We just need to pass order id in generateShipment($orderId) function from template.
below code snippet is used for generating Shipment in Magento 2, After generating Shipment automatically send the Shipment mail to a customer who has placed the order.

Call function from the template,

Now Check from Admin panel.

Sales -> Order, Order with Id 1 has generated Shipment.