Browsed by
Tag: part

List All Parts in an Assembly and Subassemblies

List All Parts in an Assembly and Subassemblies

Compatible with WizoScript versions: 2.01

Lists all the parts in an assembly and all of it’s sub-assemblies.

# list all the parts in an assembly and it's sub-assemblies
def ListPartsinAssembly(Assem):
  for P in Assem.Parts:
    print "%s in %s" % (P, Assem)
 
  for SA in Assem.SubAssemblies:
    ListPartsinAssembly(SA)
 
# top-level assembly
Assem = Assembly(r'C:\Users\Andy\Documents\JacktheRipperBot\Parts\Source', 'JacktheRipperBot.AD_ASM')
ListPartsinAssembly(Assem)
Assem.Close()
Find Parts and Assemblies in a Folder

Find Parts and Assemblies in a Folder

Compatible with WizoScript versions: 2.01

Gets a list of all parts and assemblies inside a folder and all sub-folders.

# get a list of parts and assemblies inside a folder and all
# sub-folders
 
import fnmatch
import os
 
# folder to search
Folder = r"C:\Users\Andy\Documents\Foldcopter\Parts"
 
# create empty lists
Parts = []
Assemblies = []
 
# perform the search
for Root, Dirnames, Filenames in os.walk(Folder):
  for Filename in fnmatch.filter(Filenames, '*.AD_PRT'):
    Parts.append(os.path.join(Root, Filename))
  for Filename in fnmatch.filter(Filenames, '*.AD_ASM'):
    Assemblies.append(os.path.join(Root, Filename))
 
# show all the files we have found
print Parts
print Assemblies
Hex Head Bolt

Hex Head Bolt

Compatible with WizoScript version 1.22 and later.

Creates a simple bolt with a cap head featuring a hexagonal recess.

MyPart = Part("My Part")
 
XYPlane = MyPart.GetPlane("XY-Plane")
HeadSketch = MyPart.AddSketch("Head", XYPlane)
HeadSketch.AddCircle(0, 0, 10, False)
BoltHead = MyPart.AddExtrudeBoss("Bolt Head", HeadSketch, 5, False)
 
HeadBottomPlane = MyPart.AddPlane("Head Bottom", XYPlane, 5)
ShoulderSketch = MyPart.AddSketch("Shoulder", HeadBottomPlane)
ShoulderSketch.AddCircle(0, 0, 5, False)
BoltShoulder = MyPart.AddExtrudeBoss("Bolt Shoulder", ShoulderSketch, 20, False)
 
HexSketch = MyPart.AddSketch("Hex", XYPlane)
HexSketch.AddPolygon(0, 0, 5, 6, False)
HexRecess = MyPart.AddExtrudeCut("Hex Recess", HexSketch, 3, False)
 
MyPart.Save("C:\Users\Andy\Desktop")
MyPart.ExportSTL("C:\Users\Andy\Desktop\My Part.stl")
MyPart.Close()