View Single Post
  #3   Spotlight this post!  
Unread 18-07-2013, 07:41
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,568
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: Team 254 Open-Source Release: Cheesy Parts

Quote:
Originally Posted by Cory View Post
That would be PDM, which is from Solidworks and natively integrated. Purely for revision control.

We want to see if there's a way to automatically pull completed drawings from the PDM vault once they're checked in, so that you have one less step to go from the part management system to making parts, but we haven't done that yet.
I have some code that extracts the images from solidworks drawings. I've been working on a PDM system inspired by 254 as well. Don't kill my computer (innovators.mooo.com). Click on Samples.

Basically, solidworks files are OLE files, so you need a library to deal with OLE files. With my PDM I'm setting up for next year, it directly interfaces with the Solidworks PDM. I've hardcoded it in my case (because...well...I just did). The only issue I'm having is that I have to rewrite my database every page load. This is because the Solidworks PDM stores data in a flat text file. When a part is updated, removed, or added, it's reflected in the flat file. I need a better way of "diff"ing the database and my flat file. If you have any ideas, that would be great. I could possibly copy the flat file and run some process in the background and look to see if something's been updated then update the database, but oh well.

Also, the PDM I'm working on will also pull out PDFs of drawings that are saved automagically.

Code:
import OleFileIO_PL

def getpng(request, project_id, partid):
	project = Project.objects.get(id = project_id)
	part = Part.objects.get(id = partid)
	filename = 'D:/VaultData/projects/'+project.name+'/'+part.fileName.replace('.','_')+'/'+part.revision+'/_'+part.fileName[-6:]
	
	try:
		with open(filename1): pass
	except:
		a=1
	
	if (filename):
		assert OleFileIO_PL.isOleFile(filename)
		ole = OleFileIO_PL.OleFileIO(filename)
		png = ole.openstream('PreviewPNG')
		data = png.read()
		return HttpResponse(data, mimetype="image/png")

Last edited by Michael Hill : 18-07-2013 at 07:44.